Documentation
¶
Index ¶
- type Contract
- type FSChain
- type NetmapContract
- type Server
- func (s *Server) Delete(ctx context.Context, req *protocontainer.DeleteRequest) (*protocontainer.DeleteResponse, error)
- func (s *Server) Get(ctx context.Context, req *protocontainer.GetRequest) (*protocontainer.GetResponse, error)
- func (s *Server) GetExtendedACL(ctx context.Context, req *protocontainer.GetExtendedACLRequest) (*protocontainer.GetExtendedACLResponse, error)
- func (s *Server) List(ctx context.Context, req *protocontainer.ListRequest) (*protocontainer.ListResponse, error)
- func (s *Server) Put(ctx context.Context, req *protocontainer.PutRequest) (*protocontainer.PutResponse, error)
- func (s *Server) RemoveAttribute(ctx context.Context, req *protocontainer.RemoveAttributeRequest) (*protocontainer.RemoveAttributeResponse, error)
- func (s *Server) ResetSessionTokenCheckCache()
- func (s *Server) SetAttribute(ctx context.Context, req *protocontainer.SetAttributeRequest) (*protocontainer.SetAttributeResponse, error)
- func (s *Server) SetExtendedACL(ctx context.Context, req *protocontainer.SetExtendedACLRequest) (*protocontainer.SetExtendedACLResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶ added in v0.45.0
type Contract interface {
// Put sends transaction creating container with provided credentials. If
// transaction is accepted for processing, Put waits for it to be successfully
// executed. Waiting is performed within ctx,
// [apistatus.ErrContainerAwaitTimeout] is returned on when it is done.
Put(ctx context.Context, _ container.Container, pub, sig []byte, sessionToken []byte, eACL *eacl.Table, eaclPub, eaclSig []byte, origRequest []byte) (cid.ID, error)
// Get returns container by its ID. Returns [apistatus.ErrContainerNotFound]
// error if container is missing.
Get(cid.ID) (container.Container, error)
// List returns IDs of all container belonging to the given user.
//
// Callers do not modify the result.
List(user.ID) ([]cid.ID, error)
// PutEACL sends transaction setting container's extended ACL with provided
// credentials. If transaction is accepted for processing, PutEACL waits for it
// to be successfully executed. Waiting is performed within ctx,
// [apistatus.ErrContainerAwaitTimeout] is when it is done.
PutEACL(ctx context.Context, _ eacl.Table, pub, sig []byte, sessionToken []byte, origRequest []byte) error
// GetEACL returns eACL of the container by its ID. Returns
// [apistatus.ErrEACLNotFound] error if eACL is missing.
GetEACL(cid.ID) (eacl.Table, error)
// Delete sends transaction deleting container with provided credentials. If
// transaction is accepted for processing, Delete waits for it to be
// successfully executed. Waiting is performed within ctx,
// [apistatus.ErrContainerAwaitTimeout] is returned when it is done.
Delete(ctx context.Context, _ cid.ID, pub, sig []byte, sessionToken []byte, origRequest []byte) error
// SetAttribute sends transaction setting container attribute with provided
// credentials. If transaction is accepted for processing, SetAttribute waits
// for it to be successfully executed. Waiting is performed within ctx,
// [apistatus.ErrContainerAwaitTimeout] is returned when it is done.
SetAttribute(ctx context.Context, _ cid.ID, attr, val string, validUntil uint64, pub, sig, sessionToken []byte) error
// RemoveAttribute sends transaction removing container attribute with provided
// credentials. If transaction is accepted for processing, RemoveAttribute waits
// for it to be successfully executed. Waiting is performed within ctx,
// [apistatus.ErrContainerAwaitTimeout] is returned when it is done.
RemoveAttribute(ctx context.Context, _ cid.ID, attr string, validUntil uint64, pub, sig, sessionToken []byte) error
}
Contract groups ops of the Container contract deployed in the FS chain required to serve NeoFS API Container service.
type FSChain ¶ added in v0.46.0
type FSChain interface {
InvokeContainedScript(tx *transaction.Transaction, header *block.Header, _ *trigger.Type, _ *bool) (*result.Invoke, error)
// HasUserInNNS checks whether user with given address is registered in NNS
// under the given name.
HasUserInNNS(name string, addr neoutil.Uint160) (bool, error)
}
FSChain provides base non-contract functionality of the FS chain required to serve NeoFS API Container service.
type NetmapContract ¶ added in v0.46.0
type NetmapContract interface {
// GetEpochBlock returns FS chain height when given NeoFS epoch was ticked.
GetEpochBlock(epoch uint64) (uint32, error)
// GetEpochBlockByTime returns FS chain height of block index when the latest epoch that
// started not later than the provided block time came.
GetEpochBlockByTime(t uint32) (uint32, error)
}
NetmapContract represents Netmap contract deployed in the FS chain required to serve NeoFS API Container service.
type Server ¶ added in v0.17.0
type Server struct {
protocontainer.UnimplementedContainerServiceServer
// contains filtered or unexported fields
}
Server provides NeoFS API Container service.
func New ¶ added in v0.45.0
func New(s *ecdsa.PrivateKey, net netmapcore.State, fsChain FSChain, c Contract, nc NetmapContract, chainTime timecore.Provider) *Server
New provides protocontainer.ContainerServiceServer based on specified Contract.
All response messages are signed using specified signer and have current epoch in the meta header.
func (*Server) Delete ¶ added in v0.17.0
func (s *Server) Delete(ctx context.Context, req *protocontainer.DeleteRequest) (*protocontainer.DeleteResponse, error)
Delete forwards container removal request to the underlying Contract for further processing. If session token is attached, it's verified.
func (*Server) Get ¶ added in v0.17.0
func (s *Server) Get(ctx context.Context, req *protocontainer.GetRequest) (*protocontainer.GetResponse, error)
Get requests container from the underlying Contract and returns it in the response.
func (*Server) GetExtendedACL ¶ added in v0.17.0
func (s *Server) GetExtendedACL(ctx context.Context, req *protocontainer.GetExtendedACLRequest) (*protocontainer.GetExtendedACLResponse, error)
GetExtendedACL read eACL of the requested container from the underlying Contract and returns the result in the response.
func (*Server) List ¶ added in v0.17.0
func (s *Server) List(ctx context.Context, req *protocontainer.ListRequest) (*protocontainer.ListResponse, error)
List lists user containers from the underlying Contract and returns their IDs in the response.
func (*Server) Put ¶ added in v0.17.0
func (s *Server) Put(ctx context.Context, req *protocontainer.PutRequest) (*protocontainer.PutResponse, error)
Put forwards container creation request to the underlying Contract for further processing. If session token is attached, it's verified. Returns ID to check request status in the response.
func (*Server) RemoveAttribute ¶ added in v0.51.0
func (s *Server) RemoveAttribute(ctx context.Context, req *protocontainer.RemoveAttributeRequest) (*protocontainer.RemoveAttributeResponse, error)
RemoveAttribute forwards attribute removal request to the underlying Contract for further processing. If session token is attached, it's verified.
func (*Server) ResetSessionTokenCheckCache ¶ added in v0.50.0
func (s *Server) ResetSessionTokenCheckCache()
ResetSessionTokenCheckCache resets cache of session token check results.
func (*Server) SetAttribute ¶ added in v0.51.0
func (s *Server) SetAttribute(ctx context.Context, req *protocontainer.SetAttributeRequest) (*protocontainer.SetAttributeResponse, error)
SetAttribute forwards attribute setting request to the underlying Contract for further processing. If session token is attached, it's verified.
func (*Server) SetExtendedACL ¶ added in v0.17.0
func (s *Server) SetExtendedACL(ctx context.Context, req *protocontainer.SetExtendedACLRequest) (*protocontainer.SetExtendedACLResponse, error)
SetExtendedACL forwards eACL setting request to the underlying Contract for further processing. If session token is attached, it's verified.