fast

package
v1.2.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0, MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDoubleInitOpts is returned by InitDaemon when both init options are provided by FilecoinOpts
	// in NewProcess as well as passed to InitDaemon directly.
	ErrDoubleInitOpts = errors.New("cannot provide both init options through environment and arguments")

	// ErrDoubleDaemonOpts is returned by StartDaemon when both init options are provided by FilecoinOpts
	// in NewProcess as well as passed to StartDaemon directly.
	ErrDoubleDaemonOpts = errors.New("cannot provide both daemon options through environment and arguments")
)

Functions

This section is empty.

Types

type ActionOption

type ActionOption func() []string

ActionOption is used to pass optional arguments to actions. Thought it's not necessary, we use function options to enforce coding standards not not passing string options directly into the actions.

func AOAllowDuplicates

func AOAllowDuplicates(allow bool) ActionOption

AOAllowDuplicates provides the --allow-duplicates option to client propose-storage-deal

func AOCount

func AOCount(count uint) ActionOption

AOCount provides the `--count=<uint>` option to actions

func AOFormat

func AOFormat(format string) ActionOption

AOFormat provides the `--format=<format>` option to actions

func AOFromAddr

func AOFromAddr(fromAddr address.Address) ActionOption

AOFromAddr provides the `--from=<addr>` option to actions

func AOLatency

func AOLatency() ActionOption

AOLatency provides the `--latency` option to actions

func AOLimit

func AOLimit(limit uint64) ActionOption

AOLimit provides the `--gas-limit=<uint64>` option to actions

func AOMinerAddr

func AOMinerAddr(minerAddr address.Address) ActionOption

AOMinerAddr provides the `--miner=<addr>` option to actions

func AOPayer

func AOPayer(payer address.Address) ActionOption

AOPayer provides the `--payer=<addr>` option to actions

func AOPeerid

func AOPeerid(pid peer.ID) ActionOption

AOPeerid provides the `--peerid=<peerid>` option to actions

func AOPrice

func AOPrice(price *big.Float) ActionOption

AOPrice provides the `--gas-price=<fil>` option to actions

func AOSectorSize

func AOSectorSize(ba abi.SectorSize) ActionOption

AOSectorSize provides the `--sectorsize` option to actions

func AOStreams

func AOStreams() ActionOption

AOStreams provides the `--streams` option to actions

func AOValidAt

func AOValidAt(bh abi.ChainEpoch) ActionOption

AOValidAt provides the `--validate=<blockheight>` option to actions

func AOValue

func AOValue(value int) ActionOption

AOValue provides the `--value` option to actions

func AOVerbose

func AOVerbose() ActionOption

AOVerbose provides the `--verbose` option to actions

func AOWaitForCount

func AOWaitForCount(count uint) ActionOption

AOWaitForCount provides the `--wait-for-count` option to actions

type Filecoin

type Filecoin struct {
	PeerID peer.ID

	Log logging.EventLogger
	// contains filtered or unexported fields
}

Filecoin represents a wrapper around the iptb Core interface.

func NewFilecoinProcess

func NewFilecoinProcess(ctx context.Context, c IPTBCoreExt, eo FilecoinOpts) *Filecoin

NewFilecoinProcess returns a pointer to a Filecoin process that wraps the IPTB core interface `c`.

func (*Filecoin) ActorLs

func (f *Filecoin) ActorLs(ctx context.Context) ([]cmd.ActorView, error)

ActorLs runs the `actor ls` command against the filecoin process.

func (*Filecoin) AddressLookup

func (f *Filecoin) AddressLookup(ctx context.Context, addr address.Address) (peer.ID, error)

AddressLookup runs the address lookup command against the filecoin process.

func (*Filecoin) AddressLs

func (f *Filecoin) AddressLs(ctx context.Context) ([]address.Address, error)

AddressLs runs the address ls command against the filecoin process.

func (*Filecoin) AddressNew

