container

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsContainerSource added in v0.28.0

func AsContainerSource(w *Client) containercore.Source

AsContainerSource provides container Source interface from Wrapper instance.

func ContainerFromStruct added in v0.51.0

func ContainerFromStruct(contractStruct containerrpc.ContainerInfo) (container.Container, error)

ContainerFromStruct decodes container from contract structure.

func Get added in v0.28.0

func Get(c *Client, cnr cid.ID) (container.Container, error)

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

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

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

NewFromMorph returns the wrapper instance from the raw morph client.

func (Client) ContractAddress added in v0.28.0

func (c Client) ContractAddress() util.Uint160

ContractAddress returns the address of the associated contract.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, p DeletePrm) error

Delete calls Container contract to delete container with parameterized credentials. If transaction is accepted for processing, Delete waits for it to be successfully executed. Waiting is performed within ctx, client.ErrTxAwaitTimeout is returned when it is done.

Returns any error encountered that caused the removal to interrupt.

Returns apistatus.ContainerLocked if container is locked.

func (*Client) Get

func (c *Client) 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 (*Client) GetContainerQuota added in v0.49.0

func (c *Client) GetContainerQuota(cID cid.ID) (Quota, error)

GetContainerQuota returns set container size quotas according to contract state. If no limit set, zero value is retuned.

func (*Client) GetEACL added in v0.28.0

func (c *Client) GetEACL(cnr cid.ID) (eacl.Table, error)

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

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

func (*Client) GetReportsSummary added in v0.49.0

func (c *Client) GetReportsSummary(cID cid.ID) (Summary, error)

GetReportsSummary returns summary report based on preceding [PutReport] calls made by storage nodes.

func (*Client) GetTakenSpaceByUser added in v0.49.0

func (c *Client) GetTakenSpaceByUser(user user.ID) (uint64, error)

GetTakenSpaceByUser returns a sum of all taken space in every container that belongs to user.

func (*Client) GetUserQuota added in v0.49.0

func (c *Client) GetUserQuota(user user.ID) (Quota, error)

GetUserQuota returns set user size quotas according to contract state. If no limit set, zero value is retuned.

func (*Client) List

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

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

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

func (Client) Morph added in v0.25.0

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

Morph returns raw morph client.

func (*Client) NodeReports added in v0.49.0

func (c *Client) NodeReports(cID cid.ID) ([]Report, error)

NodeReports returns a list of container load reports. The list is composed through Container contract call.

func (*Client) Nodes added in v0.49.0

func (c *Client) Nodes(cid cid.ID) ([][]*keys.PublicKey, error)

Nodes returns container nodes placement from the Container contract. Result is a two-dimensional array corresponding to placement vectors. Returns (nil, nil) if there is no information from the contract.

func (*Client) Put

func (c *Client) Put(ctx context.Context, p PutPrm) (cid.ID, error)

Put calls Container contract to create container with parameterized credentials. If transaction is accepted for processing, Put waits for it to be successfully executed. Waiting is performed within ctx, client.ErrTxAwaitTimeout is returned when it is done.

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

func (*Client) PutEACL added in v0.28.0

func (c *Client) PutEACL(ctx context.Context, p PutEACLPrm) error

PutEACL calls Container contract to set container's extended ACL with parameterized credentials. If transaction is accepted for processing, PutEACL waits for it to be successfully executed. Waiting is done within ctx, client.ErrTxAwaitTimeout is returned when it is done.

Returns any error encountered that caused the saving to interrupt.

func (*Client) PutReport added in v0.49.0

func (c *Client) PutReport(cID cid.ID, storageSize, objsNumber uint64, key []byte) error

PutReport saves container state reported by storage node with key in NeoFS system through Container contract call.

Returns any error encountered that caused the saving to interrupt.

func (*Client) RemoveAttribute added in v0.51.0

func (c *Client) RemoveAttribute(ctx context.Context, cnr cid.ID, attr string, validUntil uint64, pub, sig, token []byte) error

