neofsapiclient

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package neofsapiclient provides functionality for IR application communication with NeoFS network.

The basic client for accessing remote nodes via NeoFS API is a NeoFS SDK Go API client. However, although it encapsulates a useful piece of business logic (e.g. the signature mechanism), the IR application does not fully use the client's flexible interface.

In this regard, this package represents an abstraction -- a type-wrapper over the base client. The type provides the minimum interface necessary for the application and also 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 application packages will be limited to this package for the development of functionality requiring NeoFS API communication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetObjectHeaderFromContainer

func GetObjectHeaderFromContainer(ctx context.Context, c Client, addr oid.Address) (*object.Object, error)

GetObjectHeaderFromContainer reads the short object header by address via Client with TTL = 10 for deep traversal of the container.

func GetObjectPayload

func GetObjectPayload(ctx context.Context, c Client, addr oid.Address) ([]byte, error)

GetObjectPayload reads an object by address from NeoFS via Client and returns its payload.

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

func GetRawObjectHeaderLocally

func GetRawObjectHeaderLocally(ctx context.Context, c Client, addr oid.Address) (*object.Object, error)

GetRawObjectHeaderLocally reads the raw short object header from the server's local storage by address via Client.

func HashObjectRange

func HashObjectRange(ctx context.Context, c Client, addr oid.Address, rng *object.Range) ([]byte, error)

HashObjectRange reads Tillich-Zemor hash of the object payload range by address from the remote server's local storage via Client.

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

Types

type Client

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

Client represents NeoFS API client cut down to the needs of a purely IR application.

func (Client) GetObject

func (x Client) GetObject(prm GetObjectPrm) (*GetObjectRes, error)

GetObject reads the object by address.

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

func (Client) HashPayloadRange

func (x Client) HashPayloadRange(prm HashPayloadRangePrm) (res HashPayloadRangeRes, err error)

HashPayloadRange requests to calculate Tillich-Zemor hash of the payload range of the object from the remote server's local storage.

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

func (Client) HeadObject

func (x Client) HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error)

HeadObject reads short object header by address.

Returns any error which prevented the operation from completing correctly in error return. For raw requests, returns *object.SplitInfoError error if the requested object is virtual.

func (Client) SearchSG

func (x Client) SearchSG(prm SearchSGPrm) (*SearchSGRes, error)

SearchSG lists objects of storage group type in the container.

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

func (*Client) SetPrivateKey

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

SetPrivateKey sets a private key to sign RPC requests.

func (*Client) WrapBasicClient

func (x *Client) WrapBasicClient(c clientcore.Client)

WrapBasicClient wraps a client.Client instance to use it for NeoFS API RPC.

type GetObjectPrm

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

GetObjectPrm groups parameters of GetObject operation.

type GetObjectRes

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

GetObjectRes groups the resulting values of GetObject operation.

func (GetObjectRes) Object

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

Object returns the received object.

type HashPayloadRangePrm

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

HashPayloadRangePrm groups parameters of HashPayloadRange operation.

func (*HashPayloadRangePrm) SetRange

func (x *HashPayloadRangePrm) SetRange(rng *object.Range)

SetRange sets payload range to calculate the hash.

type HashPayloadRangeRes

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

HashPayloadRangeRes groups the resulting values of HashPayloadRange operation.

func (HashPayloadRangeRes) Hash

func (x HashPayloadRangeRes) Hash() []byte

Hash returns the hash of the object payload range.

type HeadObjectPrm

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

HeadObjectPrm groups parameters of HeadObject operation.

func (*HeadObjectPrm) SetRawFlag

func (x *HeadObjectPrm) SetRawFlag()

SetRawFlag sets flag of raw request.

func (*HeadObjectPrm) SetTTL

func (x *HeadObjectPrm) SetTTL(ttl uint32)

SetTTL sets request TTL value.

type HeadObjectRes

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

HeadObjectRes groups the resulting values of HeadObject operation.

func (HeadObjectRes) Header

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

Header returns the received object header.

type SearchSGPrm

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

SearchSGPrm groups parameters of SearchSG operation.

func (*SearchSGPrm) SetContainerID

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

SetContainerID sets the ID of the container to search for storage groups.

func (*SearchSGPrm) SetContext

func (x *SearchSGPrm) SetContext(ctx context.Context)

SetContext sets context.Context used for network communication.

type SearchSGRes

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

SearchSGRes groups the resulting values of SearchSG operation.

func (SearchSGRes) IDList

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

IDList returns a list of IDs of storage groups in the container.

Jump to

Keyboard shortcuts

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