func (f *Filecoin) AddressNew(ctx context.Context) (address.Address, error)

AddressNew runs the address new command against the filecoin process.

func (*Filecoin) ChainHead

func (f *Filecoin) ChainHead(ctx context.Context) ([]cid.Cid, error)

ChainHead runs the chain head command against the filecoin process.

func (*Filecoin) ChainLs

func (f *Filecoin) ChainLs(ctx context.Context) (*json.Decoder, error)

ChainLs runs the chain ls command against the filecoin process.

func (*Filecoin) Config

func (f *Filecoin) Config() (*fcconfig.Config, error)

Config return the config file of the FAST process.

func (*Filecoin) ConfigGet

func (f *Filecoin) ConfigGet(ctx context.Context, key string, v interface{}) error

ConfigGet runs the `config` command against the filecoin process, and decodes the output into `v`.

func (*Filecoin) ConfigSet

func (f *Filecoin) ConfigSet(ctx context.Context, key string, v interface{}) error

ConfigSet runs the `config` command against the filecoin process, encoding `v` as the value.

func (*Filecoin) DHTFindPeer

func (f *Filecoin) DHTFindPeer(ctx context.Context, pid peer.ID) ([]multiaddr.Multiaddr, error)

DHTFindPeer runs the `dht findpeer` command against the filecoin process

func (*Filecoin) DHTFindProvs

func (f *Filecoin) DHTFindProvs(ctx context.Context, key cid.Cid) (*json.Decoder, error)

DHTFindProvs runs the `dht findprovs` command against the filecoin process

func (*Filecoin) DagGet

func (f *Filecoin) DagGet(ctx context.Context, ref cid.Cid) (map[string]interface{}, error)

DagGet runs the `dag get` command against the filecoin process

func (*Filecoin) Dir

func (f *Filecoin) Dir() string

Dir returns the dirtectory used by the filecoin process.

func (*Filecoin) DumpLastOutput

func (f *Filecoin) DumpLastOutput(w io.Writer)

DumpLastOutput writes all the output (args, exit-code, error, stderr, stdout) of the last ran command from RunCmdWithStdin, RunCmdJSONWithStdin, or RunCmdLDJSONWithStdin.

func (*Filecoin) DumpLastOutputJSON

func (f *Filecoin) DumpLastOutputJSON(w io.Writer)

DumpLastOutputJSON writes all the output (args, exit-code, error, stderr, stdout) of the last ran command from RunCmdWithStdin, RunCmdJSONWithStdin, or RunCmdLDJSONWithStdin as json.

func (*Filecoin) ID

func (f *Filecoin) ID(ctx context.Context, options ...ActionOption) (*cmd.IDDetails, error)

ID runs the `id` command against the filecoin process

func (*Filecoin) InitDaemon

func (f *Filecoin) InitDaemon(ctx context.Context, args ...string) (testbedi.Output, error)

InitDaemon initializes the filecoin daemon process.

func (*Filecoin) InspectAll

func (f *Filecoin) InspectAll(ctx context.Context, options ...ActionOption) (*node.AllInspectorInfo, error)

InspectAll runs the `inspect all` command against the filecoin process

func (*Filecoin) InspectConfig

func (f *Filecoin) InspectConfig(ctx context.Context, options ...ActionOption) (*config.Config, error)

InspectConfig runs the `inspect config` command against the filecoin process

func (*Filecoin) InspectDisk

func (f *Filecoin) InspectDisk(ctx context.Context, options ...ActionOption) (*node.DiskInfo, error)

InspectDisk runs the `inspect disk` command against the filecoin process

func (*Filecoin) InspectMemory

func (f *Filecoin) InspectMemory(ctx context.Context, options ...ActionOption) (*node.MemoryInfo, error)

InspectMemory runs the `inspect memory` command against the filecoin process

func (*Filecoin) InspectRuntime

