Documentation
¶
Index ¶
- func AsContainerSource(w *Client) containercore.Source
- func ContainerFromStruct(contractStruct containerrpc.ContainerInfo) (container.Container, error)
- func Get(c *Client, cnr cid.ID) (container.Container, error)
- type Client
- func (c Client) ContractAddress() util.Uint160
- func (c *Client) Delete(ctx context.Context, p DeletePrm) error
- func (c *Client) Get(cid []byte) (container.Container, error)
- func (c *Client) GetContainerQuota(cID cid.ID) (Quota, error)
- func (c *Client) GetEACL(cnr cid.ID) (eacl.Table, error)
- func (c *Client) GetReportsSummary(cID cid.ID) (Summary, error)
- func (c *Client) GetTakenSpaceByUser(user user.ID) (uint64, error)
- func (c *Client) GetUserQuota(user user.ID) (Quota, error)
- func (c *Client) List(idUser *user.ID) ([]cid.ID, error)
- func (c Client) Morph() *client.Client
- func (c *Client) NodeReports(cID cid.ID) ([]Report, error)
- func (c *Client) Nodes(cid cid.ID) ([][]*keys.PublicKey, error)
- func (c *Client) Put(ctx context.Context, p PutPrm) (cid.ID, error)
- func (c *Client) PutEACL(ctx context.Context, p PutEACLPrm) error
- func (c *Client) PutReport(cID cid.ID, storageSize, objsNumber uint64, key []byte) error
- func (c *Client) RemoveAttribute(ctx context.Context, cnr cid.ID, attr string, validUntil uint64, ...) error
- func (c *Client) SetAttribute(ctx context.Context, cnr cid.ID, attr, val string, validUntil uint64, ...) error
- func (c *Client) SubmitObjectPut(meta []byte, sigs [][][]byte) error
- func (c *Client) UpdateContainerPlacement(cid cid.ID, vectors [][]netmap.NodeInfo, replicas []uint32) error
- type DeletePrm
- type Option
- type PutEACLPrm
- type PutPrm
- type Quota
- type Report
- type Summary
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.
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
NewFromMorph returns the wrapper instance from the raw morph client.
func (Client) ContractAddress ¶ added in v0.28.0
ContractAddress returns the address of the associated contract.
func (*Client) Delete ¶
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 ¶
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
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
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
GetReportsSummary returns summary report based on preceding [PutReport] calls made by storage nodes.
func (*Client) GetTakenSpaceByUser ¶ added in v0.49.0
GetTakenSpaceByUser returns a sum of all taken space in every container that belongs to user.
func (*Client) GetUserQuota ¶ added in v0.49.0
GetUserQuota returns set user size quotas according to contract state. If no limit set, zero value is retuned.
func (*Client) List ¶
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) NodeReports ¶ added in v0.49.0
NodeReports returns a list of container load reports. The list is composed through Container contract call.
func (*Client) Nodes ¶ added in v0.49.0
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 ¶
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
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
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) SetSignature ¶ added in v0.28.0
SetSignature sets signature.
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
SetContainer sets container.
func (*PutPrm) SetSignature ¶ added in v0.28.0
SetSignature sets signature.
type Quota ¶ added in v0.49.0
Quota represents set quota limits.
func (*Quota) FromStackItem ¶ added in v0.49.0
FromStackItem implements stackitem.Convertible.