putsvc

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrExceedingMaxSize is returned when payload size is greater than the limit.
	ErrExceedingMaxSize = errors.New("payload size is greater than the limit")
	// ErrWrongPayloadSize is returned when chunk payload size is greater than the length declared in header.
	ErrWrongPayloadSize = errors.New("wrong payload size")
)

Functions

This section is empty.

Types

type ClientConstructor added in v0.18.0

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

type ContainerNodes added in v0.44.0

type ContainerNodes interface {
	// Unsorted returns unsorted descriptor set corresponding to the storage nodes
	// matching storage policy of the container. Nodes are identified by their
	// public keys and can be repeated in different sets.
	//
	// Unsorted callers do not change resulting slices and their elements.
	Unsorted() [][]netmapsdk.NodeInfo
	// SortForObject sorts container nodes for the referenced object's storage.
	//
	// SortForObject callers do not change resulting slices and their elements.
	SortForObject(oid.ID) ([][]netmapsdk.NodeInfo, error)
	// PrimaryCounts returns number (N) of primary object holders for each sorted
	// list (L) so:
	//  - size of each L >= N;
	//  - first N nodes of each L are primary data holders while others (if any)
	//    are backup.
	PrimaryCounts() []uint
}

ContainerNodes provides access to storage nodes matching storage policy of the particular container.

type MaxSizeSource

type MaxSizeSource interface {
	// MaxObjectSize returns maximum payload size
	// of physically stored object in system.
	//
	// Must return 0 if value can not be obtained.
	MaxObjectSize() uint64
}

type NeoFSNetwork added in v0.44.0

