wrapper

package
v0.27.7 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsContainerSource added in v0.21.0

func AsContainerSource(w *Wrapper) core.Source

AsContainerSource provides container Source interface from Wrapper instance.

func Delete added in v0.21.0

func Delete(w *Wrapper, 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 Get added in v0.21.0

func Get(w *Wrapper, cid *cid.ID) (*container.Container, error)

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

Returns error if cid is nil.

func Put added in v0.21.0

func Put(w *Wrapper, cnr *container.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 added in v0.21.0

func PutEACL(w *Wrapper, table *eacl.Table) 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 added in v0.27.0

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

AnnounceLoadPrm groups parameters of AnnounceLoad operation.

func (*AnnounceLoadPrm) SetAnnouncement added in v0.27.0

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

SetAnnouncement sets announcement.

func (*AnnounceLoadPrm) SetReporter added in v0.27.0

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

SetReporter sets public key of the reporter.

type DeletePrm added in v0.27.0

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

DeletePrm groups parameters of Delete client operation.

func (*DeletePrm) SetCID added in v0.27.0

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

SetCID sets container ID.

func (*DeletePrm) SetSignature added in v0.27.0

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

SetSignature sets signature.

func (*DeletePrm) SetToken added in v0.27.0

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

SetToken sets session token.

type Estimation added in v0.15.0

type Estimation struct {
	Size uint64

	Reporter []byte
}

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

type EstimationID added in v0.15.0

type EstimationID []byte

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

type Estimations added in v0.15.0

type Estimations struct {
	ContainerID *cid.ID

	Values []Estimation
}

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

type Option added in v0.21.0

type Option func(*opts)

Option allows to set an optional parameter of Wrapper.

func AsAlphabet added in v0.25.0

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 added in v0.21.0

func TryNotary() Option

TryNotary returns option to enable notary invocation tries.

func WithCustomFeeForNamedPut added in v0.27.0

func WithCustomFeeForNamedPut(fee fixedn.Fixed8) Option

WithCustomFeeForNamedPut returns option to specify custom fee for each Put operation with named container.

type PutEACLPrm added in v0.27.0

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

PutEACLPrm groups parameters of PutEACL operation.

func (*PutEACLPrm) SetKey added in v0.27.0

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

SetKey sets key.

func (*PutEACLPrm) SetSignature added in v0.27.0

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

SetSignature sets signature.

func (*PutEACLPrm) SetTable added in v0.27.0

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

SetTable sets table.

func (*PutEACLPrm) SetToken added in v0.27.0

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

SetToken sets session token.

type PutPrm added in v0.27.0

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

PutPrm groups parameters of Put operation.

func (*PutPrm) SetContainer added in v0.27.0

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

SetContainer sets container data.

func (*PutPrm) SetKey added in v0.27.0

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

SetKey sets public key.

func (*PutPrm) SetName added in v0.27.0

func (p *PutPrm) SetName(name string)

SetName sets native name.

func (*PutPrm) SetSignature added in v0.27.0

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

SetSignature sets signature.

func (*PutPrm) SetToken added in v0.27.0

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

SetToken sets session token.

func (*PutPrm) SetZone added in v0.27.0

func (p *PutPrm) SetZone(zone string)

SetZone sets zone.

type StartEstimationPrm added in v0.27.0

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

StartEstimationPrm groups parameters of StartEstimation operation.

func (*StartEstimationPrm) SetEpoch added in v0.27.0

func (s *StartEstimationPrm) SetEpoch(epoch uint64)

SetEpoch sets epoch.

type StopEstimationPrm added in v0.27.0

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

StopEstimationPrm groups parameters of StopEstimation operation.

func (*StopEstimationPrm) SetEpoch added in v0.27.0

func (s *StopEstimationPrm) SetEpoch(epoch uint64)

SetEpoch sets epoch.

type Wrapper

type Wrapper struct {
	internal.StaticClient
	// contains filtered or unexported fields
}

Wrapper is a wrapper over container contract client which implements container storage and eACL storage methods.

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

func NewFromMorph added in v0.21.0

func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*Wrapper, 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 (*Wrapper) AnnounceLoad added in v0.15.0

func (w *Wrapper) AnnounceLoad(prm AnnounceLoadPrm) error

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

Returns any error encountered that caused the saving to interrupt.

func (*Wrapper) Delete

func (w *Wrapper) Delete(prm DeletePrm) error

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

Returns any error encountered that caused the removal to interrupt.

If TryNotary is provided, calls notary contract.

func (*Wrapper) Get

func (w *Wrapper) Get(cid []byte) (*container.Container, error)

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

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

func (*Wrapper) GetEACL

func (w *Wrapper) GetEACL(cid *cid.ID) (*eacl.Table, error)

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

func (*Wrapper) GetUsedSpaceEstimations added in v0.15.0

func (w *Wrapper) GetUsedSpaceEstimations(id EstimationID) (*Estimations, error)

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

func (*Wrapper) List

func (w *Wrapper) List(ownerID *owner.ID) ([]*cid.ID, error)

List returns a list of container identifiers belonging to the specified owner of NeoFS system. The list is composed through Container contract call.

Returns the identifiers of all NeoFS containers if pointer to owner identifier is nil.

func (*Wrapper) ListLoadEstimationsByEpoch added in v0.15.0

func (w *Wrapper) 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 (Wrapper) Morph added in v0.25.0

func (w Wrapper) Morph() *client.Client

Morph returns raw morph client.

func (*Wrapper) Put

func (w *Wrapper) Put(prm PutPrm) error

Put saves binary container with its session token, key and signature in NeoFS 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 (*Wrapper) PutEACL

func (w *Wrapper) PutEACL(prm PutEACLPrm) error

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

Returns any error encountered that caused the saving to interrupt.

func (*Wrapper) StartEstimation added in v0.15.0

func (w *Wrapper) StartEstimation(prm StartEstimationPrm) error

StartEstimation votes to produce start estimation notification.

func (*Wrapper) StopEstimation added in v0.15.0

func (w *Wrapper) StopEstimation(prm StopEstimationPrm) error

StopEstimation votes to produce stop estimation notification.

Jump to

Keyboard shortcuts

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