Documentation
¶
Index ¶
- type ACLInfoExtractor
- type ClientConstructor
- type FSChain
- type Handlers
- type MetricCollector
- type Server
- func (s *Server) Delete(ctx context.Context, req *protoobject.DeleteRequest) (*protoobject.DeleteResponse, error)
- func (s *Server) Get(req *protoobject.GetRequest, gStream protoobject.ObjectService_GetServer) error
- func (s *Server) GetRange(_ *protoobject.GetRangeRequest, _ protoobject.ObjectService_GetRangeServer) error
- func (s *Server) GetRangeHash(_ context.Context, _ *protoobject.GetRangeHashRequest) (*protoobject.GetRangeHashResponse, error)
- func (s *Server) Head(context.Context, *protoobject.HeadRequest) (*protoobject.HeadResponse, error)
- func (s *Server) HeadBuffered(ctx context.Context, req *protoobject.HeadRequest) any
- func (s *Server) ProcessSearch(ctx context.Context, req *protoobject.SearchV2Request, localOnly bool, ...) ([]client.SearchResultItem, []byte, error)
- func (s *Server) Put(gStream protoobject.ObjectService_PutServer) error
- func (s *Server) Replicate(ctx context.Context, req *protoobject.ReplicateRequest) (*protoobject.ReplicateResponse, error)
- func (s *Server) ReplicateV2(stream protoobject.ObjectService_ReplicateV2Server) error
- func (s *Server) Search(_ *protoobject.SearchRequest, _ protoobject.ObjectService_SearchServer) error
- func (s *Server) SearchV2(context.Context, *protoobject.SearchV2Request) (*protoobject.SearchV2Response, error)
- func (s *Server) SearchV2Buffered(ctx context.Context, req *protoobject.SearchV2Request) any
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACLInfoExtractor ¶ added in v0.45.0
type ACLInfoExtractor interface {
PutRequestToInfo(context.Context, *protoobject.PutRequest, *protoobject.PutRequest_Body_Init, cid.ID, acl.Op, common.RequestTokens) (aclsvc.RequestInfo, user.ID, error)
DeleteRequestToInfo(context.Context, *protoobject.DeleteRequest, cid.ID, common.RequestTokens) (aclsvc.RequestInfo, error)
HeadRequestToInfo(context.Context, *protoobject.HeadRequest, cid.ID, common.RequestTokens) (aclsvc.RequestInfo, error)
GetRequestToInfo(context.Context, *protoobject.GetRequest, cid.ID, common.RequestTokens) (aclsvc.RequestInfo, error)
SearchV2RequestToInfo(context.Context, *protoobject.SearchV2Request, cid.ID, common.RequestTokens) (aclsvc.RequestInfo, error)
VerifySessionTokenMessage(*protosession.SessionTokenV2, sessionv2.Verb, cid.ID) (sessionv2.Token, error)
VerifySessionV1TokenMessage(*protosession.SessionToken, session.ObjectVerb, cid.ID, oid.ID) (session.Object, error)
VerifyBearerTokenMessage(*protoacl.BearerToken) (bearer.Token, error)
}
ACLInfoExtractor is the interface that allows to fetch data required for ACL checks from various types of grpc requests.
type ClientConstructor ¶ added in v0.53.0
type ClientConstructor interface {
Get(context.Context, netmap.NodeInfo) (clientcore.MultiAddressClient, error)
}
ClientConstructor returns a client for given node.
type FSChain ¶ added in v0.45.0
type FSChain interface {
containercore.Source
netmapcore.StateDetailed
icrypto.N3ScriptRunner
// ForEachContainerNodePublicKey iterates over all nodes matching the
// referenced container's storage policy at the current NeoFS epoch and passes
// their public keys into f. Iteration stops without an error when f returns
// false.
//
// Returns [apistatus.ErrContainerNotFound] if referenced container was not
// found.
ForEachContainerNodePublicKey(cid.ID, func(pubKey []byte) bool) error
// ForEachContainerNodePublicKeyInLastTwoEpochs iterates over all nodes matching
// the referenced container's storage policy at the current and the previous
// NeoFS epochs, and passes their public keys into f. IterateContainerNodeKeys
// breaks without an error when f returns false. Keys may be repeated.
//
// Returns [apistatus.ErrContainerNotFound] if referenced container was not
// found.
ForEachContainerNodePublicKeyInLastTwoEpochs(cid.ID, func(pubKey []byte) bool) error
// SelectContainerNodes applies referenced container's storage policy to the
// current network map and returns matching nodes along with the applied rules.
//
// Returns [apistatus.ErrContainerNotFound] if referenced container was not
// found.
SelectContainerNodes(cnr cid.ID) ([][]netmap.NodeInfo, []uint, []iec.Rule, error)
// IsOwnPublicKey checks whether given pubKey assigned to Node in the NeoFS
// network map.
IsOwnPublicKey(pubKey []byte) bool
// LocalNodeUnderMaintenance checks whether local node is under maintenance
// according to the network map from FSChain.
LocalNodeUnderMaintenance() bool
}
FSChain provides access to the FS chain required to serve NeoFS API Object service.
type Handlers ¶ added in v0.45.0
type Handlers interface {
Get(context.Context, getsvc.Prm) error
Put(context.Context) (*putsvc.Streamer, error)
Head(context.Context, getsvc.HeadPrm) error
Delete(context.Context, deletesvc.Prm) error
}
Handlers represents storage node's internal handler Object service op payloads.
type MetricCollector ¶ added in v0.17.0
type MetricCollector interface {
// HandleOpExecResult handles measured execution results of the given op.
HandleOpExecResult(_ stat.Method, success bool, _ time.Duration)
AddPutPayload(int)
AddGetPayload(int)
}
MetricCollector tracks exec statistics for the following ops:
type Server ¶ added in v0.46.0
type Server struct {
// contains filtered or unexported fields
}
Server represents Object Service server that provides object manipulation operations including Get, Put, Head, Range, Delete, Search, and Replicate. The server enforces access control, verifies requests, and handles data storage and retrieval operations.
func New ¶ added in v0.45.0
func New(hs Handlers, fsChain FSChain, st Storage, metaSvc *metasvc.Meta, signer ecdsa.PrivateKey, m MetricCollector, ac aclsvc.ACLChecker, rp ACLInfoExtractor, cs ClientConstructor, log *zap.Logger) *Server
New provides protoobject.ObjectServiceServer for the given parameters.
func (*Server) Delete ¶ added in v0.46.0
func (s *Server) Delete(ctx context.Context, req *protoobject.DeleteRequest) (*protoobject.DeleteResponse, error)
func (*Server) Get ¶ added in v0.46.0
func (s *Server) Get(req *protoobject.GetRequest, gStream protoobject.ObjectService_GetServer) error
func (*Server) GetRange ¶ added in v0.46.0
func (s *Server) GetRange(_ *protoobject.GetRangeRequest, _ protoobject.ObjectService_GetRangeServer) error
func (*Server) GetRangeHash ¶ added in v0.46.0
func (s *Server) GetRangeHash(_ context.Context, _ *protoobject.GetRangeHashRequest) (*protoobject.GetRangeHashResponse, error)
GetRangeHash is deprecated and no longer supported by the node.
func (*Server) Head ¶ added in v0.46.0
func (s *Server) Head(context.Context, *protoobject.HeadRequest) (*protoobject.HeadResponse, error)
Head implements protoobject.ObjectServiceServer so that generated functions don't panic. It must never be called, Server.HeadBuffered must be used instead.
func (*Server) HeadBuffered ¶ added in v0.52.0
func (s *Server) HeadBuffered(ctx context.Context, req *protoobject.HeadRequest) any
HeadBuffered serves req and returns response as either *protoobject.HeadResponse, mem.BufferSlice or mem.Buffer. All buffers must be freed eventually.
func (*Server) ProcessSearch ¶ added in v0.46.0
func (s *Server) ProcessSearch(ctx context.Context, req *protoobject.SearchV2Request, localOnly bool, forwardedResponseToError bool, cID cid.ID) ([]client.SearchResultItem, []byte, error)
func (*Server) Put ¶ added in v0.46.0
func (s *Server) Put(gStream protoobject.ObjectService_PutServer) error
func (*Server) Replicate ¶ added in v0.46.0
func (s *Server) Replicate(ctx context.Context, req *protoobject.ReplicateRequest) (*protoobject.ReplicateResponse, error)
Replicate serves neo.fs.v2.object.ObjectService/Replicate RPC.
func (*Server) ReplicateV2 ¶ added in v0.57.0
func (s *Server) ReplicateV2(stream protoobject.ObjectService_ReplicateV2Server) error
ReplicateV2 serves neo.fs.v2.object.ObjectService/ReplicateV2 RPC.
func (*Server) Search ¶ added in v0.46.0
func (s *Server) Search(_ *protoobject.SearchRequest, _ protoobject.ObjectService_SearchServer) error
func (*Server) SearchV2 ¶ added in v0.46.0
func (s *Server) SearchV2(context.Context, *protoobject.SearchV2Request) (*protoobject.SearchV2Response, error)
SearchV2 implements protoobject.ObjectServiceServer so that generated functions don't panic. It must never be called, Server.SearchV2Buffered must be used instead.
func (*Server) SearchV2Buffered ¶ added in v0.54.0
func (s *Server) SearchV2Buffered(ctx context.Context, req *protoobject.SearchV2Request) any
SearchV2Buffered serves req and returns response as either *protoobject.SearchV2Response, mem.BufferSlice or mem.Buffer. All buffers must be freed eventually.
type Storage ¶ added in v0.45.0
type Storage interface {
// VerifyObjectHeader checks whether given object header has correct format.
//
// Requires payload checksum to be of [checksum.SHA256] type.
VerifyObjectHeader(context.Context, object.Object) error
// VerifyObjectPayload makes type-based check of object payload. Called only for
// objects of type different from [object.TypeRegular].
VerifyObjectPayload(context.Context, object.Object) error
// StoreObjectLocally saves given in-memory object in the local storage.
//
// Returns [apistatus.Busy] error if storage is currently overloaded.
StoreObjectLocally(ctx context.Context, obj object.Object) error
// InitLocalObjectWrite initializes object write to the local storage, writes
// provided header and returns the stream to write payload. Once payload is
// written, stream is closed. On success, object becomes saved.
//
// Resulting function allows to abort operation in case of problems on caller
// side. It is not called multiple times, after [io.Closer.Close] or failed
// [io.Writer.Write].
//
// Returns [ierrors.ErrObjectExists] if object already exists in the storage.
InitLocalObjectWrite(ctx context.Context, hdr object.Object, hdrLen uint64, hdrW io.WriterTo) (io.WriteCloser, func(), error)
// SearchObjects selects up to count container's objects from the given
// container matching the specified filters.
SearchObjects(_ context.Context, _ cid.ID, _ []objectcore.SearchFilter, attrs []string, cursor *objectcore.SearchCursor, count uint16) ([]client.SearchResultItem, []byte, error)
// contains filtered or unexported methods
}
Storage groups ops of the node's storage required to serve NeoFS API Object service.