transformer

package
v0.0.0-...-20ab57b Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessIdentifiers

type AccessIdentifiers struct {
	ParentID     *oid.ID
	SelfID       oid.ID
	ParentHeader *object.Object
}

AccessIdentifiers represents group of the object identifiers that are returned after writing the object. Consists of the ID of the stored object and the ID of the parent object.

type ChunkedObjectWriter

type ChunkedObjectWriter interface {
	// WriteHeader writes object header w/ payload part.
	// The payload of the object may be incomplete.
	//
	// Must be called exactly once. Control remains with the caller.
	// Missing a call or re-calling can lead to undefined behavior
	// that depends on the implementation.
	//
	// Must not be called after Close call.
	WriteHeader(context.Context, *object.Object) error

	// Write writes object payload chunk.
	//
	// Can be called multiple times.
	//
	// Must not be called after Close call.
	Write(context.Context, []byte) (int, error)

	// Close is used to finish object writing.
	//
	// Close must return access identifiers of the object
	// that has been written.
	//
	// Must be called no more than once. Control remains with the caller.
	// Re-calling can lead to undefined behavior
	// that depends on the implementation.
	Close(context.Context) (*AccessIdentifiers, error)
}

ChunkedObjectWriter is an interface of the object writer that writes object chunked.

func NewPayloadSizeLimiter

func NewPayloadSizeLimiter(p Params) ChunkedObjectWriter

NewPayloadSizeLimiter returns ObjectTarget instance that restricts payload length of the writing object and writes generated objects to targets from initializer.

Calculates and adds homomorphic hash to resulting objects only if withoutHomomorphicHash is false.

Objects w/ payload size less or equal than max size remain untouched.

type EpochSource

type EpochSource interface {
	CurrentEpoch() uint64
}

EpochSource is a source for the current epoch.

type ObjectWriter

type ObjectWriter interface {
	// WriteObject writes prepared object.
	WriteObject(context.Context, *object.Object) error
}

ObjectWriter is an interface of the object writer that writes prepared object.

func NewChannelTarget

func NewChannelTarget(ch chan<- *objectSDK.Object) ObjectWriter

NewChannelTarget returns ObjectTarget which writes object parts to a provided channel.

type Params

type Params struct {
	Key                    *ecdsa.PrivateKey
	NextTargetInit         TargetInitializer
	SessionToken           *session.Object
	NetworkState           EpochSource
	MaxSize                uint64
	WithoutHomomorphicHash bool
	// SizeHint is a hint for the total payload size to be processed.
	// It is used primarily to optimize allocations and doesn't affect
	// functionality. Primary usecases are providing file size when putting an object
	// with the frostfs-cli or using Content-Length header in gateways.
	SizeHint uint64
	Pool     *buffPool.BufferPool
}

type TargetInitializer

type TargetInitializer func() ObjectWriter

TargetInitializer represents ObjectWriter constructor.

Jump to

Keyboard shortcuts

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