container

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilClient = errors.New("container contract client is nil")

ErrNilClient is returned by functions that expect a non-nil Client pointer, but received nil.

Functions

This section is empty.

Types

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 NeoFS 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 New

func New(c *client.StaticClient, opts ...Option) (*Client, error)

New creates, initializes and returns the Client instance.

If StaticClient is nil, client.ErrNilStaticClient is returned.

Other values are set according to provided options, or by default:

  • put container method name: Put;
  • delete container method name: Delete;
  • get container method name: Get;
  • list containers method name: List;
  • set eACL method name: SetEACL;
  • get eACL method name: EACL.
  • start estimation method name: startContainerEstimation
  • stop estimation method name: stopContainerEstimation
  • put container size method name: putContainerSize
  • get container size method name: getContainerSize
  • list container sizes method name: listContainerSizes

If desired option satisfies the default value, it can be omitted. If multiple options of the same config value are supplied, the option with the highest index in the arguments will be used.

func (*Client) Delete

func (c *Client) Delete(args DeleteArgs) error

Delete invokes the call of delete container method of NeoFS Container contract.

func (*Client) EACL

func (c *Client) EACL(args EACLArgs) (*EACLValues, error)

EACL performs the test invoke of get eACL method of NeoFS Container contract.

func (*Client) Get

func (c *Client) Get(args GetArgs) (*GetValues, error)

Get performs the test invoke of get container method of NeoFS Container contract.

func (*Client) GetContainerSize added in v0.15.0

func (c *Client) GetContainerSize(args GetSizeArgs) (*GetSizeValues, error)

GetContainerSize performs the test invoke of "get container size" method of NeoFS Container contract.

func (*Client) List

func (c *Client) List(args ListArgs) (*ListValues, error)

List performs the test invoke of list container method of NeoFS Container contract.

func (*Client) ListSizes added in v0.15.0

func (c *Client) ListSizes(args ListSizesArgs) (*ListSizesValues, error)

List performs the test invoke of "list container sizes" method of NeoFS Container contract.

func (Client) Morph added in v0.25.0

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

Morph returns raw morph client.

func (*Client) Put

func (c *Client) Put(args PutArgs) error

Put invokes the call of put container method of NeoFS Container contract.

func (*Client) PutSize added in v0.15.0

func (c *Client) PutSize(args PutSizeArgs) error

PutSize invokes the call of put container size method of NeoFS Container contract.

func (*Client) SetEACL

func (c *Client) SetEACL(args SetEACLArgs) error

SetEACL invokes the call of set eACL method of NeoFS Container contract.

func (*Client) StartEstimation added in v0.15.0

func (c *Client) StartEstimation(args StartEstimation) error

func (*Client) StopEstimation added in v0.15.0

func (c *Client) StopEstimation(args StopEstimation) error

type DeleteArgs

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

DeleteArgs groups the arguments of delete container invocation call.

func (*DeleteArgs) SetCID

func (p *DeleteArgs) SetCID(v []byte)

SetCID sets the container identifier in a binary format.

func (*DeleteArgs) SetSessionToken added in v0.21.0

func (p *DeleteArgs) SetSessionToken(v []byte)

SetSessionToken sets token of the session within which the container was removed in a NeoFS API binary format.

func (*DeleteArgs) SetSignature

func (p *DeleteArgs) SetSignature(v []byte)

SetSignature sets the container identifier owner's signature.

type EACLArgs

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

EACLArgs groups the arguments of get eACL test invoke call.

func (*EACLArgs) SetCID

func (g *EACLArgs) SetCID(v []byte)

SetCID sets the container identifier in a binary format.

type EACLValues

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

EACLValues groups the stack parameters returned by get eACL test invoke.

func (*EACLValues) EACL

func (g *EACLValues) EACL() []byte

EACL returns the eACL table in a binary format.

func (*EACLValues) PublicKey added in v0.14.1

func (g *EACLValues) PublicKey() []byte

PublicKey of the signature.

func (*EACLValues) SessionToken added in v0.21.0

func (g *EACLValues) SessionToken() []byte