func (f *Filecoin) InspectRuntime(ctx context.Context, options ...ActionOption) (*node.RuntimeInfo, error)

InspectRuntime runs the `inspect runtime` command against the filecoin process

func (*Filecoin) LastCmdStdErr

func (f *Filecoin) LastCmdStdErr() io.ReadCloser

LastCmdStdErr is the standard error output from the last command run

func (*Filecoin) LastCmdStdErrStr

func (f *Filecoin) LastCmdStdErrStr() (string, error)

LastCmdStdErrStr is a shortcut to just get the output as string

func (*Filecoin) MessageSend

func (f *Filecoin) MessageSend(ctx context.Context, target address.Address, method abi.MethodNum, options ...ActionOption) (cid.Cid, error)

MessageSend runs the `message send` command against the filecoin process.

func (*Filecoin) MessageWait

func (f *Filecoin) MessageWait(ctx context.Context, mcid cid.Cid, options ...ActionOption) (cmd.WaitResult, error)

MessageWait runs the `message wait` command against the filecoin process.

func (*Filecoin) MpoolLs

func (f *Filecoin) MpoolLs(ctx context.Context, options ...ActionOption) ([]*types.SignedMessage, error)

MpoolLs runs the `mpool ls` command against the filecoin process.

func (*Filecoin) Protocol

func (f *Filecoin) Protocol(ctx context.Context) (*types.ProtocolParams, error)

Protocol runs the `protocol` command against the filecoin process

func (*Filecoin) RunCmdJSONWithStdin

func (f *Filecoin) RunCmdJSONWithStdin(ctx context.Context, stdin io.Reader, v interface{}, args ...string) error

RunCmdJSONWithStdin runs `args` against Filecoin process `f`. The '--enc=json' flag is appened to the command specified by `args`, the result of the command is marshaled into `v`.

func (*Filecoin) RunCmdLDJSONWithStdin

func (f *Filecoin) RunCmdLDJSONWithStdin(ctx context.Context, stdin io.Reader, args ...string) (*json.Decoder, error)

RunCmdLDJSONWithStdin runs `args` against Filecoin process `f`. The '--enc=json' flag is appened to the command specified by `args`. The result of the command is returned as a json.Decoder that may be used to read and decode JSON values from the result of the command.

func (*Filecoin) RunCmdWithStdin

func (f *Filecoin) RunCmdWithStdin(ctx context.Context, stdin io.Reader, args ...string) (testbedi.Output, error)

RunCmdWithStdin runs `args` against Filecoin process `f`, a testbedi.Output and an error are returned.

func (*Filecoin) Shell

func (f *Filecoin) Shell() error

Shell starts a user shell targeting the filecoin process. Exact behavior is plugin dependent. Please refer to the plugin documentation for more information.

func (*Filecoin) ShowHeader

func (f *Filecoin) ShowHeader(ctx context.Context, ref cid.Cid) (*types.BlockHeader, error)

ShowHeader runs the `show header` command against the filecoin process

func (*Filecoin) ShowMessages

func (f *Filecoin) ShowMessages(ctx context.Context, ref cid.Cid) ([]*types.SignedMessage, error)

ShowMessages runs the `show messages` command against the filecoin process

func (*Filecoin) ShowReceipts

func (f *Filecoin) ShowReceipts(ctx context.Context, ref cid.Cid) ([]types.MessageReceipt, error)

ShowReceipts runs the `show receipts` command against the filecoin process

func (*Filecoin) StartDaemon

func (f *Filecoin) StartDaemon(ctx context.Context, wait bool, args ...string) (testbedi.Output, error)

StartDaemon starts the filecoin daemon process.

func (*Filecoin) StartLogCapture

func (f *Filecoin) StartLogCapture() (*fastutil.Interval, error)

StartLogCapture returns a fastutil.Interval, after calling fastutil.Interval#Stop all stderr logs generator between the call to StartLogCapture and then will be available. fastutil.Interval implements io.Reader (its a bytes.Buffer) If an error has occurred reading the stderr, the error will be returned here

