Documentation
¶
Index ¶
- Variables
- type ChunkWriter
- type ClientConstructor
- type ForwardRequestFunc
- type GetECRequestTransport
- type GetTransportFunc
- type HeadPrm
- func (p *HeadPrm) SetCommonParameters(common *util.CommonPrm)
- func (p *HeadPrm) SetForwardRequestFunc(f ForwardRequestFunc)
- func (p *HeadPrm) SetHeaderWriter(w internal.HeaderWriter)
- func (p *HeadPrm) SetSubmitHeadResponseFunc(f SubmitHeadResponseFunc)
- func (p *HeadPrm) SetTransportFunc(f HeadTransportFunc)
- func (p *HeadPrm) WithAddress(addr oid.Address)
- func (p *HeadPrm) WithBuffer(buffer []byte, submitLenFn func(int))
- func (p *HeadPrm) WithCachedSignerKey(signerKey *ecdsa.PrivateKey)
- func (p *HeadPrm) WithContainer(cnr container.Container)
- func (p *HeadPrm) WithRawFlag(raw bool)
- type HeadTransportFunc
- type HeaderValidator
- type NeoFSNetwork
- type ObjectWriter
- type Option
- type Prm
- func (p Prm) GetBuffer() ([]byte, SubmitStreamFunc)
- func (p *Prm) MarkPayloadOnly()
- func (p Prm) PayloadOnly() bool
- func (p Prm) Range() *object.Range
- func (p *Prm) RequireEACLRecheck()
- func (p *Prm) SetCommonParameters(common *util.CommonPrm)
- func (p *Prm) SetForwardRequestFunc(f ForwardRequestFunc)
- func (p *Prm) SetObjectWriter(w ObjectWriter)
- func (p *Prm) SetRange(rng *object.Range)
- func (p *Prm) SetTransportFunc(f GetTransportFunc)
- func (p *Prm) WithAddress(addr oid.Address)
- func (p *Prm) WithBuffer(buffer []byte, submitStreamFn SubmitStreamFunc)
- func (p *Prm) WithCachedSignerKey(signerKey *ecdsa.PrivateKey)
- func (p *Prm) WithContainer(cnr container.Container)
- func (p *Prm) WithECTransport(transport GetECRequestTransport)
- func (p *Prm) WithRawFlag(raw bool)
- type RangePrm
- func (p *RangePrm) SetChunkWriter(w ChunkWriter)
- func (p *RangePrm) SetCommonParameters(common *util.CommonPrm)
- func (p *RangePrm) SetForwardRequestFunc(f ForwardRequestFunc)
- func (p *RangePrm) SetRange(rng *object.Range)
- func (p *RangePrm) SetTransportFunc(f RangeTransportFunc)
- func (p *RangePrm) WithAddress(addr oid.Address)
- func (p *RangePrm) WithBuffer(buffer []byte, submitStreamFn SubmitDataStreamFunc)
- func (p *RangePrm) WithCachedSignerKey(signerKey *ecdsa.PrivateKey)
- func (p *RangePrm) WithContainer(cnr container.Container)
- func (p *RangePrm) WithRawFlag(raw bool)
- type RangeTransportFunc
- type RequestForwarder
- type Service
- type SimpleObjectWriter
- type SubmitDataStreamFunc
- type SubmitHeadResponseFunc
- type SubmitStreamFunc
Constants ¶
This section is empty.
Variables ¶
var ErrAborted = errors.New("aborted")
ErrAborted is returned to abort something.
var ErrLinker = errors.New("linker")
ErrLinker is returned when object of LINK type is received.
var ErrResponded = errors.New("responded")
ErrResponded is returned when server successfully finished processing of some request.
var ErrResponseStreamFailure = errors.New("stream failure")
ErrResponseStreamFailure is returned when response stream no longer works.
ErrUnavailableNode is returned when node is unavailable.
Functions ¶
This section is empty.
Types ¶
type ChunkWriter ¶ added in v0.13.0
ChunkWriter is an interface of target component to write payload chunk.
type ClientConstructor ¶ added in v0.18.0
type ClientConstructor interface {
Get(context.Context, netmap.NodeInfo) (clientcore.MultiAddressClient, error)
}
type ForwardRequestFunc ¶ added in v0.54.0
type ForwardRequestFunc func(ctx context.Context, node clientcore.MultiAddressClient) error
ForwardRequestFunc forwards original request to remote node through passed connection and responds to the client.
If response stream fails, ErrResponseStreamFailure is returned.
If node is currently unavailable, ErrUnavailableNode is returned.
type GetECRequestTransport ¶ added in v0.54.0
type GetECRequestTransport interface {
// CopyRemoteECPartParentHeaderAndPayload requests originally requested object's
// EC part identified by partInfo from remote storage node using conn to it. If
// succeeded, CopyRemoteECPartParentHeaderAndPayload sends parent header and
// part payload to the client, and returns:
// - flag whether parent header was copied or not;
// - payload length of original requested object in bytes;
// - payload length of part object in bytes;
// - number of part's payload bytes copied.
//
// If response stream fails, [ErrResponseStreamFailure] is returned.
//
// If the node responds with split object info,
// CopyRemoteECPartParentHeaderAndPayload converts it to
// [*object.SplitInfoError] and returns.
//
// If the node responds with any failure status other than 'not found', the
// response is copied to the client and [ErrResponded] is returned.
//
// If the node responds with object of LINK type, [ErrLinker] is returned.
//
// Otherwise, no error is returned. Copying can be incomplete in this case.
//
// CopyRemoteECPartParentHeaderAndPayload is never called concurrently.
CopyRemoteECPartParentHeaderAndPayload(ctx context.Context, conn clientcore.MultiAddressClient, partInfo iec.PartInfo) (bool, uint64, uint64, uint64, error)
// CopyLocalECPartParentHeaderAndPayload works like CopyRemoteECPartParentHeaderAndPayload but locally.
CopyLocalECPartParentHeaderAndPayload(ctx context.Context, storage *engine.StorageEngine, partInfo iec.PartInfo) (bool, uint64, uint64, uint64, error)
// CopyRemoteECPartRange requests specified payload range of originally
// requested object's EC part identified by partInfo pair from remote storage
// node using conn to it. If succeeded, CopyRemoteECPartRange sends with payload
// range to the client, and returns number of bytes copied.
//
// If response stream fails, [ErrResponseStreamFailure] is returned.
//
// If the node responds with any failure status other than 'not found', the
// response is copied to the client and [ErrResponded] is returned.
//
// Otherwise, no error is returned. Copying can be incomplete in this case.
//
// If controlCh is passed, CopyRemoteECPartRange blocks copying data until signal
// from it. On true, CopyRemoteECPartRange returns [ErrAborted] instantly
// without copying. Otherwise, i.e. if on false or close, copying starts.
//
// CopyRemoteECPartRange can be called concurrently for different partInfo, but
// never for the same one.
CopyRemoteECPartRange(ctx context.Context, conn clientcore.MultiAddressClient, partInfo iec.PartInfo, off, ln uint64, controlCh <-chan bool) (uint64, error)
// CopyLocalECPartRange works like CopyRemoteECPartRange but locally.
CopyLocalECPartRange(ctx context.Context, storage *engine.StorageEngine, partInfo iec.PartInfo, off, ln uint64, ch <-chan bool) (uint64, error)
}
GetECRequestTransport is used to serve GET requests for EC objects.
type GetTransportFunc ¶ added in v0.54.0
type GetTransportFunc func(context.Context, clientcore.MultiAddressClient) error
GetTransportFunc continues to serve current GET request from remote node through passed connection.
type HeadPrm ¶ added in v0.13.0
type HeadPrm struct {
// contains filtered or unexported fields
}
HeadPrm groups parameters of Head service call.
func (*HeadPrm) SetCommonParameters ¶ added in v0.13.0
SetCommonParameters sets common parameters of the operation.
func (*HeadPrm) SetForwardRequestFunc ¶ added in v0.54.0
func (p *HeadPrm) SetForwardRequestFunc(f ForwardRequestFunc)
SetForwardRequestFunc specifies transport implementation for request forwarding to container nodes by non-container server.
func (*HeadPrm) SetHeaderWriter ¶ added in v0.13.0
func (p *HeadPrm) SetHeaderWriter(w internal.HeaderWriter)
SetHeaderWriter sets target component to write the object header.
func (*HeadPrm) SetSubmitHeadResponseFunc ¶ added in v0.53.0
func (p *HeadPrm) SetSubmitHeadResponseFunc(f SubmitHeadResponseFunc)
SetSubmitHeadResponseFunc specifies handler to pass results of [HeadPrm.SetRequestForwarder] argument into.
func (*HeadPrm) SetTransportFunc ¶ added in v0.54.0
func (p *HeadPrm) SetTransportFunc(f HeadTransportFunc)
SetTransportFunc specifies request transport callback to use for receiving response from remote node by in-container server.
The f should return:
- response buffer and object header protobuf without an error on OK
- object.SplitInfoError on OK with corresponding body field
- apistatus.ErrObjectNotFound on 404 status
- (respBuf, iprotobuf.BuffersSlice{}, nil) on other API statuses
- any transport error
Once results successfully received, it is forwarded untouched to handler which must be set via HeadPrm.SetSubmitHeadResponseFunc.
The f is never called concurrently.
func (*HeadPrm) WithAddress ¶ added in v0.27.0
WithAddress sets object address to be read.
func (*HeadPrm) WithBuffer ¶ added in v0.52.0
WithBuffer specifies a buffer into which header of the requested object is optionally written. The submitLenFn parameter is a callback for number of bytes written. If buffer is unused, submitLenFn is not called.
func (*HeadPrm) WithCachedSignerKey ¶ added in v0.36.0
func (p *HeadPrm) WithCachedSignerKey(signerKey *ecdsa.PrivateKey)
WithCachedSignerKey sets optional key for all further requests.
func (*HeadPrm) WithContainer ¶ added in v0.53.0
WithContainer sets container data to be used.
func (*HeadPrm) WithRawFlag ¶ added in v0.27.0
func (p *HeadPrm) WithRawFlag(raw bool)
WithRawFlag sets flag of raw reading.
type HeadTransportFunc ¶ added in v0.54.0
type HeadTransportFunc func(context.Context, clientcore.MultiAddressClient) (mem.BufferSlice, iprotobuf.BuffersSlice, error)
HeadTransportFunc sends currently served HEAD request to remote node through passed connection and returns buffered response with requested object's header binary in it.
type HeaderValidator ¶ added in v0.53.0
HeaderValidator is an optional interface for validating object headers before suppressing them from the response.
type NeoFSNetwork ¶ added in v0.43.0
type NeoFSNetwork interface {
// GetNodesForObject returns descriptors of storage nodes matching storage
// policy of the referenced object for now. Nodes are identified by their public
// keys and can be repeated in different lists. First len(repRules) lists relate
// to replication, the rest len(ecRules) - to EC.
//
// repRules specifies replication rules: the number (N) of primary object
// holders for each list (L) so:
// - size of each L >= N;
// - first N nodes of each L are primary data holders while others (if any)
// are backup.
//
// ecRules specifies erasure coding rules for all objects in the container: each
// object is split into [iec.Rule.DataPartNum] data and [iec.Rule.ParityPartNum]
// parity parts. Each i-th part most expected to be located on SN described by
// i-th list element. In general, list len is a multiple of CBF, and the part is
// expected on N with index M*i, M in [0,CBF). Then part is expected on SN
// for i+1-th part and so on.
//
// GetNodesForObject does not change resulting slices and their elements.
//
// Returns [apistatus.ContainerNotFound] if requested container is missing in
// the network.
GetNodesForObject(oid.Address) (nodeRules [][]netmap.NodeInfo, repRules []uint, ecRules []iec.Rule, err error)
// IsLocalNodePublicKey checks whether given binary-encoded public key is
// assigned in the network map to a local storage node providing [Service].
IsLocalNodePublicKey([]byte) bool
}
NeoFSNetwork provides access to the NeoFS network to get information necessary for the Service to work.
type ObjectWriter ¶ added in v0.13.0
type ObjectWriter interface {
internal.HeaderWriter
ChunkWriter
}
ObjectWriter is an interface of target component to write object.
type Option ¶
type Option func(*cfg)
Option is a Service's constructor option.
func WithClientConstructor ¶ added in v0.18.0
func WithClientConstructor(v ClientConstructor) Option
WithClientConstructor returns option to set constructor of remote node clients.
func WithKeyStorage ¶ added in v0.26.1
func WithKeyStorage(store *util.KeyStorage) Option
WithKeyStorage returns option to set private key storage for session tokens and node key.
func WithLocalStorageEngine ¶ added in v0.13.0
func WithLocalStorageEngine(e *engine.StorageEngine) Option
WithLocalStorageEngine returns option to set local storage instance.
func WithLogger ¶ added in v0.13.0
WithLogger returns option to specify Get service's logger.
func WithNNSResolver ¶ added in v0.51.0
func WithNNSResolver(resolver sessionv2.NNSResolver) Option
WithNNSResolver returns option to set NNS resolver for checking session token subjects.
type Prm ¶
type Prm struct {
// contains filtered or unexported fields
}
Prm groups parameters of Get service call.
func (Prm) GetBuffer ¶ added in v0.52.0
func (p Prm) GetBuffer() ([]byte, SubmitStreamFunc)
GetBuffer returns buffer settings set using Prm.WithBuffer.
func (*Prm) MarkPayloadOnly ¶ added in v0.53.0
func (p *Prm) MarkPayloadOnly()
MarkPayloadOnly requests payload without an object header.
func (Prm) PayloadOnly ¶ added in v0.53.0
PayloadOnly reports whether only payload was requested.
func (*Prm) RequireEACLRecheck ¶ added in v0.54.0
func (p *Prm) RequireEACLRecheck()
RequireEACLRecheck marks request as requiring object header on internal full-GETs so eACL can be rechecked against header fields when needed.
func (*Prm) SetCommonParameters ¶ added in v0.13.0
SetCommonParameters sets common parameters of the operation.
func (*Prm) SetForwardRequestFunc ¶ added in v0.54.0
func (p *Prm) SetForwardRequestFunc(f ForwardRequestFunc)
SetForwardRequestFunc specifies transport implementation for request forwarding to container nodes by non-container server.
func (*Prm) SetObjectWriter ¶ added in v0.13.0
func (p *Prm) SetObjectWriter(w ObjectWriter)
SetObjectWriter sets target component to write the object.
func (*Prm) SetTransportFunc ¶ added in v0.54.0
func (p *Prm) SetTransportFunc(f GetTransportFunc)
SetTransportFunc specifies request transport callback to use for streaming responses from remote node by in-container server.
The f should return:
- nil on completed object transmission
- apistatus.ErrObjectNotFound on 404 status
- nil on other API statuses
- any other transport/protocol error otherwise
The f is never called concurrently.
func (*Prm) WithAddress ¶
WithAddress sets object address to be read.
func (*Prm) WithBuffer ¶ added in v0.52.0
func (p *Prm) WithBuffer(buffer []byte, submitStreamFn SubmitStreamFunc)
WithBuffer specifies a buffer into which header of the requested object is optionally written. The submitStreamFn parameter is a callback for number of bytes written and stream of remaining bytes. If buffer is unused, submitStreamFn is not called. The stream must be finally closed by the caller.
func (*Prm) WithCachedSignerKey ¶ added in v0.36.0
func (p *Prm) WithCachedSignerKey(signerKey *ecdsa.PrivateKey)
WithCachedSignerKey sets optional key for all further requests.
func (*Prm) WithContainer ¶ added in v0.53.0
WithContainer sets container data to be used.
func (*Prm) WithECTransport ¶ added in v0.54.0
func (p *Prm) WithECTransport(transport GetECRequestTransport)
WithECTransport specifies transport layer to for EC handling.
func (*Prm) WithRawFlag ¶ added in v0.27.0
func (p *Prm) WithRawFlag(raw bool)
WithRawFlag sets flag of raw reading.
type RangePrm ¶ added in v0.13.0
type RangePrm struct {
// contains filtered or unexported fields
}
RangePrm groups parameters of GetRange service call.
func (*RangePrm) SetChunkWriter ¶ added in v0.13.0
func (p *RangePrm) SetChunkWriter(w ChunkWriter)
SetChunkWriter sets target component to write the object payload range.
func (*RangePrm) SetCommonParameters ¶ added in v0.13.0
SetCommonParameters sets common parameters of the operation.
func (*RangePrm) SetForwardRequestFunc ¶ added in v0.54.0
func (p *RangePrm) SetForwardRequestFunc(f ForwardRequestFunc)
SetForwardRequestFunc specifies transport implementation for request forwarding to container nodes by non-container server.
func (*RangePrm) SetTransportFunc ¶ added in v0.54.0
func (p *RangePrm) SetTransportFunc(f RangeTransportFunc)
SetTransportFunc specifies request transport callback to use for streaming responses from remote node by in-container server.
The f should return:
- nil on completed object transmission
- object.SplitInfoError on OK with corresponding body field
- apistatus.ErrObjectNotFound on 404 status
- nil on other API statuses
- any other transport/protocol error otherwise
func (*RangePrm) WithAddress ¶ added in v0.27.0
WithAddress sets object address to be read.
func (*RangePrm) WithBuffer ¶ added in v0.53.0
func (p *RangePrm) WithBuffer(buffer []byte, submitStreamFn SubmitDataStreamFunc)
WithBuffer specifies a buffer to use for header reading and a callback for payload range stream. If passed, the stream must be finally closed by the caller.
func (*RangePrm) WithCachedSignerKey ¶ added in v0.36.0
func (p *RangePrm) WithCachedSignerKey(signerKey *ecdsa.PrivateKey)
WithCachedSignerKey sets optional key for all further requests.
func (*RangePrm) WithContainer ¶ added in v0.53.0
WithContainer sets container data to be used.
func (*RangePrm) WithRawFlag ¶ added in v0.27.0
func (p *RangePrm) WithRawFlag(raw bool)
WithRawFlag sets flag of raw reading.
type RangeTransportFunc ¶ added in v0.54.0
type RangeTransportFunc func(context.Context, clientcore.MultiAddressClient) error
RangeTransportFunc continues to serve current RANGE request from remote node through passed connection.
type RequestForwarder ¶ added in v0.19.0
type RequestForwarder func(context.Context, clientcore.MultiAddressClient) (*object.Object, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service utility serving requests of Object.Get service.
func New ¶ added in v0.13.0
func New(neoFSNet NeoFSNetwork, opts ...Option) *Service
New creates, initializes and returns utility serving Object.Get service requests.
func (*Service) Get ¶
Get serves a request to get an object by address, and returns Streamer instance.
type SimpleObjectWriter ¶ added in v0.13.0
type SimpleObjectWriter struct {
// contains filtered or unexported fields
}
func NewSimpleObjectWriter ¶ added in v0.13.0
func NewSimpleObjectWriter() *SimpleObjectWriter
func (*SimpleObjectWriter) Object ¶ added in v0.13.0
func (s *SimpleObjectWriter) Object() *object.Object
func (*SimpleObjectWriter) WriteChunk ¶ added in v0.13.0
func (s *SimpleObjectWriter) WriteChunk(p []byte) error
func (*SimpleObjectWriter) WriteHeader ¶ added in v0.13.0
func (s *SimpleObjectWriter) WriteHeader(obj *object.Object) error
type SubmitDataStreamFunc ¶ added in v0.53.0
type SubmitDataStreamFunc = func(io.ReadCloser)
SubmitDataStreamFunc is a handler of data stream.
type SubmitHeadResponseFunc ¶ added in v0.53.0
type SubmitHeadResponseFunc = func(mem.BufferSlice, iprotobuf.BuffersSlice)
SubmitHeadResponseFunc accepts result of [ForwardHeadRequestFunc].
type SubmitStreamFunc ¶ added in v0.52.0
type SubmitStreamFunc = func(int, io.ReadCloser)
SubmitStreamFunc is a callback for partially read object stream.