client

package
v0.0.59 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: AGPL-3.0, AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Session *client.Session
}

func NewClient

func NewClient(s *client.Session) (*Client, error)

func (*Client) Get

func (c *Client) Get(ID common.MessageID, signature []byte) ([]byte, error)

Get requests ID from the chosen storage node and returns a payload or error

func (*Client) GetStorageProvider

func (c *Client) GetStorageProvider(ID common.MessageID) (StorageLocation, error)

GetStorageProvider returns the deterministically selected storage provider given a storage secret ID

func (*Client) GetWithContext

func (c *Client) GetWithContext(ctx context.Context, ID common.MessageID, signature []byte) ([]byte, error)

GetWithContext requests ID from the chosen storage node and blocks until a response is received or is cancelled.

func (*Client) PayloadSize

func (c *Client) PayloadSize() int

PayloadSize returns the size of the user payload

func (*Client) Put

func (c *Client) Put(ID common.MessageID, signature, payload []byte) error

Put places a value into the store

func (*Client) PutWithContext

func (c *Client) PutWithContext(ctx context.Context, ID common.MessageID, signature, payload []byte) error

type DeterministicDescriptorList

type DeterministicDescriptorList []utils.ServiceDescriptor

func (DeterministicDescriptorList) Len

func (DeterministicDescriptorList) Less

func (d DeterministicDescriptorList) Less(i, j int) bool

func (DeterministicDescriptorList) Swap

func (d DeterministicDescriptorList) Swap(i, j int)

type ReadOnlyClient

type ReadOnlyClient interface {
	Get(addr []byte) ([]byte, error)
	GetWithContext(ctx context.Context, addr []byte) ([]byte, error)
	PayloadSize() int
}

ReadOnlyClient only has Get

func ReadOnly

func ReadOnly(c *Client, roCap common.ReadOnlyCap) ReadOnlyClient

ReadOnly returns a Transport using map that can read with Get() only

type ReadWriteClient

type ReadWriteClient interface {
	Put(addr []byte, payload []byte) error
	Get(addr []byte) ([]byte, error)
	PutWithContext(ctx context.Context, addr []byte, payload []byte) error
	GetWithContext(ctx context.Context, addr []byte) ([]byte, error)
	PayloadSize() int
}

ReadWriteClient has both Get and Put

func Duplex

Duplex returns a RWclient from a pair of ReadOnly and WriteOnly capabilities

func DuplexFromSeed

func DuplexFromSeed(c *Client, initiator bool, secret []byte) ReadWriteClient

func ReadWrite

func ReadWrite(c *Client, rwCap common.ReadWriteCap) ReadWriteClient

ReadWrite returns a Transport using map that can read or write with Get() and Put()

type StorageLocation

type StorageLocation interface {
	ID() common.MessageID
	Name() string
	Provider() string
}

type WriteOnlyClient

type WriteOnlyClient interface {
	Put(addr []byte, payload []byte) error
	PutWithContext(ctx context.Context, addr []byte, payload []byte) error
	PayloadSize() int
}

WriteOnlyClient only has Put

func WriteOnly

func WriteOnly(c *Client, woCap common.WriteOnlyCap) WriteOnlyClient

WriteOnly returns a Transport using map that can write with Put() only

Jump to

Keyboard shortcuts

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