ant

package
v0.0.0-...-b755d8c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2018 License: MIT Imports: 21 Imported by: 1

Documentation

Overview

Package ant provides an abstraction for the functionality of 'ants' in the antfarm. Ants are Sia clients that have a myriad of user stories programmed as their behavior and report their successfullness at each user store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ant

type Ant struct {
	APIAddr string
	RPCAddr string

	Config AntConfig

	// A variable to track which blocks + heights the sync detector has seen
	// for this ant. The map will just keep growing, but it shouldn't take up a
	// prohibitive amount of space.
	SeenBlocks map[types.BlockHeight]types.BlockID `json:"-"`
	// contains filtered or unexported fields
}

An Ant is a Sia Client programmed with network user stories. It executes these user stories and reports on their successfulness.

func New

func New(config AntConfig) (*Ant, error)

New creates a new Ant using the configuration passed through `config`.

func (*Ant) BlockHeight

func (a *Ant) BlockHeight() types.BlockHeight

BlockHeight returns the highest block height seen by the ant.

func (*Ant) Close

func (a *Ant) Close() error

Close releases all resources created by the ant, including the Siad subprocess.

func (*Ant) StartJob

func (a *Ant) StartJob(job string, args ...interface{}) error

StartJob starts the job indicated by `job` after an ant has been initialized. Arguments are passed to the job using args.

func (*Ant) WalletAddress

func (a *Ant) WalletAddress() (*types.UnlockHash, error)

WalletAddress returns a wallet address that this ant can receive coins on.

type AntConfig

type AntConfig struct {
	APIAddr         string `json:",omitempty"`
	RPCAddr         string `json:",omitempty"`
	HostAddr        string `json:",omitempty"`
	SiaDirectory    string `json:",omitempty"`
	Name            string `json:",omitempty"`
	SiadPath        string
	Jobs            []string
	DesiredCurrency uint64
}

AntConfig represents a configuration object passed to New(), used to configure a newly created Sia Ant.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL