util

package
v0.38.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IterateAllSplitLeaves

func IterateAllSplitLeaves(r HeadReceiver, addr oid.Address, h func(*objectSDK.Object)) error

IterateAllSplitLeaves is an iterator over all object split-tree leaves in direct order.

func IterateSplitLeaves

func IterateSplitLeaves(r HeadReceiver, addr oid.Address, h func(*objectSDK.Object) bool) error

IterateSplitLeaves is an iterator over object split-tree leaves in direct order.

If member handler returns true, then the iterator aborts without error.

func LogServiceError

func LogServiceError(l *logger.Logger, req string, node network.AddressGroup, err error)

LogServiceError writes error message of object service to provided logger.

func LogWorkerPoolError

func LogWorkerPoolError(l *logger.Logger, req string, err error)

LogWorkerPoolError writes debug error message of object worker pool to provided logger.

func NewRemotePlacementBuilder

func NewRemotePlacementBuilder(b placement.Builder, s netmap.AnnouncedKeys) placement.Builder

NewRemotePlacementBuilder creates, initializes and returns placement builder that excludes local node from any placement vector.

func TraverseSplitChain

func TraverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler) error

TraverseSplitChain is an iterator over object split-tree leaves.

Traversal occurs in one of two directions, which depends on what pslit info was received: * in direct order for link part; * in reverse order for last part.

Types

type CommonPrm

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

func CommonPrmFromV2

func CommonPrmFromV2(req interface {
	GetMetaHeader() *session.RequestMetaHeader
},
) (*CommonPrm, error)

func (*CommonPrm) BearerToken

func (p *CommonPrm) BearerToken() *bearer.Token

func (*CommonPrm) ForgetTokens

func (p *CommonPrm) ForgetTokens()

ForgetTokens forgets all the tokens read from the request's meta information before.

func (*CommonPrm) LocalOnly

func (p *CommonPrm) LocalOnly() bool

func (*CommonPrm) NetmapEpoch

func (p *CommonPrm) NetmapEpoch() uint64

func (*CommonPrm) NetmapLookupDepth

func (p *CommonPrm) NetmapLookupDepth() uint64

func (*CommonPrm) SessionToken

func (p *CommonPrm) SessionToken() *sessionsdk.Object

func (*CommonPrm) SetNetmapLookupDepth

func (p *CommonPrm) SetNetmapLookupDepth(v uint64)

func (*CommonPrm) TTL

func (p *CommonPrm) TTL() uint32

TTL returns TTL for new requests.

func (*CommonPrm) WithLocalOnly

func (p *CommonPrm) WithLocalOnly(v bool) *CommonPrm

func (*CommonPrm) XHeaders

func (p *CommonPrm) XHeaders() []string

XHeaders returns X-Headers for new requests.

type HeadReceiver

type HeadReceiver interface {
	// Head must return one of:
	// * object header (*object.Object);
	// * structured information about split-chain (*object.SplitInfo).
	Head(id oid.Address) (any, error)
}

HeadReceiver is an interface of entity that can receive object header or the information about the object relations.

type KeyStorage

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

KeyStorage represents private key storage of the local node.

func NewKeyStorage

func NewKeyStorage(localKey *ecdsa.PrivateKey, tokenStore SessionSource, net netmap.State) *KeyStorage

NewKeyStorage creates, initializes and returns new KeyStorage instance.

func (*KeyStorage) GetKey

func (s *KeyStorage) GetKey(info *SessionInfo) (*ecdsa.PrivateKey, error)

GetKey fetches private key depending on the SessionInfo.

If info is not `nil`, searches for dynamic session token through the underlying token storage. Returns apistatus.SessionTokenNotFound if token storage does not contain information about provided dynamic session.

If info is `nil`, returns node's private key.

type SessionInfo

type SessionInfo struct {
	// Session unique identifier.
	ID uuid.UUID

	// Session issuer.
	Owner user.ID
}

SessionInfo groups information about FrostFS Object session which is reflected in KeyStorage.

type SessionSource

type SessionSource interface {
	// Get must return non-expired private token that
	// corresponds with passed owner and tokenID. If
	// token has not been created, has been expired
	// of it is impossible to get information about the
	// token Get must return nil.
	Get(owner user.ID, tokenID []byte) *storage.PrivateToken
}

SessionSource is an interface tha provides access to node's actual (not expired) session tokens.

type SplitMemberHandler

type SplitMemberHandler func(member *objectSDK.Object, reverseDirection bool) (stop bool)

SplitMemberHandler is a handler of next split-chain element.

If reverseDirection arg is true, then the traversal is done in reverse order. Stop boolean result provides the ability to interrupt the traversal.

type TraverserGenerator

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

TraverserGenerator represents tool that generates container traverser for the particular need.

func NewTraverserGenerator

func NewTraverserGenerator(nmSrc netmap.Source, cnrSrc container.Source, netmapKeys netmap.AnnouncedKeys) *TraverserGenerator

NewTraverserGenerator creates, initializes and returns new TraverserGenerator instance.

func (*TraverserGenerator) GenerateTraverser

func (g *TraverserGenerator) GenerateTraverser(idCnr cid.ID, idObj *oid.ID, epoch uint64) (*placement.Traverser, error)

GenerateTraverser generates placement Traverser for provided object address using epoch-th network map.

func (*TraverserGenerator) WithTraverseOptions

func (g *TraverserGenerator) WithTraverseOptions(opts ...placement.Option) *TraverserGenerator

WithTraverseOptions returns TraverseGenerator that additionally applies provided options.

Jump to

Keyboard shortcuts

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