internal

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package internal provides functionality for FrostFS Node Object service communication with FrostFS network. The base client for accessing remote nodes via FrostFS API is a FrostFS SDK Go API client. However, although it encapsulates a useful piece of business logic (e.g. the signature mechanism), the Object service does not fully use the client's flexible interface.

In this regard, this package provides functions over base API client necessary for the application. This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient both when updating the base client and for evaluating the UX of SDK library). So it is expected that all Object service packages will be limited to this package for the development of functionality requiring FrostFS API communication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportError

func ReportError(c clientcore.Client, err error)

ReportError drops client connection if possible.

Types

type GetObjectPrm

type GetObjectPrm struct {
	ClientParams client.PrmObjectGet
	// contains filtered or unexported fields
}

GetObjectPrm groups parameters of GetObject operation.

func (*GetObjectPrm) SetAddress

func (x *GetObjectPrm) SetAddress(addr oid.Address)

SetAddress sets object address.

Required parameter.

func (*GetObjectPrm) SetNetmapEpoch

func (x *GetObjectPrm) SetNetmapEpoch(_ uint64)

SetNetmapEpoch sets the epoch number to be used to locate the objectSDK.

By default current epoch on the server will be used.

func (*GetObjectPrm) SetRawFlag

func (x *GetObjectPrm) SetRawFlag()

SetRawFlag sets raw flag of the request.

By default request will not be raw.

type GetObjectRes

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

GetObjectRes groups the resulting values of GetObject operation.

func GetObject

func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error)

GetObject reads the object by address.

Client, context and key must be set.

Returns any error which prevented the operation from completing correctly in error return. Returns:

  • error of type *objectSDK.SplitInfoError if object raw flag is set and requested object is virtual;
  • error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.

GetObject ignores the provided session if it is not related to the requested objectSDK.

func (GetObjectRes) Object

func (x GetObjectRes) Object() *objectSDK.Object

Object returns requested objectSDK.

type HeadObjectPrm

type HeadObjectPrm struct {
	ClientParams client.PrmObjectHead
	// contains filtered or unexported fields
}

HeadObjectPrm groups parameters of HeadObject operation.

func (*HeadObjectPrm) SetAddress

func (x *HeadObjectPrm) SetAddress(addr oid.Address)

SetAddress sets object address.

Required parameter.

func (*HeadObjectPrm) SetNetmapEpoch

func (x *HeadObjectPrm) SetNetmapEpoch(_ uint64)

SetNetmapEpoch sets the epoch number to be used to locate the objectSDK.

By default current epoch on the server will be used.

func (*HeadObjectPrm) SetRawFlag

func (x *HeadObjectPrm) SetRawFlag()

SetRawFlag sets raw flag of the request.

By default request will not be raw.

type HeadObjectRes

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

HeadObjectRes groups the resulting values of GetObject operation.

func HeadObject

func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error)

HeadObject reads object header by address.

Client and key must be set.

Returns any error which prevented the operation from completing correctly in error return. Returns:

error of type *objectSDK.SplitInfoError if object raw flag is set and requested object is virtual;
error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.

HeadObject ignores the provided session if it is not related to the requested objectSDK.

func (HeadObjectRes) Header

func (x HeadObjectRes) Header() *objectSDK.Object

Header returns requested object header.

type PayloadRangePrm

type PayloadRangePrm struct {
	ClientParams client.PrmObjectRange
	// contains filtered or unexported fields
}

PayloadRangePrm groups parameters of PayloadRange operation.

func (*PayloadRangePrm) SetAddress

func (x *PayloadRangePrm) SetAddress(addr oid.Address)

SetAddress sets object address.

Required parameter.

func (*PayloadRangePrm) SetNetmapEpoch

func (x *PayloadRangePrm) SetNetmapEpoch(_ uint64)

SetNetmapEpoch sets the epoch number to be used to locate the objectSDK.

By default current epoch on the server will be used.

func (*PayloadRangePrm) SetRange

func (x *PayloadRangePrm) SetRange(rng *objectSDK.Range)

SetRange range of the object payload to be read.

Required parameter.

func (*PayloadRangePrm) SetRawFlag

func (x *PayloadRangePrm) SetRawFlag()

