transport

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyID is a filter key to object ID field.
	KeyID = "ID"

	// KeyTombstone is a filter key to tombstone header.
	KeyTombstone = "TOMBSTONE"

	// KeyStorageGroup is a filter key to storage group link.
	KeyStorageGroup = "STORAGE_GROUP"

	// KeyNoChildren is a filter key to objects w/o child links.
	KeyNoChildren = "LEAF"

	// KeyParent is a filter key to parent link.
	KeyParent = "PARENT"

	// KeyHasParent is a filter key to objects with parent link.
	KeyHasParent = "HAS_PAR"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressInfo

type AddressInfo interface {
	MetaInfo
	GetAddress() refs.Address
}

AddressInfo is an interface of the container of object request by Address.

type ContainerTraverseExecutor

type ContainerTraverseExecutor interface {
	Execute(context.Context, TraverseParams)
}

ContainerTraverseExecutor is an interface of object operation executor with container traversing.

func NewContainerTraverseExecutor

func NewContainerTraverseExecutor(t ObjectTransport) (ContainerTraverseExecutor, error)

NewContainerTraverseExecutor is a ContainerTraverseExecutor executor.

type GetInfo

type GetInfo interface {
	AddressInfo
}

GetInfo is an interface of the container of object Get operation parameters.

type GetParams

type GetParams struct {
	SelectiveParams
	Handler func(multiaddr.Multiaddr, *object.Object)
}

GetParams groups the parameters of selective object Get.

func (*GetParams) HandleResult

func (s *GetParams) HandleResult(_ context.Context, node multiaddr.Multiaddr, r interface{}, e error)

HandleResult calls Handler if error argument is nil with:

  • Multiaddr with argument value;
  • result casted to an Object pointer.

type HeadInfo

type HeadInfo interface {
	GetInfo
	GetFullHeaders() bool
}

HeadInfo is an interface of the container of object Head operation parameters.

type HeadParams

type HeadParams struct {
	GetParams
	FullHeaders bool
}

HeadParams groups the parameters of selective object Head.

type MetaInfo

type MetaInfo interface {
	GetTTL() uint32
	GetTimeout() time.Duration
	service.SessionTokenSource
	GetRaw() bool
	Type() object.RequestType
	service.BearerTokenSource
	service.ExtendedHeadersSource
}

MetaInfo is an interface of the container of cross-operation values.

type ObjectContainerHandlerParams

type ObjectContainerHandlerParams struct {
	NodeLister *placement.PlacementWrapper
	Executor   ContainerTraverseExecutor
	*zap.Logger
}

ObjectContainerHandlerParams grops the parameters of SelectiveContainerExecutor constructor.

type ObjectTransport

type ObjectTransport interface {
	Transport(context.Context, ObjectTransportParams)
}

ObjectTransport is an interface of the executor of object remote operations.

type ObjectTransportParams

type ObjectTransportParams struct {
	TransportInfo MetaInfo
	TargetNode    multiaddr.Multiaddr
	ResultHandler ResultHandler
}

ObjectTransportParams groups the parameters of remote object operation.

type ProgressControlFlag

type ProgressControlFlag int

ProgressControlFlag is an enumeration of progress control flags.

const (

	// NextAddress is a ProgressControlFlag of to go to the next address of the object.
	NextAddress ProgressControlFlag

	// NextNode is a ProgressControlFlag of to go to the next node.
	NextNode

	// BreakProgress is a ProgressControlFlag to interrupt the execution.
	BreakProgress
)

type PutInfo

type PutInfo interface {
	MetaInfo
	GetHead() *object.Object
	Payload() io.Reader
	CopiesNumber() uint32
}

PutInfo is an interface of the container of object Put operation parameters.

type PutParams

type PutParams struct {
	SelectiveParams
	Object  *object.Object
	Handler func(multiaddr.Multiaddr, bool)

	CopiesNumber uint32
}

PutParams groups the parameters of selective object Put.

func (*PutParams) HandleResult

func (s *PutParams) HandleResult(_ context.Context, node multiaddr.Multiaddr, _ interface{}, e error)

HandleResult calls Handler with:

  • Multiaddr with argument value;
  • error equality to nil.

