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 ¶
- func MerkleRoot(r io.Reader) (h crypto.Hash, err error)
- func SprintJSON(v interface{}) (string, error)
- type Ant
- func (a *Ant) BlockHeight() types.BlockHeight
- func (a *Ant) Close() error
- func (a *Ant) HasRenterTypeJob() bool
- func (a *Ant) StartJob(antsSyncWG *sync.WaitGroup, job string, args ...interface{}) error
- func (a *Ant) UpdateSiad(logger *persist.Logger, siadPath string) error
- func (a *Ant) WalletAddress() (*types.UnlockHash, error)
- type AntConfig
- type JobRunner
- type RenterFile
- type RenterJob
- type SiadConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MerkleRoot ¶
MerkleRoot calculates merkle root of the file given in reader
func SprintJSON ¶ added in v1.0.2
SprintJSON is a wrapper for json.MarshalIndent
Types ¶
type Ant ¶
type Ant struct { APIAddr string RPCAddr string Config AntConfig Jr *JobRunner // 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 (*Ant) BlockHeight ¶
func (a *Ant) BlockHeight() types.BlockHeight
BlockHeight returns the highest block height seen by the ant.
func (*Ant) HasRenterTypeJob ¶
HasRenterTypeJob returns true if the ant has renter type of job (renter or autoRenter)
func (*Ant) StartJob ¶
StartJob starts the job indicated by `job` after an ant has been initialized. Arguments are passed to the job using args.
func (*Ant) UpdateSiad ¶ added in v1.0.2
UpdateSiad updates ant to use the given siad binary.
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 { SiadConfig Name string `json:",omitempty"` Jobs []string DesiredCurrency uint64 }
AntConfig represents a configuration object passed to New(), used to configure a newly created Sia Ant.
type JobRunner ¶
type JobRunner struct { StaticTG threadgroup.ThreadGroup // contains filtered or unexported fields }
A JobRunner is used to start up jobs on the running Sia node.
func (*JobRunner) NewRenterJob ¶
NewRenterJob returns new renter job
func (*JobRunner) Stop ¶
Stop signals all running jobs to stop and blocks until the jobs have finished stopping.
func (*JobRunner) WaitForRenterUploadReady ¶
WaitForRenterUploadReady waits for renter upload ready with default timeout, data pieces and parity pieces if the ant has renter job. If the ant doesn't have renter job, it returns an error.
type RenterFile ¶
RenterFile stores the location and checksum of a file active on the renter.
type RenterJob ¶
type RenterJob struct { Files []RenterFile // contains filtered or unexported fields }
RenterJob contains statefulness that is used to drive the renter. Most importantly, it contains a list of files that the renter is currently uploading to the network.
type SiadConfig ¶
type SiadConfig struct { APIAddr string APIPassword string DataDir string HostAddr string RPCAddr string SiadPath string SiaMuxAddr string SiaMuxWsAddr string AllowHostLocalNetAddress bool RenterDisableIPViolationCheck bool }
SiadConfig contains the necessary config information to create a new siad instance