remoteclient

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostForRemoteClient

func HostForRemoteClient(cfg *Config) (host.Host, error)

func MakeRemoteDataNodeClient

func MakeRemoteDataNodeClient(ctx context.Context, host host.Host, target string, timeout int, token string) (core.RemoteDataNodeClient, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, cfg *Config) (*Client, error)

func (*Client) Add

func (cl *Client) Add(p string, objname string) (*MetaInfo, error)

func (*Client) AddReader added in v0.0.7

func (cl *Client) AddReader(r io.Reader, fsize int64, fname string, objname string) (*MetaInfo, error)

func (*Client) FileInfo

func (cl *Client) FileInfo(objname string) (*MetaInfo, error)

func (*Client) Get

func (cl *Client) Get(objname string) (io.ReadCloser, error)

func (*Client) GetByCid

func (cl *Client) GetByCid(cidstr string) (io.ReadCloser, error)

func (*Client) GetDataStore added in v0.0.7

func (cl *Client) GetDataStore() datastore.Batching

type Config

type Config struct {
	AccessToken string `json:"access_token"`
	Bucket      string `json:"bucket"`
	Timeout     int    `json:"timeout"`
	SwarmKey    string `json:"swarmkey"`
	Target      string `json:"target"`
}

func ReadConfig

func ReadConfig(path string) (*Config, error)

type MetaInfo

type MetaInfo struct {
	Path string
	Name string
	Size int64
	Cid  string
}

type RemoteStore

type RemoteStore struct {
	// contains filtered or unexported fields
}

func NewRemoteStore

func NewRemoteStore(ctx context.Context, h host.Host, target string, timeout int, token string) (*RemoteStore, error)

func NewRemoteStoreWithClient

func NewRemoteStoreWithClient(ctx context.Context, h host.Host, client core.RemoteDataNodeClient) *RemoteStore

func (*RemoteStore) Batch

func (d *RemoteStore) Batch() (ds.Batch, error)

func (*RemoteStore) Close

func (d *RemoteStore) Close() error

func (*RemoteStore) Delete

func (d *RemoteStore) Delete(k ds.Key) error

func (*RemoteStore) Get

func (d *RemoteStore) Get(k ds.Key) ([]byte, error)

func (*RemoteStore) GetSize

func (d *RemoteStore) GetSize(k ds.Key) (int, error)

func (*RemoteStore) Has

func (d *RemoteStore) Has(k ds.Key) (bool, error)

func (*RemoteStore) Put

func (d *RemoteStore) Put(k ds.Key, value []byte) error

func (*RemoteStore) Query

func (d *RemoteStore) Query(q dsq.Query) (dsq.Results, error)

func (*RemoteStore) Sync

func (d *RemoteStore) Sync(ds.Key) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL