Documentation ¶
Index ¶
- Variables
- type API
- func (i *API) Addrs() []AddrInfo
- func (i *API) CancelJob(jid ffs.JobID) error
- func (i *API) Close() error
- func (i *API) CreatePayChannel(ctx context.Context, from string, to string, amount uint64) (ffs.PaychInfo, cid.Cid, error)
- func (i *API) DefaultConfig() ffs.DefaultConfig
- func (i *API) Get(ctx context.Context, c cid.Cid) (io.Reader, error)
- func (i *API) GetCidConfig(c cid.Cid) (ffs.CidConfig, error)
- func (i *API) GetDefaultCidConfig(c cid.Cid) ffs.CidConfig
- func (i *API) ID() ffs.APIID
- func (i *API) Info(ctx context.Context) (InstanceInfo, error)
- func (i *API) ListPayChannels(ctx context.Context) ([]ffs.PaychInfo, error)
- func (i *API) NewAddr(ctx context.Context, name string, options ...NewAddressOption) (string, error)
- func (i *API) PushConfig(c cid.Cid, opts ...PushConfigOption) (ffs.JobID, error)
- func (i *API) RedeemPayChannel(ctx context.Context, addr string) error
- func (i *API) Remove(c cid.Cid) error
- func (i *API) Replace(c1 cid.Cid, c2 cid.Cid) (ffs.JobID, error)
- func (i *API) SendFil(ctx context.Context, from string, to string, amount *big.Int) error
- func (i *API) SetDefaultConfig(c ffs.DefaultConfig) error
- func (i *API) Show(c cid.Cid) (ffs.CidInfo, error)
- func (i *API) WatchJobs(ctx context.Context, c chan<- ffs.Job, jids ...ffs.JobID) error
- func (i *API) WatchLogs(ctx context.Context, ch chan<- ffs.LogEntry, c cid.Cid, opts ...GetLogsOption) error
- type AddrInfo
- type BalanceInfo
- type Config
- type GetLogsConfig
- type GetLogsOption
- type InstanceInfo
- type NewAddressConfig
- type NewAddressOption
- type PushConfig
- type PushConfigOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMustOverrideConfig returned when trying to push config for storing a Cid // without the override flag. ErrMustOverrideConfig = errors.New("cid already pinned, consider using override flag") // ErrReplacedCidNotFound returns when replacing a Cid that isn't stored. ErrReplacedCidNotFound = errors.New("provided replaced cid wasn't found") // ErrActiveInStorage returns when a Cid is trying to be removed but still defined as active // on Hot or Cold storage. ErrActiveInStorage = errors.New("can't remove Cid, disable from Hot and Cold storage") // ErrHotStorageDisabled returned when trying to fetch a Cid when disabled on Hot Storage. // To retrieve the data, is necessary to call unfreeze by enabling the Enabled flag in // the Hot Storage for that Cid. ErrHotStorageDisabled = errors.New("cid disabled in hot storage") )
var ( // ErrNotFound returned when instance configuration doesn't exist. ErrNotFound = errors.New("stored item not found") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is an Api instance, which owns a Lotus Address and allows to Store and Retrieve Cids from Hot and Cold layers.
func Load ¶
func Load(ds datastore.Datastore, iid ffs.APIID, sched *scheduler.Scheduler, wm ffs.WalletManager, pm ffs.PaychManager) (*API, error)
Load loads a saved Api instance from its ConfigStore.
func New ¶
func New(ctx context.Context, ds datastore.Datastore, iid ffs.APIID, sch *scheduler.Scheduler, wm ffs.WalletManager, pm ffs.PaychManager, dc ffs.DefaultConfig) (*API, error)
New returns a new Api instance.
func (*API) CancelJob ¶
CancelJob cancels an executing Job. If no Job is executing with that JobID, it won't fail.
func (*API) CreatePayChannel ¶
func (i *API) CreatePayChannel(ctx context.Context, from string, to string, amount uint64) (ffs.PaychInfo, cid.Cid, error)
CreatePayChannel creates a new payment channel.
func (*API) DefaultConfig ¶
func (i *API) DefaultConfig() ffs.DefaultConfig
DefaultConfig returns the DefaultConfig.
func (*API) GetCidConfig ¶
GetCidConfig returns the current CidConfig for a Cid.
func (*API) GetDefaultCidConfig ¶
GetDefaultCidConfig returns the default instance Cid config, prepared for a particular Cid.
func (*API) Info ¶
func (i *API) Info(ctx context.Context) (InstanceInfo, error)
Info returns instance information.
func (*API) ListPayChannels ¶
ListPayChannels lists all payment channels associated with this FFS.
func (*API) NewAddr ¶
func (i *API) NewAddr(ctx context.Context, name string, options ...NewAddressOption) (string, error)
NewAddr creates a new address managed by the FFS instance.
func (*API) PushConfig ¶
func (i *API) PushConfig(c cid.Cid, opts ...PushConfigOption) (ffs.JobID, error)
PushConfig push a new configuration for the Cid in the Hot and Cold layer. If WithOverride opt isn't set it errors with ErrMustOverrideConfig.
func (*API) RedeemPayChannel ¶
RedeemPayChannel redeems a payment channel.
func (*API) Remove ¶
Remove removes a Cid from being tracked as an active storage. The Cid should have both Hot and Cold storage disabled, if that isn't the case it will return ErrActiveInStorage.
func (*API) Replace ¶
Replace pushes a CidConfig of c2 equal to c1, and removes c1. This operation is more efficient than manually removing and adding in two separate operations. c1 and c2 must not be equal.
func (*API) SendFil ¶
SendFil sends fil from a managed address to any another address, returns immediately but funds are sent asynchronously.
func (*API) SetDefaultConfig ¶
func (i *API) SetDefaultConfig(c ffs.DefaultConfig) error
SetDefaultConfig sets a new default CidConfig.
func (*API) Show ¶
Show returns the information about a stored Cid. If no information is available, since the Cid was never stored, it returns ErrNotFound.
type BalanceInfo ¶
BalanceInfo contains the balance for the associated wallet address.
type GetLogsConfig ¶
type GetLogsConfig struct {
// contains filtered or unexported fields
}
GetLogsConfig contains configuration for a stream-log of human-friendly messages for a Cid execution.
type GetLogsOption ¶
type GetLogsOption func(config *GetLogsConfig)
GetLogsOption is a function that changes GetLogsConfig.
func WithHistory ¶
func WithHistory(enabled bool) GetLogsOption
WithHistory indicates that prior log history should be sent to the channel before getting realtime logs.
func WithJidFilter ¶
func WithJidFilter(jid ffs.JobID) GetLogsOption
WithJidFilter filters only log messages of a Cid related to the Job with id jid.
type InstanceInfo ¶
type InstanceInfo struct { ID ffs.APIID DefaultConfig ffs.DefaultConfig Balances []BalanceInfo Pins []cid.Cid }
InstanceInfo has general information about a running Api instance.
type NewAddressConfig ¶
type NewAddressConfig struct {
// contains filtered or unexported fields
}
NewAddressConfig contains options for creating a new wallet address.
type NewAddressOption ¶
type NewAddressOption func(config *NewAddressConfig)
NewAddressOption is a function that changes a NewAddressConfig.
func WithAddressType ¶
func WithAddressType(addressType string) NewAddressOption
WithAddressType specifies the type of address to create.
func WithMakeDefault ¶
func WithMakeDefault(makeDefault bool) NewAddressOption
WithMakeDefault specifies if the new address should become the default.
type PushConfig ¶
PushConfig contains options for pushing a Cid configuration.
type PushConfigOption ¶
type PushConfigOption func(o *PushConfig) error
PushConfigOption mutates a push configuration.
func WithCidConfig ¶
func WithCidConfig(c ffs.CidConfig) PushConfigOption
WithCidConfig overrides the Api default Cid configuration.
func WithOverride ¶
func WithOverride(override bool) PushConfigOption
WithOverride allows a new push configuration to override an existing one. It's used as an extra security measure to avoid unwanted configuration changes.