forked from TrueCloudLab/frostfs-sdk-go
*: Update documentation
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
This commit is contained in:
parent
4fe5e6022d
commit
4b0c67ea7a
5 changed files with 40 additions and 10 deletions
|
@ -74,6 +74,10 @@ func (c *Client) Init(prm PrmInit) {
|
|||
// One-time method call during application start-up stage (after Init ) is expected.
|
||||
// Calling multiple times leads to undefined behavior.
|
||||
//
|
||||
// Return client errors:
|
||||
// - [ErrMissingServer]
|
||||
// - [ErrNonPositiveTimeout]
|
||||
//
|
||||
// See also Init / Close.
|
||||
func (c *Client) Dial(prm PrmDial) error {
|
||||
if prm.endpoint == "" {
|
||||
|
|
|
@ -6,23 +6,38 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
// ErrMissingServer is returned when server endpoint is empty in parameters.
|
||||
ErrMissingServer = errors.New("server address is unset or empty")
|
||||
// ErrNonPositiveTimeout is returned when any timeout is below zero in parameters.
|
||||
ErrNonPositiveTimeout = errors.New("non-positive timeout")
|
||||
|
||||
// ErrMissingContainer is returned when container is not provided.
|
||||
ErrMissingContainer = errors.New("missing container")
|
||||
// ErrMissingObject is returned when object is not provided.
|
||||
ErrMissingObject = errors.New("missing object")
|
||||
// ErrMissingAccount is returned when account/owner is not provided.
|
||||
ErrMissingAccount = errors.New("missing account")
|
||||
// ErrMissingEACL is returned when eACL table is not provided.
|
||||
ErrMissingEACL = errors.New("missing eACL table")
|
||||
// ErrMissingEACLContainer is returned when container info is not provided in eACL table.
|
||||
ErrMissingEACLContainer = errors.New("missing container in eACL table")
|
||||
// ErrMissingAnnouncements is returned when announcements are not provided.
|
||||
ErrMissingAnnouncements = errors.New("missing announcements")
|
||||
// ErrZeroRangeLength is returned when range parameter has zero length.
|
||||
ErrZeroRangeLength = errors.New("zero range length")
|
||||
// ErrMissingRanges is returned when empty ranges list is provided.
|
||||
ErrMissingRanges = errors.New("missing ranges")
|
||||
// ErrZeroEpoch is returned when zero epoch is provided.
|
||||
ErrZeroEpoch = errors.New("zero epoch")
|
||||
// ErrMissingTrusts is returned when empty slice of trusts is provided.
|
||||
ErrMissingTrusts = errors.New("missing trusts")
|
||||
// ErrMissingTrust is returned when empty trust is not provided.
|
||||
ErrMissingTrust = errors.New("missing trust")
|
||||
|
||||
// ErrUnexpectedReadCall is returned when we already got all data but truing to get more.
|
||||
ErrUnexpectedReadCall = errors.New("unexpected call to `Read`")
|
||||
|
||||
// ErrSign is returned when unable to sign service message.
|
||||
ErrSign SignError
|
||||
|
||||
errMissingResponseField missingResponseFieldErr
|
||||
|
@ -56,22 +71,27 @@ func newErrInvalidResponseField(name string, err error) error {
|
|||
return fmt.Errorf("invalid %s field in the response: %w", name, err)
|
||||
}
|
||||
|
||||
// SignError wraps another error with reason why sign process was failed.
|
||||
type SignError struct {
|
||||
err error
|
||||
}
|
||||
|
||||
// NewSignError is a constructor for [SignError].
|
||||
func NewSignError(err error) SignError {
|
||||
return SignError{err: err}
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e SignError) Error() string {
|
||||
return fmt.Sprintf("sign: %v", e.err)
|
||||
}
|
||||
|
||||
// Unwrap implements the error interface.
|
||||
func (e SignError) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// Is implements interface for correct checking current error type with [errors.Is].
|
||||
func (e SignError) Is(target error) bool {
|
||||
switch target.(type) {
|
||||
default:
|
||||
|
|
|
@ -41,6 +41,8 @@ func (x ResEndpointInfo) NodeInfo() netmap.NodeInfo {
|
|||
// Any client's internal or transport errors are returned as `error`,
|
||||
// see [apistatus] package for NeoFS-specific error types.
|
||||
//
|
||||
// Context is required and must not be nil. It is used for network communication.
|
||||
//
|
||||
// Exactly one return value is non-nil. Server status return is returned in ResEndpointInfo.
|
||||
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
|
||||
func (c *Client) EndpointInfo(ctx context.Context, prm PrmEndpointInfo) (*ResEndpointInfo, error) {
|
||||
|
@ -122,6 +124,8 @@ func (x ResNetworkInfo) Info() netmap.NetworkInfo {
|
|||
// Any client's internal or transport errors are returned as `error`,
|
||||
// see [apistatus] package for NeoFS-specific error types.
|
||||
//
|
||||
// Context is required and must not be nil. It is used for network communication.
|
||||
//
|
||||
// Exactly one return value is non-nil. Server status return is returned in ResNetworkInfo.
|
||||
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
|
||||
func (c *Client) NetworkInfo(ctx context.Context, prm PrmNetworkInfo) (*ResNetworkInfo, error) {
|
||||
|
|
|
@ -157,6 +157,7 @@ func (x ResObjectHash) Checksums() [][]byte {
|
|||
// Return errors:
|
||||
// - [ErrMissingContainer]
|
||||
// - [ErrMissingObject]
|
||||
// - [ErrMissingRanges]
|
||||
func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectHash, error) {
|
||||
switch {
|
||||
case prm.addr.GetContainerID() == nil:
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
neofscrypto "github.com/nspcc-dev/neofs-sdk-go/crypto"
|
||||
)
|
||||
|
||||
// ErrOwnerExtract is returned when failed to extract account info from key.
|
||||
var ErrOwnerExtract = errors.New("decode owner failed")
|
||||
|
||||
// IDFromKey forms the ID using script hash calculated for the given key.
|
||||
|
|
Loading…
Reference in a new issue