Documentation ¶
Overview ¶
Package stateless implements a PinTracker component for IPFS Cluster, which aims to reduce the memory footprint when handling really large cluster states.
Index ¶
- Constants
- Variables
- type Config
- type Tracker
- func (spt *Tracker) GetPinFromState(ctx context.Context, c api.Cid) api.Pin
- func (spt *Tracker) OpContext(ctx context.Context, c api.Cid) context.Context
- func (spt *Tracker) PinCallback(ctx context.Context, cid api.Cid, peerId string, isPinned bool) error
- func (spt *Tracker) PinQueueSize(ctx context.Context) (int64, error)
- func (spt *Tracker) Recover(ctx context.Context, c api.Cid) (api.PinInfo, error)
- func (spt *Tracker) RecoverAll(ctx context.Context, out chan<- api.PinInfo) error
- func (spt *Tracker) SetClient(c *rpc.Client)
- func (spt *Tracker) Shutdown(ctx context.Context) error
- func (spt *Tracker) Status(ctx context.Context, c api.Cid) api.PinInfo
- func (spt *Tracker) StatusAll(ctx context.Context, filter api.TrackerStatus, out chan<- api.PinInfo) error
- func (spt *Tracker) Track(ctx context.Context, c api.Pin) error
- func (spt *Tracker) Untrack(ctx context.Context, c api.Cid) error
Constants ¶
const ( DefaultMaxPinQueueSize = 1000000 DefaultConcurrentPins = 10 DefaultPriorityPinMaxAge = 24 * time.Hour DefaultPriorityPinMaxRetries = 5 )
Default values for this Config.
Variables ¶
var ( // ErrFullQueue is the error used when pin or unpin operation channel is full. ErrFullQueue = errors.New("pin/unpin operation queue is full. Try increasing max_pin_queue_size") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { config.Saver // If higher, they will automatically marked with an error. MaxPinQueueSize int // ConcurrentPins specifies how many pin requests can be sent to the ipfs // daemon in parallel. If the pinning method is "refs", it might increase // speed. Unpin requests are always processed one by one. ConcurrentPins int // PriorityPinMaxAge specifies the maximum age that a pin needs to // can have since it was submitted to the cluster to be pinned // preferentially (before pins that are older or have too many retries). PriorityPinMaxAge time.Duration // PriorityPinMaxRetries specifies the maximum amount of retries that // a pin can have before it is moved to a non-prioritary queue. PriorityPinMaxRetries int }
Config allows to initialize a Monitor and customize some parameters.
func (*Config) ApplyEnvVars ¶
ApplyEnvVars fills in any Config fields found as environment variables.
func (*Config) LoadJSON ¶
LoadJSON sets the fields of this Config to the values defined by the JSON representation of it, as generated by ToJSON.
func (*Config) ToDisplayJSON ¶
ToDisplayJSON returns JSON config as a string.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker uses the optracker.OperationTracker to manage transitioning shared rep-mgr state (Pins) to the local IPFS node.
func New ¶
func New(cfg *Config, pid peer.ID, peerName string, getState func(ctx context.Context) (state.ReadOnly, error)) *Tracker
New creates a new StatelessPinTracker.
func (*Tracker) GetPinFromState ¶
func (*Tracker) OpContext ¶
OpContext exports the internal optracker's OpContext method. For testing purposes only.
func (*Tracker) PinCallback ¶
func (*Tracker) PinQueueSize ¶
PinQueueSize returns the current size of the pinning queue.
func (*Tracker) Recover ¶
Recover will trigger pinning or unpinning for items in PinError or UnpinError states.
func (*Tracker) RecoverAll ¶
RecoverAll attempts to recover all items tracked by this peer. It returns any errors or when it is done re-tracking.
func (*Tracker) SetClient ¶
SetClient makes the StatelessPinTracker ready to perform RPC requests to other components.
func (*Tracker) Shutdown ¶
Shutdown finishes the services provided by the StatelessPinTracker and cancels any active context.
func (*Tracker) StatusAll ¶
func (spt *Tracker) StatusAll(ctx context.Context, filter api.TrackerStatus, out chan<- api.PinInfo) error
StatusAll returns information for all Cids pinned to the local IPFS node.