type RangeHashInfo

type RangeHashInfo interface {
	AddressInfo
	GetRanges() []object.Range
	GetSalt() []byte
}

RangeHashInfo is an interface of the container of object GetRangeHash operation parameters.

type RangeHashParams

type RangeHashParams struct {
	SelectiveParams
	Ranges  []object.Range
	Salt    []byte
	Handler func(multiaddr.Multiaddr, []hash.Hash)
}

RangeHashParams groups the parameters of selective object GetRangeHash.

func (*RangeHashParams) HandleResult

func (s *RangeHashParams) HandleResult(_ context.Context, node multiaddr.Multiaddr, r interface{}, e error)

HandleResult calls Handler if error argument is nil with:

  • Multiaddr with argument value;
  • result casted to Hash slice.

type RangeInfo

type RangeInfo interface {
	AddressInfo
	GetRange() object.Range
}

RangeInfo is an interface of the container of object GetRange operation parameters.

type ResultHandler

type ResultHandler interface {
	HandleResult(context.Context, multiaddr.Multiaddr, interface{}, error)
}

ResultHandler is an interface of remote object operation's result handler.

type SearchInfo

type SearchInfo interface {
	MetaInfo
	GetCID() refs.CID
	GetQuery() []byte
}

SearchInfo is an interface of the container of object Search operation parameters.

type SearchParams

type SearchParams struct {
	SelectiveParams
	SearchCID   refs.CID
	SearchQuery []byte
	Handler     func(multiaddr.Multiaddr, []refs.Address)
}

SearchParams groups the parameters of selective object Search.

func (*SearchParams) HandleResult

func (s *SearchParams) HandleResult(_ context.Context, node multiaddr.Multiaddr, r interface{}, e error)

HandleResult calls Handler if error argument is nil with:

  • Multiaddr with argument value;
  • result casted to Address slice.

type SelectiveContainerExecutor

type SelectiveContainerExecutor interface {
	Put(context.Context, *PutParams) error
	Get(context.Context, *GetParams) error
	Head(context.Context, *HeadParams) error
	Search(context.Context, *SearchParams) error
	RangeHash(context.Context, *RangeHashParams) error
}

SelectiveContainerExecutor is an interface the tool that performs object operations in container with preconditions.

func NewObjectContainerHandler

func NewObjectContainerHandler(p ObjectContainerHandlerParams) (SelectiveContainerExecutor, error)

NewObjectContainerHandler is a SelectiveContainerExecutor constructor.

type SelectiveParams

type SelectiveParams struct {
	/* Should be set to true only if service under object transport implementations is served on localhost. */
	ServeLocal bool

	/* Raw option of the request */
	Raw bool

	/* TTL for object transport. All transport operations inherit same value. */
	TTL uint32

	/* Required ID of processing container. If empty or not set, an error is returned. */
	CID container.ID

	/* List of nodes selected for processing. If not specified => nodes will be selected during. */
	Nodes []multiaddr.Multiaddr

	/* List of objects to process (overlaps query). */
	IDList []refs.ObjectID
	/* If no objects is indicated, query is used for selection. */
	Query []byte

	/*
		If function provided, it is called after every successful operation.
		True result breaks operation performing.
	*/
	Breaker func(refs.Address) ProgressControlFlag

	/* Public session token */
	Token service.SessionToken

	/* Bearer token */
	Bearer service.BearerToken

	/* Extended headers */
	ExtendedHeaders []service.ExtendedHeader
}

SelectiveParams groups the parameters of the execution of selective container operation.

type TraverseParams

type TraverseParams struct {
	TransportInfo        MetaInfo
	Handler              ResultHandler
	Traverser            Traverser
	WorkerPool           WorkerPool
	ExecutionInterceptor func(context.Context, multiaddr.Multiaddr) bool
}

TraverseParams groups the parameters of container traversing.

type Traverser

type Traverser interface {
	Next(context.Context) []multiaddr.Multiaddr
}

Traverser is an interface of container traverser.

type WorkerPool

type WorkerPool interface {
	Submit(func()) error
}

WorkerPool is an interface of go-routine pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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