RemoveAttribute calls Container contract to remove container attribute with parameterized credentials. If transaction is accepted for processing, RemoveAttribute waits for it to be successfully executed. Waiting is done within ctx, client.ErrTxAwaitTimeout is returned when it is done.

Returns apistatus.ErrContainerNotFound if requested container is missing.

func (*Client) SetAttribute added in v0.51.0

func (c *Client) SetAttribute(ctx context.Context, cnr cid.ID, attr, val string, validUntil uint64, pub, sig, token []byte) error

SetAttribute calls Container contract to set container attribute with parameterized credentials. If transaction is accepted for processing, SetAttribute waits for it to be successfully executed. Waiting is done within ctx, client.ErrTxAwaitTimeout is returned when it is done.

Returns apistatus.ErrContainerNotFound if requested container is missing.

Returns any error encountered that caused the saving to interrupt.

func (*Client) SubmitObjectPut added in v0.45.0

func (c *Client) SubmitObjectPut(meta []byte, sigs [][][]byte) error

SubmitObjectPut puts object meta information.

Returns any error encountered that caused the saving to interrupt.

func (*Client) UpdateContainerPlacement added in v0.45.0

func (c *Client) UpdateContainerPlacement(cid cid.ID, vectors [][]netmap.NodeInfo, replicas []uint32) error

UpdateContainerPlacement registers public keys as a container's placement vectors. Always sends a notary request with Alphabet multi-signature. Number of vectors must equal number of replicas. Empty vectors removes container placement from the contract.

type DeletePrm added in v0.28.0

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

DeletePrm groups parameters of Delete client operation.

func (*DeletePrm) SetCID added in v0.28.0

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

SetCID sets container ID.

func (*DeletePrm) SetKey added in v0.46.0

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

SetKey sets public key.

func (*DeletePrm) SetSignature added in v0.28.0

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

SetSignature sets signature.

func (*DeletePrm) SetToken added in v0.28.0

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

SetToken sets session token.

type Option

type Option func(*opts)

Option allows to set an optional parameter of Wrapper.

func AsAlphabet added in v0.28.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.

type PutEACLPrm added in v0.28.0

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

PutEACLPrm groups parameters of PutEACL operation.

func (*PutEACLPrm) SetKey added in v0.28.0

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

SetKey sets key.

func (*PutEACLPrm) SetSignature added in v0.28.0

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

SetSignature sets signature.

func (*PutEACLPrm) SetTable added in v0.28.0

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

SetTable sets table.

func (*PutEACLPrm) SetToken added in v0.28.0

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

SetToken sets session token.

type PutPrm added in v0.28.0

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

PutPrm groups parameters of Put operation.

func (*PutPrm) SetContainer added in v0.28.0

func (p *PutPrm) SetContainer(cnr container.Container)

SetContainer sets container.

func (*PutPrm) SetKey added in v0.28.0

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

SetKey sets public key.

func (*PutPrm) SetSignature added in v0.28.0

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

SetSignature sets signature.

func (*PutPrm) SetToken added in v0.28.0

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

SetToken sets session token.

type Quota added in v0.49.0

type Quota struct {
	SoftLimit uint64
	HardLimit uint64
}

Quota represents set quota limits.

func (*Quota) FromStackItem added in v0.49.0

func (q *Quota) FromStackItem(stack stackitem.Item) error

FromStackItem implements stackitem.Convertible.

type Report added in v0.49.0

type Report struct {
	StorageSize     int64
	ObjectsNumber   int64
	ReportsNumber   int64
	Reporter        []byte
	LastUpdateEpoch int64
}

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

func (*Report) FromStackItem added in v0.49.0

func (r *Report) FromStackItem(item stackitem.Item) error

FromStackItem implements stackitem.Convertible.

type Summary added in v0.49.0

type Summary struct {
	Size            uint64
	NumberOfObjects uint64
}

Summary represents summary container report.

func (*Summary) FromStackItem added in v0.49.0

func (s *Summary) FromStackItem(item stackitem.Item) error

FromStackItem implements stackitem.Convertible.

Jump to

Keyboard shortcuts

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