func (*Filecoin) StopDaemon

func (f *Filecoin) StopDaemon(ctx context.Context) error

StopDaemon stops the filecoin daemon process.

func (*Filecoin) String

func (f *Filecoin) String() string

String returns the string representation of the filecoin process.

func (*Filecoin) SwarmConnect

func (f *Filecoin) SwarmConnect(ctx context.Context, addrs ...multiaddr.Multiaddr) (peer.ID, error)

SwarmConnect runs the `swarm connect` command against the filecoin process

func (*Filecoin) SwarmPeers

func (f *Filecoin) SwarmPeers(ctx context.Context, options ...ActionOption) ([]types.SwarmConnInfo, error)

SwarmPeers runs the `swarm peers` command against the filecoin process

func (*Filecoin) WalletBalance

func (f *Filecoin) WalletBalance(ctx context.Context, addr address.Address) (fbig.Int, error)

WalletBalance run the wallet balance command against the filecoin process.

func (*Filecoin) WalletExport

func (f *Filecoin) WalletExport(ctx context.Context, addrs []address.Address) ([]*crypto.KeyInfo, error)

WalletExport run the wallet export command against the filecoin process.

func (*Filecoin) WalletImport

func (f *Filecoin) WalletImport(ctx context.Context, file files.File) ([]address.Address, error)

WalletImport run the wallet import command against the filecoin process.

func (*Filecoin) WriteConfig

func (f *Filecoin) WriteConfig(cfg *fcconfig.Config) error

WriteConfig writes the config `cgf` to the FAST process's repo.

type FilecoinOpts

type FilecoinOpts struct {
	InitOpts   []ProcessInitOption
	DaemonOpts []ProcessDaemonOption
}

FilecoinOpts are used define process init and daemon options for the environment.

type IPTBCoreExt

type IPTBCoreExt interface {
	testbedi.Config

	// StderrReader is require to gather daemon logs during action execution
	StderrReader() (io.ReadCloser, error)
}

IPTBCoreExt is an extended interface of the iptb.Core. It defines additional requirement.

type ProcessDaemonOption

type ProcessDaemonOption func() []string

ProcessDaemonOption are options passed to process when starting.

func POIsRelay

func POIsRelay() ProcessDaemonOption

POIsRelay provides the `--is-relay` to process when starting.

func POSwarmRelayPublic

func POSwarmRelayPublic(a multiaddr.Multiaddr) ProcessDaemonOption

POSwarmRelayPublic provides the `--swarmrelaypublic=<multiaddress>` to process when starting.

type ProcessInitOption

type ProcessInitOption func() []string

ProcessInitOption are options passed to process init.

func POAutoSealIntervalSeconds

func POAutoSealIntervalSeconds(seconds int) ProcessInitOption

POAutoSealIntervalSeconds provides the `--auto-seal-interval-seconds=<seconds>` option to process at init

func PODevnet

func PODevnet(net string) ProcessInitOption

PODevnet provides the `--devnet-<net>` option to process at init

func PODevnetNightly

func PODevnetNightly() ProcessInitOption

PODevnetNightly provides the `--devnet-nightly` option to process at init

func PODevnetStaging

func PODevnetStaging() ProcessInitOption

PODevnetStaging provides the `--devnet-staging` option to process at init

func PODevnetUser

func PODevnetUser() ProcessInitOption

PODevnetUser provides the `--devnet-user` option to process at init

func POGenesisFile

func POGenesisFile(uri string) ProcessInitOption

POGenesisFile provides the `--genesisfile=<uri>` option to process at init

func POPeerKeyFile

func POPeerKeyFile(pkf string) ProcessInitOption

POPeerKeyFile provides the `--peerkeyfile=<path>` option to process at init

Directories

Path Synopsis
bin

Jump to

Keyboard shortcuts

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