Documentation ¶
Overview ¶
Package internal provides functionality for NeoFS CLI application communication with NeoFS network.
The base 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 NeoFS CLI application 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 application packages will be limited to this package for the development of functionality requiring NeoFS API communication.
Index ¶
- type BalanceOfPrm
- type BalanceOfRes
- type CreateSessionPrm
- type CreateSessionRes
- type DeleteContainerPrm
- type DeleteContainerRes
- type DeleteObjectPrm
- type DeleteObjectRes
- type EACLPrm
- type EACLRes
- type GetContainerPrm
- type GetContainerRes
- type GetObjectPrm
- type GetObjectRes
- type HashPayloadRangesPrm
- func (x *HashPayloadRangesPrm) SetAddress(addr *object.Address)
- func (x *HashPayloadRangesPrm) SetRanges(rngs []*object.Range)
- func (x *HashPayloadRangesPrm) SetSalt(salt []byte)
- func (x *HashPayloadRangesPrm) SetTTL(ttl uint32)
- func (x *HashPayloadRangesPrm) SetXHeaders(xhdrs []*session.XHeader)
- func (x *HashPayloadRangesPrm) TZ()
- type HashPayloadRangesRes
- type HeadObjectPrm
- type HeadObjectRes
- type ListContainersPrm
- type ListContainersRes
- type NetworkInfoPrm
- type NetworkInfoRes
- type NodeInfoPrm
- type NodeInfoRes
- type PayloadRangePrm
- func (x *PayloadRangePrm) SetAddress(addr *object.Address)
- func (x *PayloadRangePrm) SetPayloadWriter(wrt io.Writer)
- func (x *PayloadRangePrm) SetRange(rng *object.Range)
- func (x *PayloadRangePrm) SetRawFlag(raw bool)
- func (x *PayloadRangePrm) SetTTL(ttl uint32)
- func (x *PayloadRangePrm) SetXHeaders(xhdrs []*session.XHeader)
- type PayloadRangeRes
- type PutContainerPrm
- type PutContainerRes
- type PutObjectPrm
- type PutObjectRes
- type SearchObjectsPrm
- type SearchObjectsRes
- type SetEACLPrm
- type SetEACLRes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalanceOfPrm ¶
type BalanceOfPrm struct {
// contains filtered or unexported fields
}
BalanceOfPrm groups parameters of BalanceOf operation.
func (*BalanceOfPrm) SetKey ¶
func (x *BalanceOfPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
type BalanceOfRes ¶
type BalanceOfRes struct {
// contains filtered or unexported fields
}
BalanceOfRes groups resulting values of BalanceOf operation.
func BalanceOf ¶
func BalanceOf(prm BalanceOfPrm) (res BalanceOfRes, err error)
BalanceOf requests current balance of NeoFS user.
Returns any error prevented the operation from completing correctly in error return.
func (BalanceOfRes) Balance ¶
func (x BalanceOfRes) Balance() *accounting.Decimal
Balance returns current balance.
type CreateSessionPrm ¶
type CreateSessionPrm struct {
// contains filtered or unexported fields
}
CreateSessionPrm groups parameters of CreateSession operation.
func (*CreateSessionPrm) SetKey ¶
func (x *CreateSessionPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
type CreateSessionRes ¶
type CreateSessionRes struct {
// contains filtered or unexported fields
}
CreateSessionRes groups resulting values of CreateSession operation.
func CreateSession ¶
func CreateSession(prm CreateSessionPrm) (res CreateSessionRes, err error)
CreateSession opens new unlimited session with the remote node.
Returns any error prevented the operation from completing correctly in error return.
func (CreateSessionRes) SessionKey ¶
func (x CreateSessionRes) SessionKey() []byte
SessionKey returns public session key in a binary format.
type DeleteContainerPrm ¶
type DeleteContainerPrm struct {
// contains filtered or unexported fields
}
DeleteContainerPrm groups parameters of DeleteContainerPrm operation.
func (*DeleteContainerPrm) SetContainerID ¶
SetContainerID sets container identifier.
func (*DeleteContainerPrm) SetKey ¶
func (x *DeleteContainerPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
func (*DeleteContainerPrm) SetSessionToken ¶
SetSessionToken sets token of the session within which request should be sent.
type DeleteContainerRes ¶
type DeleteContainerRes struct{}
DeleteContainerRes groups resulting values of DeleteContainer operation.
func DeleteContainer ¶
func DeleteContainer(prm DeleteContainerPrm) (res DeleteContainerRes, err error)
DeleteContainer sends request to remove container from NeoFS by ID.
Operation is asynchronous and no guaranteed even in the absence of errors. The required time is also not predictable.
Success can be verified by reading by identifier.
Returns any error prevented the operation from completing correctly in error return.
type DeleteObjectPrm ¶
type DeleteObjectPrm struct {
// contains filtered or unexported fields
}
DeleteObjectPrm groups parameters of DeleteObject operation.
func (*DeleteObjectPrm) SetAddress ¶
func (*DeleteObjectPrm) SetTTL ¶
func (x *DeleteObjectPrm) SetTTL(ttl uint32)
SetTTL sets request TTL value.
func (*DeleteObjectPrm) SetXHeaders ¶
SetXHeaders sets request X-Headers.
type DeleteObjectRes ¶
type DeleteObjectRes struct {
// contains filtered or unexported fields
}
DeleteObjectRes groups resulting values of DeleteObject operation.
func DeleteObject ¶
func DeleteObject(prm DeleteObjectPrm) (res DeleteObjectRes, err error)
DeleteObject marks object to be removed from NeoFS through tombstone placement.
Returns any error prevented the operation from completing correctly in error return.
func (DeleteObjectRes) TombstoneAddress ¶
func (x DeleteObjectRes) TombstoneAddress() *object.Address
TombstoneAddress returns address of the created object with tombstone.
type EACLPrm ¶
type EACLPrm struct {
// contains filtered or unexported fields
}
EACLPrm groups parameters of EACL operation.
func (*EACLPrm) SetContainerID ¶
SetContainerID sets container identifier.
func (*EACLPrm) SetKey ¶
func (x *EACLPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
type EACLRes ¶
type EACLRes struct {
// contains filtered or unexported fields
}
EACLRes groups resulting values of EACL operation.
type GetContainerPrm ¶
type GetContainerPrm struct {
// contains filtered or unexported fields
}
GetContainerPrm groups parameters of GetContainer operation.
func (*GetContainerPrm) SetContainerID ¶
SetContainerID sets container identifier.
func (*GetContainerPrm) SetKey ¶
func (x *GetContainerPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
type GetContainerRes ¶
type GetContainerRes struct {
// contains filtered or unexported fields
}
GetContainerRes groups resulting values of GetContainer operation.
func GetContainer ¶
func GetContainer(prm GetContainerPrm) (res GetContainerRes, err error)
GetContainer reads container from NeoFS by ID.
Returns any error prevented the operation from completing correctly in error return.
func (GetContainerRes) Container ¶
func (x GetContainerRes) Container() *container.Container
Container returns structured of the requested container.
type GetObjectPrm ¶
type GetObjectPrm struct {
// contains filtered or unexported fields
}
GetObjectPrm groups parameters of GetObject operation.
func (*GetObjectPrm) SetAddress ¶
func (*GetObjectPrm) SetPayloadWriter ¶
SetPayloadWriter sets writer of the object payload.
func (*GetObjectPrm) SetRawFlag ¶
func (x *GetObjectPrm) SetRawFlag(raw bool)
SetRawFlag sets flag of raw request.
func (*GetObjectPrm) SetTTL ¶
func (x *GetObjectPrm) SetTTL(ttl uint32)
SetTTL sets request TTL value.
func (*GetObjectPrm) SetXHeaders ¶
SetXHeaders sets request X-Headers.
type GetObjectRes ¶
type GetObjectRes struct {
// contains filtered or unexported fields
}
GetObjectRes groups resulting values of GetObject operation.
func GetObject ¶
func GetObject(prm GetObjectPrm) (res GetObjectRes, err error)
GetObject reads the object by address.
Interrupts on any writer error. If successful, payload is written to writer.
Returns any error prevented the operation from completing correctly in error return. For raw reading, returns *object.SplitInfoError error if object is virtual.
func (GetObjectRes) Header ¶
func (x GetObjectRes) Header() *object.Object
Header returns header of the request object.
type HashPayloadRangesPrm ¶
type HashPayloadRangesPrm struct {
// contains filtered or unexported fields
}
HashPayloadRangesPrm groups parameters of HashPayloadRanges operation.
func (*HashPayloadRangesPrm) SetAddress ¶
func (*HashPayloadRangesPrm) SetRanges ¶
func (x *HashPayloadRangesPrm) SetRanges(rngs []*object.Range)
SetRanges sets list of payload ranges to hash.
func (*HashPayloadRangesPrm) SetSalt ¶
func (x *HashPayloadRangesPrm) SetSalt(salt []byte)
SetSalt sets data for each range to be XOR'ed with.
func (*HashPayloadRangesPrm) SetTTL ¶
func (x *HashPayloadRangesPrm) SetTTL(ttl uint32)
SetTTL sets request TTL value.
func (*HashPayloadRangesPrm) SetXHeaders ¶
SetXHeaders sets request X-Headers.
func (*HashPayloadRangesPrm) TZ ¶
func (x *HashPayloadRangesPrm) TZ()
TZ sets flag to request Tillich-Zemor hashes.
type HashPayloadRangesRes ¶
type HashPayloadRangesRes struct {
// contains filtered or unexported fields
}
HashPayloadRangesRes groups resulting values of HashPayloadRanges operation.
func HashPayloadRanges ¶
func HashPayloadRanges(prm HashPayloadRangesPrm) (res HashPayloadRangesRes, err error)
HashPayloadRanges requests hashes (by default SHA256) of the object payload ranges.
Returns any error prevented the operation from completing correctly in error return. Returns an error if number of received hashes differs with the number of requested ranges.
func (HashPayloadRangesRes) HashList ¶
func (x HashPayloadRangesRes) HashList() [][]byte
HashList returns list of hashes of the payload ranges keeping order.
type HeadObjectPrm ¶
type HeadObjectPrm struct {
// contains filtered or unexported fields
}
HeadObjectPrm groups parameters of HeadObject operation.
func (*HeadObjectPrm) SetAddress ¶
func (*HeadObjectPrm) SetMainOnlyFlag ¶
func (x *HeadObjectPrm) SetMainOnlyFlag(v bool)
SetMainOnlyFlag sets flag to get only main fields of object header in terms of NeoFS API.
func (*HeadObjectPrm) SetRawFlag ¶
func (x *HeadObjectPrm) SetRawFlag(raw bool)
SetRawFlag sets flag of raw request.
func (*HeadObjectPrm) SetTTL ¶
func (x *HeadObjectPrm) SetTTL(ttl uint32)
SetTTL sets request TTL value.
func (*HeadObjectPrm) SetXHeaders ¶
SetXHeaders sets request X-Headers.
type HeadObjectRes ¶
type HeadObjectRes struct {
// contains filtered or unexported fields
}
HeadObjectRes groups resulting values of HeadObject operation.
func HeadObject ¶
func HeadObject(prm HeadObjectPrm) (res HeadObjectRes, err error)
HeadObject reads object header by address.
Returns any error prevented the operation from completing correctly in error return. For raw reading, returns *object.SplitInfoError error if object is virtual.
func (HeadObjectRes) Header ¶
func (x HeadObjectRes) Header() *object.Object
Header returns requested object header.
type ListContainersPrm ¶
type ListContainersPrm struct {
// contains filtered or unexported fields
}
ListContainersPrm groups parameters of ListContainers operation.
func (*ListContainersPrm) SetKey ¶
func (x *ListContainersPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
type ListContainersRes ¶
type ListContainersRes struct {
// contains filtered or unexported fields
}
ListContainersRes groups resulting values of ListContainers operation.
func ListContainers ¶
func ListContainers(prm ListContainersPrm) (res ListContainersRes, err error)
ListContainers requests list of NeoFS user's containers.
Returns any error prevented the operation from completing correctly in error return.
func (ListContainersRes) IDList ¶
func (x ListContainersRes) IDList() []*cid.ID
IDList returns list of identifiers of user's containers.
type NetworkInfoPrm ¶
type NetworkInfoPrm struct {
// contains filtered or unexported fields
}
NetworkInfoPrm groups parameters of NetworkInfo operation.
func (*NetworkInfoPrm) SetKey ¶
func (x *NetworkInfoPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
type NetworkInfoRes ¶
type NetworkInfoRes struct {
// contains filtered or unexported fields
}
NetworkInfoRes groups resulting values of NetworkInfo operation.
func NetworkInfo ¶
func NetworkInfo(prm NetworkInfoPrm) (res NetworkInfoRes, err error)
NetworkInfo reads information about the NeoFS network.
Returns any error prevented the operation from completing correctly in error return.
func (NetworkInfoRes) NetworkInfo ¶
func (x NetworkInfoRes) NetworkInfo() *netmap.NetworkInfo
NetworkInfo returns structured information about the NeoFS network.
type NodeInfoPrm ¶
type NodeInfoPrm struct {
// contains filtered or unexported fields
}
NodeInfoPrm groups parameters of NodeInfo operation.
func (*NodeInfoPrm) SetKey ¶
func (x *NodeInfoPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
type NodeInfoRes ¶
type NodeInfoRes struct {
// contains filtered or unexported fields
}
NodeInfoRes groups resulting values of NodeInfo operation.
func NodeInfo ¶
func NodeInfo(prm NodeInfoPrm) (res NodeInfoRes, err error)
NodeInfo requests information about the remote server from NeoFS netmap.
Returns any error prevented the operation from completing correctly in error return.
func (NodeInfoRes) LatestVersion ¶
func (x NodeInfoRes) LatestVersion() *version.Version
LatestVersion returns latest NeoFS API version in use.
func (NodeInfoRes) NodeInfo ¶
func (x NodeInfoRes) NodeInfo() *netmap.NodeInfo
NodeInfo returns information about the node from netmap.
type PayloadRangePrm ¶
type PayloadRangePrm struct {
// contains filtered or unexported fields
}
PayloadRangePrm groups parameters of PayloadRange operation.
func (*PayloadRangePrm) SetAddress ¶
func (*PayloadRangePrm) SetPayloadWriter ¶
SetPayloadWriter sets writer of the object payload.
func (*PayloadRangePrm) SetRange ¶
func (x *PayloadRangePrm) SetRange(rng *object.Range)
SetRange sets payload range to read.
func (*PayloadRangePrm) SetRawFlag ¶
func (x *PayloadRangePrm) SetRawFlag(raw bool)
SetRawFlag sets flag of raw request.
func (*PayloadRangePrm) SetTTL ¶
func (x *PayloadRangePrm) SetTTL(ttl uint32)
SetTTL sets request TTL value.
func (*PayloadRangePrm) SetXHeaders ¶
SetXHeaders sets request X-Headers.
type PayloadRangeRes ¶
type PayloadRangeRes struct{}
PayloadRangeRes groups resulting values of PayloadRange operation.
func PayloadRange ¶
func PayloadRange(prm PayloadRangePrm) (res PayloadRangeRes, err error)
PayloadRange reads object payload range from NeoFS and writes it to specified writer.
Interrupts on any writer error.
Returns any error prevented the operation from completing correctly in error return. For raw reading, returns *object.SplitInfoError error if object is virtual.
type PutContainerPrm ¶
type PutContainerPrm struct {
// contains filtered or unexported fields
}
PutContainerPrm groups parameters of PutContainer operation.
func (*PutContainerPrm) SetContainer ¶
func (x *PutContainerPrm) SetContainer(cnr *container.Container)
SetContainer sets container structure.
func (*PutContainerPrm) SetKey ¶
func (x *PutContainerPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
func (*PutContainerPrm) SetSessionToken ¶
SetSessionToken sets token of the session within which request should be sent.
type PutContainerRes ¶
type PutContainerRes struct {
// contains filtered or unexported fields
}
PutContainerRes groups resulting values of PutContainer operation.
func PutContainer ¶
func PutContainer(prm PutContainerPrm) (res PutContainerRes, err error)
PutContainer sends request to save container in NeoFS.
Operation is asynchronous and no guaranteed even in the absence of errors. The required time is also not predictable.
Success can be verified by reading by identifier.
Returns any error prevented the operation from completing correctly in error return.
func (PutContainerRes) ID ¶
func (x PutContainerRes) ID() *cid.ID
ID returns identifier of the created container.
type PutObjectPrm ¶
type PutObjectPrm struct {
// contains filtered or unexported fields
}
PutObjectPrm groups parameters of PutObject operation.
func (*PutObjectPrm) SetHeader ¶
func (x *PutObjectPrm) SetHeader(hdr *object.Object)
SetHeader sets object header.
func (*PutObjectPrm) SetPayloadReader ¶
func (x *PutObjectPrm) SetPayloadReader(rdr io.Reader)
SetPayloadReader sets reader of the object payload.
func (*PutObjectPrm) SetTTL ¶
func (x *PutObjectPrm) SetTTL(ttl uint32)
SetTTL sets request TTL value.
func (*PutObjectPrm) SetXHeaders ¶
SetXHeaders sets request X-Headers.
type PutObjectRes ¶
type PutObjectRes struct {
// contains filtered or unexported fields
}
PutObjectRes groups resulting values of PutObject operation.
func PutObject ¶
func PutObject(prm PutObjectPrm) (res PutObjectRes, err error)
PutObject saves the object in NeoFS network.
Returns any error prevented the operation from completing correctly in error return.
func (PutObjectRes) ID ¶
func (x PutObjectRes) ID() *object.ID
ID returns identifier of the created object.
type SearchObjectsPrm ¶
type SearchObjectsPrm struct {
// contains filtered or unexported fields
}
SearchObjectsPrm groups parameters of SearchObjects operation.
func (*SearchObjectsPrm) SetContainerID ¶
SetContainerID sets container identifier.
func (*SearchObjectsPrm) SetFilters ¶
func (x *SearchObjectsPrm) SetFilters(filters object.SearchFilters)
SetFilters sets search filters.
func (*SearchObjectsPrm) SetTTL ¶
func (x *SearchObjectsPrm) SetTTL(ttl uint32)
SetTTL sets request TTL value.
func (*SearchObjectsPrm) SetXHeaders ¶
SetXHeaders sets request X-Headers.
type SearchObjectsRes ¶
type SearchObjectsRes struct {
// contains filtered or unexported fields
}
SearchObjectsRes groups resulting values of SearchObjects operation.
func SearchObjects ¶
func SearchObjects(prm SearchObjectsPrm) (res SearchObjectsRes, err error)
SearchObjects selects objects from container which match the filters.
Returns any error prevented the operation from completing correctly in error return.
func (SearchObjectsRes) IDList ¶
func (x SearchObjectsRes) IDList() []*object.ID
IDList returns identifiers of the matched objects.
type SetEACLPrm ¶
type SetEACLPrm struct {
// contains filtered or unexported fields
}
SetEACLPrm groups parameters of SetEACL operation.
func (*SetEACLPrm) SetEACLTable ¶
func (x *SetEACLPrm) SetEACLTable(table *eacl.Table)
SetEACLTable sets eACL table structure.
func (*SetEACLPrm) SetKey ¶
func (x *SetEACLPrm) SetKey(key *ecdsa.PrivateKey)
SetKey sets private key to sign the request(s).
func (*SetEACLPrm) SetSessionToken ¶
SetSessionToken sets token of the session within which request should be sent.
type SetEACLRes ¶
type SetEACLRes struct{}
SetEACLRes groups resulting values of SetEACL operation.
func SetEACL ¶
func SetEACL(prm SetEACLPrm) (res SetEACLRes, err error)
SetEACL requests to save eACL table in NeoFS.
Operation is asynchronous and no guaranteed even in the absence of errors. The required time is also not predictable.
Success can be verified by reading by container identifier.
Returns any error prevented the operation from completing correctly in error return.