SessionToken returns token of the session within which the eACl table was set in a NeoFS API binary format.

func (*EACLValues) Signature added in v0.12.0

func (g *EACLValues) Signature() []byte

Signature returns RFC-6979 signature of extended ACL table.

type Estimation added in v0.15.0

type Estimation struct {
	Size int64

	Reporter []byte
}

type Estimations added in v0.15.0

type Estimations struct {
	ContainerID []byte

	Estimations []Estimation
}

type GetArgs

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

GetArgs groups the arguments of get container test invoke call.

func (*GetArgs) SetCID

func (g *GetArgs) SetCID(v []byte)

SetCID sets the container identifier in a binary format.

type GetSizeArgs added in v0.15.0

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

GetSizeArgs groups the arguments of "get container size" test invoke call..

func (*GetSizeArgs) SetID added in v0.15.0

func (p *GetSizeArgs) SetID(v []byte)

SetID sets identifier of the container estimation.

type GetSizeValues added in v0.15.0

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

GetSizeValues groups the stack items returned by "get container size" test invoke.

func (*GetSizeValues) Estimations added in v0.15.0

func (v *GetSizeValues) Estimations() Estimations

Estimations returns list of the container load estimations.

type GetValues

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

GetValues groups the stack parameters returned by get container test invoke.

func (*GetValues) Container

func (g *GetValues) Container() []byte

Container returns the container in a binary format.

func (*GetValues) PublicKey added in v0.21.0

func (g *GetValues) PublicKey() []byte

PublicKey returns public key related to signature.

func (*GetValues) SessionToken added in v0.21.0

func (g *GetValues) SessionToken() []byte

SessionToken returns token of the session within which the container was created in a NeoFS API binary format.

func (*GetValues) Signature added in v0.21.0

func (g *GetValues) Signature() []byte

Signature returns RFC-6979 signature of the container.

type ListArgs

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

ListArgs groups the arguments of list containers test invoke call.

func (*ListArgs) SetOwnerID

func (l *ListArgs) SetOwnerID(v []byte)

SetOwnerID sets the container owner identifier in a binary format.

type ListSizesArgs added in v0.15.0

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

ListSizesArgs groups the arguments of "list container sizes" test invoke call..

func (*ListSizesArgs) SetEpoch added in v0.15.0

func (p *ListSizesArgs) SetEpoch(v uint64)

SetEpoch sets the number of the epoch to select the estimations.

type ListSizesValues added in v0.15.0

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

ListSizesValues groups the stack items returned by "list container sizes" test invoke.

func (*ListSizesValues) IDList added in v0.15.0

func (v *ListSizesValues) IDList() [][]byte

Announcements returns list of identifiers of the container load estimations.

type ListValues

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

ListValues groups the stack parameters returned by list containers test invoke.

func (*ListValues) CIDList

func (l *ListValues) CIDList() [][]byte

CIDList returns the list of container identifiers in a binary format.

type Option

type Option func(*cfg)

Option is a client configuration change function.

func WithDeleteMethod

func WithDeleteMethod(n string) Option

WithDeleteMethod returns a client constructor option that specifies the method name of container removal operation.

Ignores empty value.

If option not provided, "Delete" is used.

func WithEACLMethod

func WithEACLMethod(n string) Option

WithEACLMethod returns a client constructor option that specifies the method name of eACL receiving operation.

Ignores empty value.

If option not provided, "EACL" is used.

func WithGetMethod

func WithGetMethod(n string) Option

WithGetMethod returns a client constructor option that specifies the method name of container receiving operation.

Ignores empty value.

If option not provided, "Get" is used.

func WithGetSizeMethod added in v0.15.0

func WithGetSizeMethod(n string) Option

WithGetSizeMethod returns a client constructor option that specifies the method name of "get container size" operation.

Ignores empty value.

If option not provided, "getContainerSize" is used.

func WithListMethod

func WithListMethod(n string) Option

WithListMethod returns a client constructor option that specifies the method name of container listing operation.

Ignores empty value.

If option not provided, "List" is used.

func WithListSizesMethod added in v0.15.0

func WithListSizesMethod(n string) Option

