container

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: GPL-3.0 Imports: 22 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 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(p DeletePrm) error

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

Returns any error encountered that caused the removal to interrupt.

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.1

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.1

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.1

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.1

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.1

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.1

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(p 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.

func (*Client) PutEACL added in v0.28.0

func (c *Client) PutEACL(p 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 (*Client) PutReport added in v0.49.1

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) 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 {
	client.InvokePrmOptional
	// 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 {
	client.InvokePrmOptional
	// 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 {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

PutPrm groups parameters of Put operation.

func (*PutPrm) EnableMeta added in v0.45.0

func (p *PutPrm) EnableMeta()

EnableMeta enables meta-on-chain.

func (*PutPrm) SetContainer added in v0.28.0

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

SetContainer sets container data.

func (*PutPrm) SetKey added in v0.28.0

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

SetKey sets public key.

func (*PutPrm) SetName added in v0.28.0

func (p *PutPrm) SetName(name string)

SetName sets native name.

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.

func (*PutPrm) SetZone added in v0.28.0

func (p *PutPrm) SetZone(zone string)

SetZone sets zone.

type Quota added in v0.49.1

type Quota struct {
	SoftLimit uint64
	HardLimit uint64
}

Quota represents set quota limits.

func (*Quota) FromStackItem added in v0.49.1

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

FromStackItem implements stackitem.Convertible.

type Report added in v0.49.1

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.1

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

FromStackItem implements stackitem.Convertible.

type Summary added in v0.49.1

type Summary struct {
	Size            uint64
	NumberOfObjects uint64
}

Summary represents summary container report.

func (*Summary) FromStackItem added in v0.49.1

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