type NeoFSNetwork interface {
	// GetContainerNodes selects storage nodes matching storage policy of the
	// referenced container for now and provides [ContainerNodes] interface.
	//
	// Returns [apistatus.ContainerNotFound] if requested container is missing in
	// the network.
	GetContainerNodes(cid.ID) (ContainerNodes, 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
	// GetEpochBlock returns FS chain height when given NeoFS epoch was ticked.
	GetEpochBlock(epoch uint64) (uint32, error)
}

NeoFSNetwork provides access to the NeoFS network to get information necessary for the Service to work.

type ObjectStorage added in v0.28.0

type ObjectStorage interface {
	// Put must save passed object
	// and return any appeared error.
	//
	// Optional objBin parameter carries object encoded in a canonical NeoFS binary
	// format where first hdrLen bytes represent an object header.
	Put(obj *object.Object, objBin []byte, hdrLen int) error
	// Delete must delete passed objects
	// and return any appeared error.
	Delete(tombstone oid.Address, tombExpiration uint64, toDelete []oid.ID) error
	// Lock must lock passed objects
	// and return any appeared error.
	Lock(locker oid.Address, toLock []oid.ID) error
	// IsLocked must clarify object's lock status.
	IsLocked(oid.Address) (bool, error)
}

ObjectStorage is an object storage interface.

type Option

type Option func(*cfg)

func WithClientConstructor added in v0.18.0

func WithClientConstructor(v ClientConstructor) Option

func WithContainerClient added in v0.45.0

func WithContainerClient(v *chaincontainer.Client) Option

func WithContainerSource

func WithContainerSource(v container.Source) Option

func WithKeyStorage

func WithKeyStorage(v *objutil.KeyStorage) Option

func WithLogger added in v0.12.1

func WithLogger(l *zap.Logger) Option

func WithMaxSizeSource

func WithMaxSizeSource(v MaxSizeSource) Option

func WithNetworkMagic added in v0.44.0

func WithNetworkMagic(m uint32) Option

func WithNetworkMapSource

func WithNetworkMapSource(v netmap.Source) Option

func WithNetworkState

func WithNetworkState(v netmap.StateDetailed) Option

func WithObjectStorage added in v0.28.0

func WithObjectStorage(v ObjectStorage) Option

func WithSplitChainVerifier added in v0.41.0

func WithSplitChainVerifier(sv object.SplitVerifier) Option

func WithTombstoneVerifier added in v0.41.0

func WithTombstoneVerifier(tv object.TombVerifier) Option

func WithWorkerPools added in v0.25.0

func WithWorkerPools(remote, local util.WorkerPool) Option

type PutChunkPrm

type PutChunkPrm struct {
	// contains filtered or unexported fields
}

func (*PutChunkPrm) WithChunk

func (p *PutChunkPrm) WithChunk(v []byte) *PutChunkPrm

type PutInitPrm

type PutInitPrm struct {
	// contains filtered or unexported fields
}

func (*PutInitPrm) WithCommonPrm

func (p *PutInitPrm) WithCommonPrm(v *util.CommonPrm) *PutInitPrm

func (*PutInitPrm) WithCopiesNumber added in v0.39.0

func (p *PutInitPrm) WithCopiesNumber(cn uint32) *PutInitPrm

func (*PutInitPrm) WithObject

func (p *PutInitPrm) WithObject(v *object.Object) *PutInitPrm

func (*PutInitPrm) WithRelay added in v0.21.0

type PutResponse

type PutResponse struct {
	// contains filtered or unexported fields
}

func (*PutResponse) ObjectID

func (r *PutResponse) ObjectID() oid.ID

type RemotePutPrm

type RemotePutPrm struct {
	// contains filtered or unexported fields
}

RemotePutPrm groups remote put operation parameters.

func (*RemotePutPrm) WithNodeInfo added in v0.26.0

func (p *RemotePutPrm) WithNodeInfo(v netmap.NodeInfo) *RemotePutPrm

WithNodeInfo sets information about the remote node.

func (*RemotePutPrm) WithObject

func (p *RemotePutPrm) WithObject(v *object.Object) *RemotePutPrm

WithObject sets transferred object.

type RemoteSender

type RemoteSender struct {
	// contains filtered or unexported fields
}

RemoteSender represents utility for sending an object to a remote host.

func NewRemoteSender

func NewRemoteSender(keyStorage *util.KeyStorage, cons ClientConstructor) *RemoteSender

NewRemoteSender creates, initializes and returns new RemoteSender instance.

func (*RemoteSender) PutObject

func (s *RemoteSender) PutObject(ctx context.Context, p *RemotePutPrm) error

PutObject sends object to remote node.

func (*RemoteSender) ReplicateObjectToNode added in v0.41.0

func (s *RemoteSender) ReplicateObjectToNode(ctx context.Context, id oid.ID, src io.ReadSeeker, nodeInfo netmap.NodeInfo) error

ReplicateObjectToNode copies binary-encoded NeoFS object from the given io.ReadSeeker into local storage of the node described by specified [netmap.NodeInfo].

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(transport Transport, neoFSNet NeoFSNetwork, m *meta.Meta, opts ...Option) *Service

func (*Service) Put

func (p *Service) Put(ctx context.Context) (*Streamer, error)

func (*Service) ValidateAndStoreObjectLocally added in v0.41.0

func (p *Service) ValidateAndStoreObjectLocally(obj object.Object) error

ValidateAndStoreObjectLocally checks format of given object and, if it's correct, stores it in the underlying local object storage. Serves operation similar to local-only Service.Put one.

type Streamer

type Streamer struct {
	// contains filtered or unexported fields
}

func (*Streamer) Close

func (p *Streamer) Close() (*PutResponse, error)

func (*Streamer) Init

func (p *Streamer) Init(prm *PutInitPrm) error

func (*Streamer) MaxObjectSize added in v0.21.1

func (p *Streamer) MaxObjectSize() uint64

MaxObjectSize returns maximum payload size for the streaming session.

Must be called after the successful Init.

func (*Streamer) SendChunk

func (p *Streamer) SendChunk(prm *PutChunkPrm) error

type Transport added in v0.43.0

type Transport interface {
	// SendReplicationRequestToNode sends a prepared replication request message to
	// the specified remote node.
	SendReplicationRequestToNode(ctx context.Context, req []byte, node client.NodeInfo) ([]byte, error)
}

Transport provides message transmission over NeoFS network.

Jump to

Keyboard shortcuts

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