container

package
v0.38.9 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsContainerSource

func AsContainerSource(w *Client) containercore.Source

AsContainerSource provides container Source interface from Wrapper instance.

func Delete

func Delete(c *Client, witness core.RemovalWitness) error

Delete marshals container ID, and passes it to Wrapper's Delete method along with signature and session token.

Returns error if container ID is nil.

func DeletionInfo added in v0.37.0

func DeletionInfo(c deletionInfo, cnr cid.ID) (*containercore.DelInfo, error)

func Get

func Get(c getContainer, cnr cid.ID) (*containercore.Container, error)

Get marshals container ID, and passes it to Wrapper's Get method.

func Put

func Put(c *Client, cnr containercore.Container) (*cid.ID, error)

Put marshals container, and passes it to Wrapper's Put method along with sig.Key() and sig.Sign().

Returns error if container is nil.

func PutEACL

func PutEACL(c *Client, eaclInfo containercore.EACL) error

PutEACL marshals table, and passes it to Wrapper's PutEACLBinary method along with sig.Key() and sig.Sign().

Returns error if table is nil.

If TryNotary is provided, calls notary contract.

Types

type AnnounceLoadPrm

type AnnounceLoadPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

AnnounceLoadPrm groups parameters of AnnounceLoad operation.

func (*AnnounceLoadPrm) SetAnnouncement

func (a2 *AnnounceLoadPrm) SetAnnouncement(a container.SizeEstimation)

SetAnnouncement sets announcement.

func (*AnnounceLoadPrm) SetReporter

func (a2 *AnnounceLoadPrm) SetReporter(key []byte)

SetReporter sets public key of the reporter.

type Client

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

Client is a wrapper over StaticClient which makes calls with the names and arguments of the FrostFS Container contract.

Working client must be created via constructor New. Using the Client that has been created with new(Client) expression (or just declaring a Client variable) is unsafe and can lead to panic.

func NewFromMorph

func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*Client, error)

NewFromMorph returns the wrapper instance from the raw morph client.

Specified fee is used for all operations by default. If WithCustomFeeForNamedPut is provided, the customized fee is used for Put operations with named containers.

func (*Client) AnnounceLoad

func (c *Client) AnnounceLoad(p AnnounceLoadPrm) error

AnnounceLoad saves container size estimation calculated by storage node with key in FrostFS system through Container contract call.

Returns any error encountered that caused the saving to interrupt.

func (*Client) ContainersOf

func (c *Client) ContainersOf(idUser *user.ID) ([]cid.ID, error)

ContainersOf returns a list of container identifiers belonging to the specified user of FrostFS system. If idUser is nil, returns the list of all containers.

If remote RPC does not support neo-go session API, fallback to List() method.

func (Client) ContractAddress

func (c Client) ContractAddress() util.Uint160

ContractAddress returns the address of the associated contract.

func (*Client) Delete

func (c *Client) Delete(p DeletePrm) (uint32, error)

Delete removes the container from FrostFS system through Container contract call.

Returns valid until block and any error encountered that caused the removal to interrupt.

If TryNotary is provided, calls notary contract.

func (*Client) DeletionInfo added in v0.37.0

func (c *Client) DeletionInfo(cid []byte) (*containercore.DelInfo, error)

func (*Client) Get

func (c *Client) Get(cid []byte) (*containercore.Container, error)

Get reads the container from FrostFS system by binary identifier through Container contract call.

If an empty slice is returned for the requested identifier, storage.ErrNotFound error is returned.

func (*Client) GetEACL

func (c *Client) GetEACL(cnr cid.ID) (*container.EACL, error)

GetEACL reads the extended ACL table from FrostFS system through Container contract call.

Returns apistatus.EACLNotFound if eACL table is missing in the contract.

func (*Client) GetUsedSpaceEstimations

func (c *Client) GetUsedSpaceEstimations(id EstimationID) (*Estimations, error)

GetUsedSpaceEstimations returns a list of container load estimations by ID. The list is composed through Container contract call.

func (*Client) ListLoadEstimationsByEpoch

func (c *Client) ListLoadEstimationsByEpoch(epoch uint64) ([]EstimationID, error)

ListLoadEstimationsByEpoch returns a list of container load estimations for to the specified epoch. The list is composed through Container contract call.

