Documentation ¶
Overview ¶
Package maptracker implements a PinTracker component for IPFS Cluster. It uses a map to keep track of the state of tracked pins.
Index ¶
- Variables
- type MapPinTracker
- func (mpt *MapPinTracker) Recover(c *cid.Cid) (api.PinInfo, error)
- func (mpt *MapPinTracker) SetClient(c *rpc.Client)
- func (mpt *MapPinTracker) Shutdown() error
- func (mpt *MapPinTracker) Status(c *cid.Cid) api.PinInfo
- func (mpt *MapPinTracker) StatusAll() []api.PinInfo
- func (mpt *MapPinTracker) Sync(c *cid.Cid) (api.PinInfo, error)
- func (mpt *MapPinTracker) SyncAll() ([]api.PinInfo, error)
- func (mpt *MapPinTracker) Track(c api.Pin) error
- func (mpt *MapPinTracker) Untrack(c *cid.Cid) error
Constants ¶
This section is empty.
Variables ¶
var ( PinningTimeout = 60 * time.Minute UnpinningTimeout = 15 * time.Minute )
A Pin or Unpin operation will be considered failed if the Cid has stayed in Pinning or Unpinning state for longer than these values.
var PinQueueSize = 1024
PinQueueSize specifies the maximum amount of pin operations waiting to be performed. If the queue is full, pins/unpins will be set to pinError/unpinError.
Functions ¶
This section is empty.
Types ¶
type MapPinTracker ¶
type MapPinTracker struct {
// contains filtered or unexported fields
}
MapPinTracker is a PinTracker implementation which uses a Go map to store the status of the tracked Cids. This component is thread-safe.
func NewMapPinTracker ¶
func NewMapPinTracker(pid peer.ID) *MapPinTracker
NewMapPinTracker returns a new object which has been correcly initialized with the given configuration.
func (*MapPinTracker) Recover ¶
Recover will re-track or re-untrack a Cid in error state, possibly retriggering an IPFS pinning operation and returning only when it is done. The pinning/unpinning operation happens synchronously, jumping the queues.
func (*MapPinTracker) SetClient ¶
func (mpt *MapPinTracker) SetClient(c *rpc.Client)
SetClient makes the MapPinTracker ready to perform RPC requests to other components.
func (*MapPinTracker) Shutdown ¶
func (mpt *MapPinTracker) Shutdown() error
Shutdown finishes the services provided by the MapPinTracker and cancels any active context.
func (*MapPinTracker) Status ¶
func (mpt *MapPinTracker) Status(c *cid.Cid) api.PinInfo
Status returns information for a Cid tracked by this MapPinTracker.
func (*MapPinTracker) StatusAll ¶
func (mpt *MapPinTracker) StatusAll() []api.PinInfo
StatusAll returns information for all Cids tracked by this MapPinTracker.
func (*MapPinTracker) Sync ¶
Sync verifies that the status of a Cid matches that of the IPFS daemon. If not, it will be transitioned to PinError or UnpinError.
Sync returns the updated local status for the given Cid. Pins in error states can be recovered with Recover(). An error is returned if we are unable to contact the IPFS daemon.
func (*MapPinTracker) SyncAll ¶
func (mpt *MapPinTracker) SyncAll() ([]api.PinInfo, error)
SyncAll verifies that the statuses of all tracked Cids match the one reported by the IPFS daemon. If not, they will be transitioned to PinError or UnpinError.
SyncAll returns the list of local status for all tracked Cids which were updated or have errors. Cids in error states can be recovered with Recover(). An error is returned if we are unable to contact the IPFS daemon.