SetRawFlag sets raw flag of the request.

By default request will not be raw.

type PayloadRangeRes

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

PayloadRangeRes groups the resulting values of GetObject operation.

func PayloadRange

func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, error)

PayloadRange reads object payload range by address.

Client and key must be set.

Returns any error which prevented the operation from completing correctly in error return. Returns:

error of type *objectSDK.SplitInfoError if object raw flag is set and requested object is virtual;
error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed;
error of type *apistatus.ObjectOutOfRange if the requested range is too big.

PayloadRange ignores the provided session if it is not related to the requested objectSDK.

func (PayloadRangeRes) PayloadRange

func (x PayloadRangeRes) PayloadRange() []byte

PayloadRange returns data of the requested payload range.

type PutObjectPrm

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

PutObjectPrm groups parameters of PutObject operation.

func (*PutObjectPrm) SetBearerToken

func (x *PutObjectPrm) SetBearerToken(tok *bearer.Token)

SetBearerToken sets bearer token to be attached to the request.

By default token is not attached to the request.

func (*PutObjectPrm) SetClient

func (x *PutObjectPrm) SetClient(cli coreclient.Client)

SetClient sets base client for ForstFS API communication.

Required parameter.

func (*PutObjectPrm) SetObject

func (x *PutObjectPrm) SetObject(obj *objectSDK.Object)

SetObject sets object to be stored.

Required parameter.

func (*PutObjectPrm) SetPrivateKey

func (x *PutObjectPrm) SetPrivateKey(key *ecdsa.PrivateKey)

SetPrivateKey sets private key to sign the request(s).

Required parameter.

func (*PutObjectPrm) SetSessionToken

func (x *PutObjectPrm) SetSessionToken(tok *session.Object)

SetSessionToken sets token of the session within which request should be sent.

By default the request will be sent outside the session.

func (*PutObjectPrm) SetTTL

func (x *PutObjectPrm) SetTTL(ttl uint32)

SetTTL sets time-to-live call option.

func (*PutObjectPrm) SetXHeaders

func (x *PutObjectPrm) SetXHeaders(hs []string)

SetXHeaders sets request X-Headers.

By default X-Headers will not be attached to the request.

type PutObjectRes

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

PutObjectRes groups the resulting values of PutObject operation.

func PutObject

func PutObject(ctx context.Context, prm PutObjectPrm) (*PutObjectRes, error)

PutObject saves the object in local storage of the remote node.

Client and key must be set.

Returns any error which prevented the operation from completing correctly in error return.

func PutObjectSingle added in v0.37.0

func PutObjectSingle(ctx context.Context, prm PutObjectPrm) (*PutObjectRes, error)

PutObjectSingle saves the object in local storage of the remote node with PutSingle RPC.

Client and key must be set.

Returns any error which prevented the operation from completing correctly in error return.

func (PutObjectRes) ID

func (x PutObjectRes) ID() oid.ID

ID returns identifier of the stored objectSDK.

type SearchObjectsPrm

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

SearchObjectsPrm groups parameters of SearchObjects operation.

func (*SearchObjectsPrm) SetContainerID

func (x *SearchObjectsPrm) SetContainerID(id cid.ID)

SetContainerID sets identifier of the container to search the objects.

Required parameter.

func (*SearchObjectsPrm) SetFilters

func (x *SearchObjectsPrm) SetFilters(fs objectSDK.SearchFilters)

SetFilters sets search filters.

func (*SearchObjectsPrm) SetNetmapEpoch

func (x *SearchObjectsPrm) SetNetmapEpoch(_ uint64)

SetNetmapEpoch sets the epoch number to be used to locate the objectSDK.

By default current epoch on the server will be used.

type SearchObjectsRes

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

SearchObjectsRes groups the resulting values of SearchObjects operation.

func SearchObjects

func SearchObjects(ctx context.Context, prm SearchObjectsPrm) (*SearchObjectsRes, error)

SearchObjects selects objects from container which match the filters.

Returns any error which prevented the operation from completing correctly in error return.

func (SearchObjectsRes) IDList

func (x SearchObjectsRes) IDList() []oid.ID

IDList returns identifiers of the matched objects.

Jump to

Keyboard shortcuts

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