func (Client) Morph

func (c Client) Morph() *client.Client

Morph returns raw morph client.

func (*Client) Put

func (c *Client) Put(p PutPrm) error

Put saves binary container with its session token, key and signature in FrostFS system through Container contract call.

Returns calculated container identifier and any error encountered that caused the saving to interrupt.

If TryNotary is provided, calls notary contract.

func (*Client) PutEACL

func (c *Client) PutEACL(p PutEACLPrm) error

PutEACL saves binary eACL table with its session token, key and signature in FrostFS system through Container contract call.

Returns any error encountered that caused the saving to interrupt.

func (*Client) StartEstimation

func (c *Client) StartEstimation(p StartEstimationPrm) error

StartEstimation votes to produce start estimation notification.

func (*Client) StopEstimation

func (c *Client) StopEstimation(p StopEstimationPrm) error

StopEstimation votes to produce stop estimation notification.

type DeletePrm

type DeletePrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

DeletePrm groups parameters of Delete client operation.

func (*DeletePrm) SetCID

func (d *DeletePrm) SetCID(cid []byte)

SetCID sets container ID.

func (*DeletePrm) SetKey added in v0.37.0

func (d *DeletePrm) SetKey(key []byte)

SetKey sets public key.

func (*DeletePrm) SetSignature

func (d *DeletePrm) SetSignature(signature []byte)

SetSignature sets signature.

func (*DeletePrm) SetToken

func (d *DeletePrm) SetToken(token []byte)

SetToken sets session token.

type Estimation

type Estimation struct {
	Size uint64

	Reporter []byte
}

Estimation is a structure of single container load estimation reported by storage node.

type EstimationID

type EstimationID []byte

EstimationID is an identity of container load estimation inside Container contract.

type Estimations

type Estimations struct {
	ContainerID cid.ID

	Values []Estimation
}

Estimations is a structure of grouped container load estimation inside Container contract.

type Option

type Option func(*opts)

Option allows to set an optional parameter of Wrapper.

func AsAlphabet

func AsAlphabet() Option

AsAlphabet returns option to sign main TX of notary requests with client's private key.

Considered to be used by IR nodes only.

func TryNotary

func TryNotary() Option

TryNotary returns option to enable notary invocation tries.

type PutEACLPrm

type PutEACLPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

PutEACLPrm groups parameters of PutEACL operation.

func (*PutEACLPrm) SetKey

func (p *PutEACLPrm) SetKey(key []byte)

SetKey sets key.

func (*PutEACLPrm) SetSignature

func (p *PutEACLPrm) SetSignature(sig []byte)

SetSignature sets signature.

func (*PutEACLPrm) SetTable

func (p *PutEACLPrm) SetTable(table []byte)

SetTable sets table.

func (*PutEACLPrm) SetToken

func (p *PutEACLPrm) SetToken(token []byte)

SetToken sets session token.

type PutPrm

type PutPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

PutPrm groups parameters of Put operation.

func (*PutPrm) SetContainer

func (p *PutPrm) SetContainer(cnr []byte)

SetContainer sets container data.

func (*PutPrm) SetKey

func (p *PutPrm) SetKey(key []byte)

SetKey sets public key.

func (*PutPrm) SetName

func (p *PutPrm) SetName(name string)

SetName sets native name.

func (*PutPrm) SetSignature

func (p *PutPrm) SetSignature(sig []byte)

SetSignature sets signature.

func (*PutPrm) SetToken

func (p *PutPrm) SetToken(token []byte)

SetToken sets session token.

func (*PutPrm) SetZone

func (p *PutPrm) SetZone(zone string)

SetZone sets zone.

type StartEstimationPrm

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

StartEstimationPrm groups parameters of StartEstimation operation.

func (*StartEstimationPrm) SetEpoch

func (p *StartEstimationPrm) SetEpoch(epoch uint64)

SetEpoch sets epoch.

type StopEstimationPrm

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

StopEstimationPrm groups parameters of StopEstimation operation.

func (*StopEstimationPrm) SetEpoch

func (p *StopEstimationPrm) SetEpoch(epoch uint64)

SetEpoch sets epoch.

Jump to

Keyboard shortcuts

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