getsvc

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkWriter added in v0.13.0

type ChunkWriter interface {
	WriteChunk([]byte) error
}

ChunkWriter is an interface of target component to write payload chunk.

type ClientConstructor added in v0.18.0

type ClientConstructor interface {
	Get(context.Context, netmapsdk.NodeInfo) (client.MultiAddressClient, error)
}

type ForwardGetRequestFunc added in v0.53.0

type ForwardGetRequestFunc = func(context.Context, coreclient.MultiAddressClient) error

ForwardGetRequestFunc continues to serve current GET request from remote node through passed connection.

type ForwardHeadRequestFunc added in v0.53.0

ForwardHeadRequestFunc sends currently served HEAD request to remote node through passed connection and returns buffered response with requested object's header binary in it.

type ForwardRangeRequestFunc added in v0.53.0

type ForwardRangeRequestFunc = func(context.Context, coreclient.MultiAddressClient) error

ForwardRangeRequestFunc continues to serve current RANGE 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

func (p *HeadPrm) SetCommonParameters(common *util.CommonPrm)

SetCommonParameters sets common parameters of the operation.

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) SetRequestForwarder added in v0.19.0

func (p *HeadPrm) SetRequestForwarder(f ForwardHeadRequestFunc)

SetRequestForwarder specifies request transport callback to use for receiving response from remote node.

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.

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) WithAddress added in v0.27.0

func (p *HeadPrm) WithAddress(addr oid.Address)

WithAddress sets object address to be read.

func (*HeadPrm) WithBuffer added in v0.52.0

func (p *HeadPrm) WithBuffer(buffer []byte, submitLenFn func(int))

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

func (p *HeadPrm) WithContainer(cnr container.Container)

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 HeaderValidator added in v0.53.0

type HeaderValidator interface {
	ValidateHeader(*object.Object) error
}

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 [][]netmapsdk.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

func WithLogger(l *zap.Logger) Option

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

func (p Prm) PayloadOnly() bool

PayloadOnly reports whether only payload was requested.

func (Prm) Range added in v0.53.0

func (p Prm) Range() *object.Range

Range returns payload range settings.

func (*Prm) SetCommonParameters added in v0.13.0

func (p *Prm) SetCommonParameters(common *util.CommonPrm)

SetCommonParameters sets common parameters of the operation.

func (*Prm) SetObjectWriter added in v0.13.0

func (p *Prm) SetObjectWriter(w ObjectWriter)

SetObjectWriter sets target component to write the object.

func (*Prm) SetRange added in v0.53.0

func (p *Prm) SetRange(rng *object.Range)

SetRange sets range of the requested payload data.

func (*Prm) SetRequestForwarder added in v0.19.0

func (p *Prm) SetRequestForwarder(f ForwardGetRequestFunc)

SetRequestForwarder specifies request transport callback to use for streaming responses from remote node.

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

func (*Prm) WithAddress

func (p *Prm) WithAddress(addr oid.Address)

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

func (p *Prm) WithContainer(cnr container.Container)

WithContainer sets container data to be used.

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

func (p *RangePrm) SetCommonParameters(common *util.CommonPrm)

SetCommonParameters sets common parameters of the operation.

func (*RangePrm) SetRange added in v0.13.0

func (p *RangePrm) SetRange(rng *object.Range)

SetRange sets range of the requested payload data.

func (*RangePrm) SetRequestForwarder added in v0.19.0

func (p *RangePrm) SetRequestForwarder(f ForwardRangeRequestFunc)

SetRequestForwarder specifies request transport callback to use for streaming responses from remote node.

The f should return:

func (*RangePrm) WithAddress added in v0.27.0

func (p *RangePrm) WithAddress(addr oid.Address)

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

func (p *RangePrm) WithContainer(cnr container.Container)

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 RequestForwarder added in v0.19.0

type RequestForwarder func(context.Context, coreclient.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

func (s *Service) Get(ctx context.Context, prm Prm) error

Get serves a request to get an object by address, and returns Streamer instance.

func (*Service) GetRange added in v0.13.0

func (s *Service) GetRange(ctx context.Context, prm RangePrm) error

GetRange serves a request to get an object by address, and returns Streamer instance.

func (*Service) Head added in v0.13.0

func (s *Service) Head(ctx context.Context, prm HeadPrm) error

Head reads object header from container.

Returns ErrNotFound if the header was not received for the call. Returns SplitInfoError if object is virtual and raw flag is set.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL