transformer

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 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 added in v0.12.0

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

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

Parent return identifier of the parent of the written object.

func (*AccessIdentifiers) ParentID added in v0.12.0

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

ParentID return identifier of the parent of the written object.

func (*AccessIdentifiers) SelfID added in v0.12.0

func (a *AccessIdentifiers) SelfID() *objectSDK.ID

SelfID returns identifier of the written object.

func (*AccessIdentifiers) WithParent added in v0.13.1

WithParentID returns AccessIdentifiers with passed parent identifier.

func (*AccessIdentifiers) WithParentID added in v0.12.0

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

WithParentID returns AccessIdentifiers with passed parent identifier.

func (*AccessIdentifiers) WithSelfID added in v0.12.0

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

WithSelfID returns AccessIdentifiers with passed self identifier.

type FormatterParams added in v0.12.0

type FormatterParams struct {
	Key *ecdsa.PrivateKey

	NextTarget ObjectTarget

	SessionToken *token.SessionToken

	NetworkState netmap.State
}

FormatterParams groups NewFormatTarget parameters.

type ObjectTarget added in v0.12.0

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.RawObject) 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 added in v0.12.0

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

func NewPayloadSizeLimiter(maxSize uint64, targetInit TargetInitializer) ObjectTarget

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

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

TODO: describe behavior in details.

type TargetInitializer added in v0.12.0

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