transformer

package
v0.0.0-...-79ba347 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessIdentifiers

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

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.

func (*AccessIdentifiers) Parent

func (a *AccessIdentifiers) Parent() *object.Object

Parent return identifier of the parent of the written object.

func (*AccessIdentifiers) ParentID

func (a *AccessIdentifiers) ParentID() *oid.ID

ParentID return identifier of the parent of the written object.

func (AccessIdentifiers) SelfID

func (a AccessIdentifiers) SelfID() oid.ID

SelfID returns identifier of the written object.

func (*AccessIdentifiers) WithParent

func (a *AccessIdentifiers) WithParent(v *object.Object) *AccessIdentifiers

WithParent returns AccessIdentifiers with passed parent identifier.

func (*AccessIdentifiers) WithParentID

func (a *AccessIdentifiers) WithParentID(v *oid.ID) *AccessIdentifiers

WithParentID returns AccessIdentifiers with passed parent identifier.

func (*AccessIdentifiers) WithSelfID

func (a *AccessIdentifiers) WithSelfID(v oid.ID) *AccessIdentifiers

WithSelfID returns AccessIdentifiers with passed self identifier.

type FormatterParams

type FormatterParams struct {
	Key *ecdsa.PrivateKey

	NextTarget ObjectTarget

	SessionToken *session.Object

	NetworkState netmap.State
}

FormatterParams groups NewFormatTarget parameters.

type ObjectTarget

type ObjectTarget 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(*object.Object) error

	// Write writes object payload chunk.
	//
	// Can be called multiple times.
	//
	// Must not be called after Close call.
	io.Writer

	// 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() (*AccessIdentifiers, error)
}

ObjectTarget is an interface of the object writer.

func NewFormatTarget

func NewFormatTarget(p *FormatterParams) ObjectTarget

NewFormatTarget returns ObjectTarget instance that finalizes object structure and writes it to the next target.

Chunks must be written before the WriteHeader call.

Object changes: - sets version to current SDK version; - sets payload size to the total length of all written chunks; - sets session token; - sets number of creation epoch; - calculates and sets verification fields (ID, Signature).

func NewPayloadSizeLimiter

func NewPayloadSizeLimiter(maxSize uint64, withoutHomomorphicHash bool, targetInit TargetInitializer) ObjectTarget

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 TargetInitializer

type TargetInitializer func() ObjectTarget

TargetInitializer represents ObjectTarget constructor.

Jump to

Keyboard shortcuts

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