Documentation ¶
Index ¶
- Constants
- Variables
- type AddOption
- type Client
- func (c *Client) Add(ctx context.Context, cid cid.Cid, opts ...AddOption) (PinStatusGetter, error)
- func (c *Client) DeleteByID(ctx context.Context, pinID string) error
- func (c *Client) GetStatusByID(ctx context.Context, pinID string) (PinStatusGetter, error)
- func (c *Client) GoLs(ctx context.Context, opts ...LsOption) (<-chan PinStatusGetter, <-chan error)
- func (c *Client) Ls(ctx context.Context, res chan<- PinStatusGetter, opts ...LsOption) (err error)
- func (c *Client) LsBatchSync(ctx context.Context, opts ...LsOption) ([]PinStatusGetter, int, error)
- func (c *Client) LsSync(ctx context.Context, opts ...LsOption) ([]PinStatusGetter, error)
- func (c *Client) Replace(ctx context.Context, pinID string, cid cid.Cid, opts ...AddOption) (PinStatusGetter, error)
- type LsOption
- type PinGetter
- type PinStatusGetter
- type Status
Constants ¶
View Source
const UserAgent = "go-pinning-service-http-client"
Variables ¶
View Source
var PinOpts = pinOpts{}
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetStatusByID ¶
func (*Client) GoLs ¶ added in v0.25.0
GoLs creates the results and error channels, starts the goroutine that calls Ls, and returns the channels to the caller.
func (*Client) Ls ¶
Ls writes pin statuses to the PinStatusGetter channel. The channel is closed when there are no more pins. If an error occurs or ctx is canceled, then the channel is closed and an error is returned.
Example:
res := make(chan PinStatusGetter, 1) lsErr := make(chan error, 1) go func() { lsErr <- c.Ls(ctx, res, opts...) }() for r := range res { processPin(r) } return <-lsErr
func (*Client) LsBatchSync ¶
Manual version of Ls that returns a single batch of results and int with total count
type PinGetter ¶
type PinGetter interface { fmt.Stringer json.Marshaler // CID to be pinned recursively GetCid() cid.Cid // Optional name for pinned data; can be used for lookups later GetName() string // Optional list of multiaddrs known to provide the data GetOrigins() []string // Optional metadata for pin object GetMeta() map[string]string }
PinGetter Getter for Pin object
type PinStatusGetter ¶
type PinStatusGetter interface { fmt.Stringer json.Marshaler // Globally unique ID of the pin request; can be used to check the status of ongoing pinning, modification of pin object, or pin removal GetRequestId() string GetStatus() Status // Immutable timestamp indicating when a pin request entered a pinning service; can be used for filtering results and pagination GetCreated() time.Time GetPin() PinGetter // List of multiaddrs designated by pinning service for transferring any new data from external peers GetDelegates() []multiaddr.Multiaddr // Optional info for PinStatus response GetInfo() map[string]string }
PinStatusGetter Getter for Pin object with status
Click to show internal directories.
Click to hide internal directories.