util

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IterateSplitLeaves added in v0.14.0

func IterateSplitLeaves(r ObjectSource, addr oid.Address, h func(*object.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 added in v0.12.1

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

LogServiceError writes error message of object service to provided logger.

func LogWorkerPoolError added in v0.12.1

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

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

Types

type CommonPrm

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

func CommonPrmFromRequest added in v0.45.0

func CommonPrmFromRequest(req interface {
	GetMetaHeader() *protosession.RequestMetaHeader
}) (*CommonPrm, error)

CommonPrmFromRequest is a temporary copy-paste of [CommonPrmFromV2].

func (*CommonPrm) BearerToken

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

func (*CommonPrm) ForgetTokens added in v0.36.0

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) SessionToken

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

func (*CommonPrm) TTL added in v0.27.0

func (p *CommonPrm) TTL() uint32

TTL returns TTL for new requests.

func (*CommonPrm) WithLocalOnly

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

func (*CommonPrm) XHeaders added in v0.27.0

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

XHeaders returns X-Headers for new requests.

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

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

	// Get must return object by its address.
	Get(address oid.Address) (object.Object, error)
}

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

type SessionInfo added in v0.28.2

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

	// Session issuer.
	Owner user.ID
}

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

type SessionSource added in v0.28.0

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

type SplitMemberHandler func(member *object.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.

Jump to

Keyboard shortcuts

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