Documentation ¶
Overview ¶
Package pinsvc contains type definitions for the Pinning Services API
Index ¶
Constants ¶
const ( StatusUndefined Status = 0 StatusQueued = 1 << iota StatusPinned StatusPinning StatusFailed )
Values for the Status type.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError is returned by the API as a body when an error occurs. It implements the error interface.
type ListOptions ¶
type ListOptions struct { Cids []types.Cid Name string MatchingStrategy MatchingStrategy Status Status Before time.Time After time.Time Limit int Meta map[string]string }
ListOptions represents possible options given to the List endpoint.
type MatchingStrategy ¶
type MatchingStrategy int
MatchingStrategy defines a type of match for filtering pin lists.
const ( MatchingStrategyUndefined MatchingStrategy = iota MatchingStrategyExact MatchingStrategyIexact MatchingStrategyPartial MatchingStrategyIpartial )
Values for MatchingStrategy.
func MatchingStrategyFromString ¶
func MatchingStrategyFromString(str string) MatchingStrategy
MatchingStrategyFromString converts a string to its MatchingStrategy value.
type Pin ¶
type Pin struct { Cid types.Cid `json:"cid"` Name PinName `json:"name"` Origins []types.Multiaddr `json:"origins"` Meta map[string]string `json:"meta"` }
Pin contains basic information about a Pin and pinning options.
func (Pin) MatchesMeta ¶
MatchesMeta returns true if the pin status metadata matches the given. The metadata should have all the keys in the given metaOpts and the values should, be the same (metadata map includes metaOpts).
func (Pin) MatchesName ¶
func (p Pin) MatchesName(nameOpt string, strategy MatchingStrategy) bool
MatchesName returns in a pin status matches a name option with a given match strategy.
type PinName ¶
type PinName string
PinName is a string limited to 255 chars when serializing JSON.
func (PinName) MarshalJSON ¶
MarshalJSON converts the string to JSON.
func (*PinName) UnmarshalJSON ¶
UnmarshalJSON reads the JSON string and errors if over 256 chars.
type PinStatus ¶
type PinStatus struct { RequestID string `json:"requestid"` Status Status `json:"status"` Created time.Time `json:"created"` Pin Pin `json:"pin"` Delegates []types.Multiaddr `json:"delegates"` Info map[string]string `json:"info"` }
PinStatus provides information about a Pin stored by the Pinning API.
type Status ¶
type Status int
Status represents a pin status, which defines the current state of the pin in the system.
func StatusFromString ¶
StatusFromString parses a string and returns the matching Status value. The string can be a comma-separated list representing a Status filter. Unknown status names are ignored.
func (Status) MarshalJSON ¶
MarshalJSON uses the string representation of Status for JSON encoding.
func (Status) String ¶
String converts a Status into a readable string. If the given Status is a filter (with several bits set), it will return a comma-separated list.
func (*Status) UnmarshalJSON ¶
UnmarshalJSON sets a tracker status from its JSON representation.