Documentation ¶
Index ¶
- type MemPinset
- func (m *MemPinset) Pin(req *PinRequest) (chan PinStatus, error)
- func (m *MemPinset) PinLen() (int, error)
- func (m *MemPinset) Pinned(path string) (pinned bool, err error)
- func (m *MemPinset) Pins(limit, offset int) (pins []string, err error)
- func (m *MemPinset) Status(req *PinRequest) (PinStatus, error)
- func (m *MemPinset) Unpin(req *PinRequest) error
- type PinRequest
- type PinStatus
- type PinStatusStore
- type Pinset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemPinset ¶
MemPinset is a completely ficticious implementation of a pinset it shouldn't ever be used in real-world scenarios. We use it for mocking a pinning service without an actual backing store keeping pins
func (*MemPinset) Pin ¶
func (m *MemPinset) Pin(req *PinRequest) (chan PinStatus, error)
Pin a dataset
type PinRequest ¶
PinRequest is a signed request to modify the status of a pin
func NewPinRequest ¶
NewPinRequest creates a pin request from a private key & path combo
type PinStatus ¶
type PinStatus struct { Path string Pinned bool TTL time.Time PctComplete float32 // optional string representing status, intended to be shown to users Status string Error string }
PinStatus carries state about the status of a pin process
type PinStatusStore ¶
PinStatusStore is an in-memory key-value store of PinStatus using the Status "Path" field as keys To prevent the store from unbounded growth statuses are removed if the timespan since a status "Started" field exceeds the TTL value of the store (defaults to 4 hours). Statuses are checked with a ticker the defaults to calling Sweep every 20 minutes
func (*PinStatusStore) Delete ¶
func (p *PinStatusStore) Delete(path string)
Delete removes a pinjob from the store by path
func (*PinStatusStore) Get ¶
func (p *PinStatusStore) Get(path string) *PinStatus
Get a pinjob by path
func (*PinStatusStore) StartGC ¶
func (p *PinStatusStore) StartGC(interval time.Duration)
StartGC begins the garbage collection ticker
func (*PinStatusStore) Sweep ¶
func (p *PinStatusStore) Sweep()
Sweep checks for stale PinStatus and removes them
type Pinset ¶
type Pinset interface { // Pin can take a while, so Pin returns a channel of PinStatus to // deliver updates structs that should all share an ID for the request that // the Pinset implementation will provide Pin(req *PinRequest) (chan PinStatus, error) // Unpin removes a pin Unpin(req *PinRequest) error // Status gets the current pin state value for a given PinRequest Status(req *PinRequest) (PinStatus, error) // Pins lists pins within the range defined by limit & offset in // lexographical order, smallest to largest Pins(limit, offset int) ([]string, error) // PinLen returns the number of pins in the set PinLen() (int, error) }
Pinset is the interface for acting as a remote pinning service. Pinset implementations are expected to keep a store of PinStatus that callers can use to probe the progress of a request