Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Create(ctx context.Context, opts ...buckets.CreateOption) (*pb.CreateResponse, error)
- func (c *Client) Get(ctx context.Context, thread core.ID, key string) (*pb.GetResponse, error)
- func (c *Client) GetLinks(ctx context.Context, thread core.ID, key, pth string) (*pb.GetLinksResponse, error)
- func (c *Client) List(ctx context.Context, thread core.ID) (*pb.ListResponse, error)
- func (c *Client) ListIpfsPath(ctx context.Context, pth path.Path) (*pb.ListIpfsPathResponse, error)
- func (c *Client) ListPath(ctx context.Context, thread core.ID, key, pth string) (*pb.ListPathResponse, error)
- func (c *Client) MovePath(ctx context.Context, thread core.ID, key, pth string, dest string, ...) error
- func (c *Client) NewTokenContext(ctx context.Context, identity core.Identity, duration time.Duration) (context.Context, error)
- func (c *Client) PullIpfsPath(ctx context.Context, pth path.Path, writer io.Writer, opts ...buckets.Option) error
- func (c *Client) PullPath(ctx context.Context, thread core.ID, key, pth string, writer io.Writer, ...) error
- func (c *Client) PullPathAccessRoles(ctx context.Context, thread core.ID, key, pth string) (map[did.DID]collection.Role, error)
- func (c *Client) PullPathInfo(ctx context.Context, thread core.ID, key, pth string) (map[string]interface{}, error)
- func (c *Client) PushPathAccessRoles(ctx context.Context, thread core.ID, key, pth string, ...) error
- func (c *Client) PushPathInfo(ctx context.Context, thread core.ID, key, pth string, ...) error
- func (c *Client) PushPaths(ctx context.Context, thread core.ID, key string, opts ...buckets.Option) (*PushPathsQueue, error)
- func (c *Client) Remove(ctx context.Context, thread core.ID, key string) error
- func (c *Client) RemovePath(ctx context.Context, thread core.ID, key, pth string, opts ...buckets.Option) (path.Resolved, error)
- func (c *Client) SetPath(ctx context.Context, thread core.ID, key, pth string, remoteCid cid.Cid, ...) (*pb.SetPathResponse, error)
- type PushPathsQueue
- func (c *PushPathsQueue) AddFile(pth, name string) error
- func (c *PushPathsQueue) AddReader(pth string, r io.Reader, size int64) error
- func (c *PushPathsQueue) Close() error
- func (c *PushPathsQueue) Complete() int64
- func (c *PushPathsQueue) Err() error
- func (c *PushPathsQueue) Next() (ok bool)
- func (c *PushPathsQueue) Size() int64
- type PushPathsResult
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPushPathQueueClosed indicates the push path is or was closed. ErrPushPathQueueClosed = errors.New("push path queue is closed") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides the client api.
func NewClient ¶
func NewClient(addr string, opts ...grpc.DialOption) (*Client, error)
NewClient starts the client.
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, opts ...buckets.CreateOption) (*pb.CreateResponse, error)
Create initializes a new bucket. The bucket name is only meant to help identify a bucket in a UI and is not unique.
func (*Client) GetLinks ¶
func (c *Client) GetLinks(ctx context.Context, thread core.ID, key, pth string) (*pb.GetLinksResponse, error)
GetLinks returns lists for resolving a bucket with various protocols.
func (*Client) ListIpfsPath ¶
ListIpfsPath returns items at a particular path in a UnixFS path living in the IPFS network.
func (*Client) ListPath ¶
func (c *Client) ListPath(ctx context.Context, thread core.ID, key, pth string) (*pb.ListPathResponse, error)
ListPath returns information about a bucket path.
func (*Client) MovePath ¶
func (c *Client) MovePath( ctx context.Context, thread core.ID, key, pth string, dest string, opts ...buckets.Option, ) error
MovePath moves a particular path to another path in the existing IPFS UnixFS DAG.
func (*Client) NewTokenContext ¶
func (c *Client) NewTokenContext( ctx context.Context, identity core.Identity, duration time.Duration, ) (context.Context, error)
NewTokenContext adds an identity token targeting the client's service.
func (*Client) PullIpfsPath ¶
func (c *Client) PullIpfsPath(ctx context.Context, pth path.Path, writer io.Writer, opts ...buckets.Option) error
PullIpfsPath pulls the path from a remote UnixFS dag, writing it to writer if it's a file.
func (*Client) PullPath ¶
func (c *Client) PullPath( ctx context.Context, thread core.ID, key, pth string, writer io.Writer, opts ...buckets.Option, ) error
PullPath pulls the bucket path, writing it to writer if it's a file.
func (*Client) PullPathAccessRoles ¶
func (c *Client) PullPathAccessRoles( ctx context.Context, thread core.ID, key, pth string, ) (map[did.DID]collection.Role, error)
PullPathAccessRoles returns access roles for a path.
func (*Client) PullPathInfo ¶
func (c *Client) PullPathInfo( ctx context.Context, thread core.ID, key, pth string, ) (map[string]interface{}, error)
PullPathInfo returns info for a path.
func (*Client) PushPathAccessRoles ¶
func (c *Client) PushPathAccessRoles( ctx context.Context, thread core.ID, key, pth string, roles map[did.DID]collection.Role, opts ...buckets.Option, ) error
PushPathAccessRoles updates path access roles by merging the pushed roles with existing roles. roles is a map of string marshaled public keys to path roles. A non-nil error is returned if the map keys are not unmarshalable to public keys. To delete a role for a public key, set its value to buckets.None.
func (*Client) PushPathInfo ¶
func (c *Client) PushPathInfo( ctx context.Context, thread core.ID, key, pth string, info map[string]interface{}, opts ...buckets.Option, ) error
PushPathInfo updates path info by merging the pushed info with existing info.
func (*Client) PushPaths ¶
func (c *Client) PushPaths( ctx context.Context, thread core.ID, key string, opts ...buckets.Option, ) (*PushPathsQueue, error)
PushPaths returns a queue that can be used to push multiple files and readers to bucket paths. See PushPathQueue.AddFile and PushPathsQueue.AddReader for more.
type PushPathsQueue ¶
type PushPathsQueue struct { // Current contains the current push result. Current PushPathsResult // contains filtered or unexported fields }
PushPathsQueue handles PushPath input and output.
func (*PushPathsQueue) AddFile ¶
func (c *PushPathsQueue) AddFile(pth, name string) error
AddFile adds a file to the queue. pth is the location relative to the bucket root at which to insert the file, e.g., "/path/to/mybone.jpg". name is the location of the file on the local filesystem, e.g., "/Users/clyde/Downloads/mybone.jpg".
func (*PushPathsQueue) AddReader ¶
AddReader adds a reader to the queue. pth is the location relative to the bucket root at which to insert the file, e.g., "/path/to/mybone.jpg". r is the reader to read from. size is the size of the reader. Use of the WithProgress option is not recommended if the reader size is unknown.
func (*PushPathsQueue) Close ¶
func (c *PushPathsQueue) Close() error
Close the queue. Failure to close may lead to unpredictable bucket state.
func (*PushPathsQueue) Complete ¶
func (c *PushPathsQueue) Complete() int64
Complete returns the portion of the queue size that has been pushed.
func (*PushPathsQueue) Err ¶
func (c *PushPathsQueue) Err() error
Err returns the current queue error. Call this method before checking the value of Current.
func (*PushPathsQueue) Next ¶
func (c *PushPathsQueue) Next() (ok bool)
Next blocks while the queue is open, returning true when a result is ready. Use Current to access the result.
func (*PushPathsQueue) Size ¶
func (c *PushPathsQueue) Size() int64
Size returns the queue size in bytes.