Documentation ¶
Overview ¶
Package internal provides functionality for NeoFS Node Object service 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 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 NeoFS API communication.
Index ¶
- func ReportError(c clientcore.Client, err error)
- type GetObjectPrm
- type GetObjectRes
- type HeadObjectPrm
- type HeadObjectRes
- type PayloadRangePrm
- type PayloadRangeRes
- type PutObjectPrm
- func (x *PutObjectPrm) SetBearerToken(tok *bearer.Token)
- func (x *PutObjectPrm) SetClient(cli coreclient.Client)
- func (x *PutObjectPrm) SetContext(ctx context.Context)
- func (x *PutObjectPrm) SetObject(obj *object.Object)
- func (x *PutObjectPrm) SetPrivateKey(key *ecdsa.PrivateKey)
- func (x *PutObjectPrm) SetSessionToken(tok *session.Object)
- func (x *PutObjectPrm) SetTTL(ttl uint32)
- func (x *PutObjectPrm) SetXHeaders(hs []string)
- type PutObjectRes
- type SearchObjectsPrm
- type SearchObjectsRes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReportError ¶ added in v0.36.0
func ReportError(c clientcore.Client, err error)
ReportError drops client connection if possible.
Types ¶
type GetObjectPrm ¶
type GetObjectPrm struct {
// 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 object.
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(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 *object.SplitInfoError if object raw flag is set and requested object is virtual
- apistatus.ErrObjectAlreadyRemoved error if the requested object is marked to be removed
GetObject ignores the provided session if it is not related to the requested object.
func (GetObjectRes) Object ¶
func (x GetObjectRes) Object() *object.Object
Object returns requested object.
type HeadObjectPrm ¶
type HeadObjectPrm struct {
// 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 object.
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(prm HeadObjectPrm) (*HeadObjectRes, error)
HeadObject reads object header 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 *object.SplitInfoError if object raw flag is set and requested object is virtual
- apistatus.ErrObjectAlreadyRemoved error if the requested object is marked to be removed
- apistatus.ErrNodeUnderMaintenance error if remote node is currently under maintenance
HeadObject ignores the provided session if it is not related to the requested object.
func (HeadObjectRes) Header ¶
func (x HeadObjectRes) Header() *object.Object
Header returns requested object header.
type PayloadRangePrm ¶
type PayloadRangePrm struct {
// 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 object.
By default current epoch on the server will be used.
func (*PayloadRangePrm) SetRange ¶
func (x *PayloadRangePrm) SetRange(rng *object.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(prm PayloadRangePrm) (*PayloadRangeRes, error)
PayloadRange reads object payload range 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 *object.SplitInfoError if object raw flag is set and requested object is virtual
- apistatus.ErrObjectAlreadyRemoved error if the requested object is marked to be removed
- apistatus.ErrObjectOutOfRange error if the requested range is too big
- apistatus.ErrObjectAccessDenied error if access to the requested object is denied
PayloadRange ignores the provided session if it is not related to the requested object.
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 ¶
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 NeoFS API communication.
Required parameter.
func (*PutObjectPrm) SetContext ¶
SetContext sets context.Context for network communication.
Required parameter.
func (*PutObjectPrm) SetObject ¶
func (x *PutObjectPrm) SetObject(obj *object.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 ¶
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 ¶ added in v0.27.5
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(prm PutObjectPrm) (*PutObjectRes, error)
PutObject saves the object in local storage of the remote node.
Client, context 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 object.
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 object.SearchFilters)
SetFilters sets search filters.
func (*SearchObjectsPrm) SetNetmapEpoch ¶
func (x *SearchObjectsPrm) SetNetmapEpoch(_ uint64)
SetNetmapEpoch sets the epoch number to be used to locate the object.
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(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.