WithListSizesMethod returns a client constructor option that specifies the method name of "list container sizes" operation.

Ignores empty value.

If option not provided, "listContainerSizes" is used.

func WithPutMethod

func WithPutMethod(n string) Option

WithPutMethod returns a client constructor option that specifies the method name of container storing operation.

Ignores empty value.

If option not provided, "Put" is used.

func WithPutSizeMethod added in v0.15.0

func WithPutSizeMethod(n string) Option

WithPutSizeMethod returns a client constructor option that specifies the method name of "put container size" operation.

Ignores empty value.

If option not provided, "putContainerSize" is used.

func WithSetEACLMethod

func WithSetEACLMethod(n string) Option

WithSetEACLMethod returns a client constructor option that specifies the method name of eACL storing operation.

Ignores empty value.

If option not provided, "SetEACL" is used.

func WithStartEstimationMethod added in v0.15.0

func WithStartEstimationMethod(n string) Option

WithStartEstimationMethod returns a client constructor option that specifies the method name of vote to start container size estimation.

Ignores empty value.

If option not provided, "startContainerEstimation" is used.

func WithStopEstimationMethod added in v0.15.0

func WithStopEstimationMethod(n string) Option

WithStopEstimationMethod returns a client constructor option that specifies the method name of vote to stop container size estimation.

Ignores empty value.

If option not provided, "stopContainerEstimation" is used.

type PutArgs

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

PutArgs groups the arguments of put container invocation call.

func (*PutArgs) SetContainer

func (p *PutArgs) SetContainer(v []byte)

SetContainer sets the container structure in a binary format.

func (*PutArgs) SetPublicKey added in v0.12.0

func (p *PutArgs) SetPublicKey(v []byte)

SetPublicKey sets the public key of container owner in a binary format.

func (*PutArgs) SetSessionToken added in v0.21.0

func (p *PutArgs) SetSessionToken(v []byte)

SetSessionToken sets token of the session within which the container was created in a binary format.

func (*PutArgs) SetSignature

func (p *PutArgs) SetSignature(v []byte)

SetSignature sets the container structure owner's signature.

type PutSizeArgs added in v0.15.0

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

PutSizeArgs groups the arguments of "put container size" invocation call.

func (*PutSizeArgs) SetContainerID added in v0.15.0

func (p *PutSizeArgs) SetContainerID(v []byte)

SetContainerID sets identifier of the container being evaluated.

func (*PutSizeArgs) SetEpoch added in v0.15.0

func (p *PutSizeArgs) SetEpoch(v uint64)

SetEpoch sets the number of the epoch when size was estimated.

func (*PutSizeArgs) SetReporterKey added in v0.15.0

func (p *PutSizeArgs) SetReporterKey(v []byte)

SetReporterKey ыуеы public key of the storage node that collected size estimation.

func (*PutSizeArgs) SetSize added in v0.15.0

func (p *PutSizeArgs) SetSize(v uint64)

SetSize sets estimation of the container size.

type SetEACLArgs

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

SetEACLArgs groups the arguments of set eACL invocation call.

func (*SetEACLArgs) SetEACL

func (p *SetEACLArgs) SetEACL(v []byte)

SetEACL sets the extended ACL table in a binary format.

func (*SetEACLArgs) SetPublicKey added in v0.21.0

func (p *SetEACLArgs) SetPublicKey(v []byte)

SetPublicKey sets public key related to table signature.

func (*SetEACLArgs) SetSessionToken added in v0.21.0

func (p *SetEACLArgs) SetSessionToken(v []byte)

SetSessionToken sets token of the session within which the eACL table was set in a binary format.

func (*SetEACLArgs) SetSignature

func (p *SetEACLArgs) SetSignature(v []byte)

SetSignature sets the eACL table structure owner's signature.

type StartEstimation added in v0.15.0

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

func (*StartEstimation) SetEpoch added in v0.15.0

func (e *StartEstimation) SetEpoch(v int64)

type StopEstimation added in v0.15.0

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

func (*StopEstimation) SetEpoch added in v0.15.0

func (e *StopEstimation) SetEpoch(v int64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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