[#322] *: Go fmt -s

go1.19 rewrites comments to proper render them in docs.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-08-24 17:17:40 +03:00 committed by fyrchik
parent 7537fa0dec
commit 84888854ab
69 changed files with 272 additions and 219 deletions

View file

@ -10,7 +10,8 @@ import "github.com/nspcc-dev/neofs-api-go/v2/accounting"
// Instances can be created using built-in var declaration.
//
// Note that direct typecast is not safe and may result in loss of compatibility:
// _ = Decimal(accounting.Decimal{}) // not recommended
//
// _ = Decimal(accounting.Decimal{}) // not recommended
type Decimal accounting.Decimal
// ReadFromV2 reads Decimal from the accounting.Decimal message. Checks if the

View file

@ -3,6 +3,7 @@ Package accounting provides primitives to perform accounting operations in NeoFS
Decimal type provides functionality to process user balances. For example, when
working with Fixed8 balance precision:
var dec accounting.Decimal
dec.SetValue(val)
dec.SetPrecision(8)
@ -11,6 +12,7 @@ Instances can be also used to process NeoFS API V2 protocol messages
(see neo.fs.v2.accounting package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/accounting"
var msg accounting.Decimal
@ -19,6 +21,7 @@ On client side:
// send msg
On server side:
// recv msg
var dec accounting.Decimal
@ -28,6 +31,5 @@ On server side:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package accounting

View file

@ -4,10 +4,10 @@ Package accountingtest provides functions for convenient testing of accounting p
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import accountingtest "github.com/nspcc-dev/neofs-sdk-go/accounting/test"
dec := accountingtest.Decimal()
// test the value
*/
package accountingtest

View file

@ -2,6 +2,7 @@
Package audit provides features to process data audit in NeoFS system.
Result type groups values which can be gathered during data audit process:
var res audit.Result
res.ForEpoch(32)
res.ForContainer(cnr)
@ -9,16 +10,17 @@ Result type groups values which can be gathered during data audit process:
res.Complete()
Result instances can be stored in a binary format. On reporter side:
data := res.Marshal()
// send data
On receiver side:
var res audit.Result
err := res.Unmarshal(data)
// ...
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package audit

View file

@ -4,10 +4,10 @@ Package audittest provides functions for convenient testing of audit package API
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import audittest "github.com/nspcc-dev/neofs-sdk-go/audit/test"
dec := audittest.Result()
// test the value
*/
package audittest

View file

@ -7,6 +7,7 @@ data for specific user. Therefore, it must be signed by owner of the container.
Define bearer token by setting correct lifetime, extended ACL and owner ID of
the user that will attach token to its requests.
var bearerToken bearer.Token
bearerToken.SetExpiration(500)
bearerToken.SetIssuedAt(10)
@ -15,10 +16,12 @@ the user that will attach token to its requests.
bearerToken.SetOwner(ownerID)
Bearer token must be signed by owner of the container.
err := bearerToken.Sign(privateKey)
Provide signed token in JSON or binary format to the request sender. Request
sender can attach this bearer token to the object service requests:
import sdkClient "github.com/nspcc-dev/neofs-sdk-go/client"
var headParams sdkClient.PrmObjectHead

View file

@ -18,7 +18,8 @@ import (
// Instances can be created using built-in var declaration.
//
// Note that direct typecast is not safe and may result in loss of compatibility:
// _ = Checksum(refs.Checksum{}) // not recommended
//
// _ = Checksum(refs.Checksum{}) // not recommended
type Checksum refs.Checksum
// Type represents the enumeration
@ -106,8 +107,8 @@ func (c *Checksum) SetSHA256(v [sha256.Size]byte) {
// to the passed checksum. Checksum must not be nil.
//
// Does nothing if the passed type is not one of the:
// * SHA256;
// * TZ.
// - SHA256;
// - TZ.
//
// Does not mutate the passed value.
//

View file

@ -3,6 +3,7 @@ Package checksum provides primitives to work with checksums.
Checksum is a basic type of data checksums.
For example, calculating checksums:
// retrieving any payload for hashing
var sha256Sum Checksum
@ -13,6 +14,5 @@ For example, calculating checksums:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package checksum

View file

@ -4,10 +4,10 @@ Package checksumtest provides functions for convenient testing of checksum packa
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import checksumtest "github.com/nspcc-dev/neofs-sdk-go/checksum/test"
cs := checksumtest.Checksum()
// test the value
*/
package checksumtest

View file

@ -50,7 +50,7 @@ func (x ResBalanceGet) Amount() accounting.Decimal {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (*ResBalanceGet, error) {
switch {
case ctx == nil:

View file

@ -34,8 +34,8 @@ import (
// functions to work with status returns (e.g. IsErrContainerNotFound).
// All possible responses are documented in methods, however, some may be
// returned from all of them (pay attention to the presence of the pointer sign):
// - *apistatus.ServerInternal on internal server error;
// - *apistatus.SuccessDefaultV2 on default success.
// - *apistatus.ServerInternal on internal server error;
// - *apistatus.SuccessDefaultV2 on default success.
//
// Client MUST NOT be copied by value: use pointer to Client instead.
//
@ -155,11 +155,13 @@ type PrmDial struct {
// Required parameter.
//
// Format of the URI:
// [scheme://]host:port
//
// [scheme://]host:port
//
// Supported schemes:
// grpc
// grpcs
//
// grpc
// grpcs
//
// See also SetTLSConfig.
func (x *PrmDial) SetServerURI(endpoint string) {

View file

@ -179,9 +179,9 @@ func (x *contextCall) writeRequest() bool {
// (in both cases returns false).
//
// Actions:
// * verify signature (internal);
// * call response callback (internal);
// * unwrap status error (optional).
// - verify signature (internal);
// - call response callback (internal);
// - unwrap status error (optional).
func (x *contextCall) processResponse() bool {
// call response callback if set
if x.callbackResp != nil {

View file

@ -43,8 +43,8 @@ func (x *PrmContainerPut) SetContainer(cnr container.Container) {
// the execution of an operation (e.g. access control).
//
// Session is optional, if set the following requirements apply:
// - session operation MUST be session.VerbContainerPut (ForVerb)
// - token MUST be signed using private key of the owner of the container to be saved
// - session operation MUST be session.VerbContainerPut (ForVerb)
// - token MUST be signed using private key of the owner of the container to be saved
func (x *PrmContainerPut) WithinSession(s session.Container) {
x.session = s
x.sessionSet = true
@ -81,7 +81,7 @@ func (x ResContainerPut) ID() cid.ID {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) ContainerPut(ctx context.Context, prm PrmContainerPut) (*ResContainerPut, error) {
// check parameters
switch {
@ -308,7 +308,7 @@ func (x ResContainerList) Containers() []cid.ID {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) ContainerList(ctx context.Context, prm PrmContainerList) (*ResContainerList, error) {
// check parameters
switch {
@ -420,7 +420,7 @@ type ResContainerDelete struct {
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) ContainerDelete(ctx context.Context, prm PrmContainerDelete) (*ResContainerDelete, error) {
// check parameters
switch {
@ -615,10 +615,10 @@ func (x *PrmContainerSetEACL) SetTable(table eacl.Table) {
// the execution of an operation (e.g. access control).
//
// Session is optional, if set the following requirements apply:
// - if particular container is specified (ApplyOnlyTo), it MUST equal the container
// for which extended ACL is going to be set
// - session operation MUST be session.VerbContainerSetEACL (ForVerb)
// - token MUST be signed using private key of the owner of the container to be saved
// - if particular container is specified (ApplyOnlyTo), it MUST equal the container
// for which extended ACL is going to be set
// - session operation MUST be session.VerbContainerSetEACL (ForVerb)
// - token MUST be signed using private key of the owner of the container to be saved
func (x *PrmContainerSetEACL) WithinSession(s session.Container) {
x.session = s
x.sessionSet = true
@ -646,7 +646,7 @@ type ResContainerSetEACL struct {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL) (*ResContainerSetEACL, error) {
// check parameters
switch {
@ -751,7 +751,7 @@ type ResAnnounceSpace struct {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) ContainerAnnounceUsedSpace(ctx context.Context, prm PrmAnnounceSpace) (*ResAnnounceSpace, error) {
// check parameters
switch {

View file

@ -5,9 +5,11 @@ The main component is Client type. It is a virtual connection to the network
and provides methods for executing operations on the server.
Create client instance:
var c client.Client
Initialize client state:
var prm client.PrmInit
prm.SetDefaultPrivateKey(key)
// ...
@ -15,6 +17,7 @@ Initialize client state:
c.Init(prm)
Connect to the NeoFS server:
var prm client.PrmDial
prm.SetServerURI("localhost:8080")
prm.SetDefaultPrivateKey(key)
@ -24,6 +27,7 @@ Connect to the NeoFS server:
// ...
Execute NeoFS operation on the server:
var prm client.PrmContainerPut
prm.SetContainer(cnr)
// ...
@ -36,6 +40,7 @@ Execute NeoFS operation on the server:
// ...
Consume custom service of the server:
syntax = "proto3";
service CustomService {
@ -58,6 +63,7 @@ Consume custom service of the server:
// ...
Close the connection:
err := c.Close()
// ...
@ -65,6 +71,7 @@ Note that it's not allowed to override Client behaviour directly: the parameters
for the all operations are write-only and the results of the all operations are
read-only. To be able to override client behavior (e.g. for tests), abstract it
with an interface:
import "github.com/nspcc-dev/neofs-sdk-go/client"
type NeoFSClient interface {
@ -80,6 +87,5 @@ with an interface:
func (x *client) CreateContainer(context.Context, container.Container) error {
// ...
}
*/
package client

View file

@ -50,7 +50,7 @@ func (x ResEndpointInfo) NodeInfo() netmap.NodeInfo {
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) EndpointInfo(ctx context.Context, prm PrmEndpointInfo) (*ResEndpointInfo, error) {
// check context
if ctx == nil {
@ -147,7 +147,7 @@ func (x ResNetworkInfo) Info() netmap.NetworkInfo {
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) NetworkInfo(ctx context.Context, prm PrmNetworkInfo) (*ResNetworkInfo, error) {
// check context
if ctx == nil {

View file

@ -268,7 +268,8 @@ func (x *ObjectReader) close(ignoreEOF bool) (*ResObjectGet, error) {
// codes are returned as error.
//
// Return errors:
// *object.SplitInfoError (returned on virtual objects with PrmObjectGet.MakeRaw).
//
// *object.SplitInfoError (returned on virtual objects with PrmObjectGet.MakeRaw).
//
// Return statuses:
// - global (see Client docs);
@ -440,7 +441,8 @@ func (x *ResObjectHead) ReadHeader(dst *object.Object) bool {
// Context is required and must not be nil. It is used for network communication.
//
// Return errors:
// *object.SplitInfoError (returned on virtual objects with PrmObjectHead.MakeRaw).
//
// *object.SplitInfoError (returned on virtual objects with PrmObjectHead.MakeRaw).
//
// Return statuses:
// - global (see Client docs);
@ -676,7 +678,8 @@ func (x *ObjectRangeReader) close(ignoreEOF bool) (*ResObjectRange, error) {
// codes are returned as error.
//
// Return errors:
// *object.SplitInfoError (returned on virtual objects with PrmObjectRange.MakeRaw).
//
// *object.SplitInfoError (returned on virtual objects with PrmObjectRange.MakeRaw).
//
// Return statuses:
// - global (see Client docs);

View file

@ -49,7 +49,7 @@ type ResAnnounceLocalTrust struct {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) AnnounceLocalTrust(ctx context.Context, prm PrmAnnounceLocalTrust) (*ResAnnounceLocalTrust, error) {
// check parameters
switch {
@ -150,7 +150,7 @@ type ResAnnounceIntermediateTrust struct {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) AnnounceIntermediateTrust(ctx context.Context, prm PrmAnnounceIntermediateTrust) (*ResAnnounceIntermediateTrust, error) {
// check parameters
switch {

View file

@ -76,7 +76,7 @@ func (x ResSessionCreate) PublicKey() []byte {
// Context is required and must not be nil. It is used for network communication.
//
// Return statuses:
// - global (see Client docs).
// - global (see Client docs).
func (c *Client) SessionCreate(ctx context.Context, prm PrmSessionCreate) (*ResSessionCreate, error) {
// check context
if ctx == nil {

View file

@ -29,9 +29,9 @@ func (x *ServerInternal) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: INTERNAL;
// * string message: empty;
// * details: empty.
// - code: INTERNAL;
// - string message: empty;
// - details: empty.
func (x ServerInternal) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(status.Internal, status.GlobalizeCommonFail))
return &x.v2
@ -77,9 +77,9 @@ func (x *WrongMagicNumber) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: WRONG_MAGIC_NUMBER;
// * string message: empty;
// * details: empty.
// - code: WRONG_MAGIC_NUMBER;
// - string message: empty;
// - details: empty.
func (x WrongMagicNumber) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(status.WrongMagicNumber, status.GlobalizeCommonFail))
return &x.v2
@ -104,9 +104,9 @@ func (x *WrongMagicNumber) WriteCorrectMagic(magic uint64) {
// CorrectMagic returns network magic returned by the server.
// Second value indicates presence status:
// * -1 if number is presented in incorrect format
// * 0 if number is not presented
// * +1 otherwise
// - -1 if number is presented in incorrect format
// - 0 if number is not presented
// - +1 otherwise
func (x WrongMagicNumber) CorrectMagic() (magic uint64, ok int8) {
x.v2.IterateDetails(func(d *status.Detail) bool {
if d.ID() == status.DetailIDCorrectMagic {
@ -145,10 +145,10 @@ func (x *SignatureVerification) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: SIGNATURE_VERIFICATION_FAIL;
// * string message: written message via SetMessage or
// "signature verification failed" as a default message;
// * details: empty.
// - code: SIGNATURE_VERIFICATION_FAIL;
// - string message: written message via SetMessage or
// "signature verification failed" as a default message;
// - details: empty.
func (x SignatureVerification) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(status.SignatureVerificationFail, status.GlobalizeCommonFail))

View file

@ -26,9 +26,9 @@ func (x *ContainerNotFound) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: CONTAINER_NOT_FOUND;
// * string message: "container not found";
// * details: empty.
// - code: CONTAINER_NOT_FOUND;
// - string message: "container not found";
// - details: empty.
func (x ContainerNotFound) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(container.StatusNotFound, container.GlobalizeFail))
x.v2.SetMessage("container not found")
@ -57,9 +57,9 @@ func (x *EACLNotFound) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: EACL_NOT_FOUND;
// * string message: "eACL not found";
// * details: empty.
// - code: EACL_NOT_FOUND;
// - string message: "eACL not found";
// - details: empty.
func (x EACLNotFound) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(container.StatusEACLNotFound, container.GlobalizeFail))
x.v2.SetMessage("eACL not found")

View file

@ -26,9 +26,9 @@ func (x *ObjectLocked) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: LOCKED;
// * string message: "object is locked";
// * details: empty.
// - code: LOCKED;
// - string message: "object is locked";
// - details: empty.
func (x ObjectLocked) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(object.StatusLocked, object.GlobalizeFail))
x.v2.SetMessage("object is locked")
@ -56,9 +56,9 @@ func (x *LockNonRegularObject) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: LOCK_NON_REGULAR_OBJECT;
// * string message: "locking non-regular object is forbidden";
// * details: empty.
// - code: LOCK_NON_REGULAR_OBJECT;
// - string message: "locking non-regular object is forbidden";
// - details: empty.
func (x LockNonRegularObject) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(object.StatusLockNonRegularObject, object.GlobalizeFail))
x.v2.SetMessage("locking non-regular object is forbidden")
@ -86,9 +86,9 @@ func (x *ObjectAccessDenied) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: ACCESS_DENIED;
// * string message: "access to object operation denied";
// * details: empty.
// - code: ACCESS_DENIED;
// - string message: "access to object operation denied";
// - details: empty.
func (x ObjectAccessDenied) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(object.StatusAccessDenied, object.GlobalizeFail))
x.v2.SetMessage("access to object operation denied")
@ -127,9 +127,9 @@ func (x *ObjectNotFound) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: OBJECT_NOT_FOUND;
// * string message: "object not found";
// * details: empty.
// - code: OBJECT_NOT_FOUND;
// - string message: "object not found";
// - details: empty.
func (x ObjectNotFound) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(object.StatusNotFound, object.GlobalizeFail))
x.v2.SetMessage("object not found")
@ -157,9 +157,9 @@ func (x *ObjectAlreadyRemoved) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: OBJECT_ALREADY_REMOVED;
// * string message: "object already removed";
// * details: empty.
// - code: OBJECT_ALREADY_REMOVED;
// - string message: "object already removed";
// - details: empty.
func (x ObjectAlreadyRemoved) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(object.StatusAlreadyRemoved, object.GlobalizeFail))
x.v2.SetMessage("object already removed")
@ -188,9 +188,9 @@ func (x *ObjectOutOfRange) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: OUT_OF_RANGE;
// * string message: "out of range";
// * details: empty.
// - code: OUT_OF_RANGE;
// - string message: "out of range";
// - details: empty.
func (x ObjectOutOfRange) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(object.StatusOutOfRange, object.GlobalizeFail))
x.v2.SetMessage("out of range")

View file

@ -26,9 +26,9 @@ func (x *SessionTokenNotFound) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: TOKEN_NOT_FOUND;
// * string message: "session token not found";
// * details: empty.
// - code: TOKEN_NOT_FOUND;
// - string message: "session token not found";
// - details: empty.
func (x SessionTokenNotFound) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(session.StatusTokenNotFound, session.GlobalizeFail))
x.v2.SetMessage("session token not found")
@ -56,9 +56,9 @@ func (x *SessionTokenExpired) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: TOKEN_EXPIRED;
// * string message: "expired session token";
// * details: empty.
// - code: TOKEN_EXPIRED;
// - string message: "expired session token";
// - details: empty.
func (x SessionTokenExpired) ToStatusV2() *status.Status {
x.v2.SetCode(globalizeCodeV2(session.StatusTokenExpired, session.GlobalizeFail))
x.v2.SetMessage("expired session token")

View file

@ -3,8 +3,8 @@ package apistatus
// Status defines a variety of NeoFS API status returns.
//
// All statuses are split into two disjoint subsets: successful and failed, and:
// * statuses that implement the build-in error interface are considered failed statuses;
// * all other value types are considered successes (nil is a default success).
// - statuses that implement the build-in error interface are considered failed statuses;
// - all other value types are considered successes (nil is a default success).
//
// In Go code type of success can be determined by a type switch, failure - by a switch with errors.As calls.
// Nil should be considered as a success, and default switch section - as an unrecognized Status.

View file

@ -20,9 +20,9 @@ func (x *SuccessDefaultV2) fromStatusV2(st *status.Status) {
// ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with
// * code: OK;
// * string message: empty;
// * details: empty.
// - code: OK;
// - string message: empty;
// - details: empty.
func (x SuccessDefaultV2) ToStatusV2() *status.Status {
if x.isNil || x.v2 != nil {
return x.v2

View file

@ -28,16 +28,16 @@ type StatusV2 interface {
// Note: notice if the return type is a pointer.
//
// Successes:
// * status.OK: *SuccessDefaultV2 (this also includes nil argument).
// - status.OK: *SuccessDefaultV2 (this also includes nil argument).
//
// Common failures:
// * status.Internal: *ServerInternal;
// * status.SignatureVerificationFail: *SignatureVerification.
// - status.Internal: *ServerInternal;
// - status.SignatureVerificationFail: *SignatureVerification.
//
// Object failures:
// * object.StatusLocked: *ObjectLocked;
// * object.StatusLockNonRegularObject: *LockNonRegularObject.
// * object.StatusAccessDenied: *ObjectAccessDenied.
// - object.StatusLocked: *ObjectLocked;
// - object.StatusLockNonRegularObject: *LockNonRegularObject.
// - object.StatusAccessDenied: *ObjectAccessDenied.
func FromStatusV2(st *status.Status) Status {
var decoder interface {
fromStatusV2(*status.Status)

View file

@ -11,9 +11,11 @@ import (
// See NeoFS Specification for details.
//
// One can find some similarities with the traditional Unix permission, such as
// division into scopes: user, group, others
// op-permissions: read, write, etc.
// sticky bit
//
// division into scopes: user, group, others
// op-permissions: read, write, etc.
// sticky bit
//
// However, these similarities should only be used for better understanding,
// in general these mechanisms are different.
//
@ -106,15 +108,18 @@ func isReplicationOp(op Op) bool {
// AllowOp allows the parties with the given role to the given operation.
// Op MUST be one of the Op enumeration. Role MUST be one of:
// RoleOwner
// RoleContainer
// RoleOthers
//
// RoleOwner
// RoleContainer
// RoleOthers
//
// and if role is RoleContainer, op MUST NOT be:
// OpObjectGet
// OpObjectHead
// OpObjectPut
// OpObjectSearch
// OpObjectHash
//
// OpObjectGet
// OpObjectHead
// OpObjectPut
// OpObjectSearch
// OpObjectHash
//
// See also IsOpAllowed.
func (x *Basic) AllowOp(op Op, role Role) {
@ -146,17 +151,19 @@ func (x *Basic) AllowOp(op Op, role Role) {
//
// Members with RoleContainer role have exclusive default access to the
// operations of the data replication mechanism:
// OpObjectGet
// OpObjectHead
// OpObjectPut
// OpObjectSearch
// OpObjectHash
//
// OpObjectGet
// OpObjectHead
// OpObjectPut
// OpObjectSearch
// OpObjectHash
//
// RoleInnerRing members are allowed to data audit ops only:
// OpObjectGet
// OpObjectHead
// OpObjectHash
// OpObjectSearch
//
// OpObjectGet
// OpObjectHead
// OpObjectHash
// OpObjectSearch
//
// Zero Basic prevents any role from accessing any operation in the absence
// of default rights.

View file

@ -4,6 +4,5 @@ Package acl provides functionality to control access to data and operations on t
Type Basic represents basic ACL of the NeoFS container which specifies the general order of data access.
Basic provides interface of rule composition. Package acl also exports some frequently used settings like
private or public.
*/
package acl

View file

@ -3,27 +3,30 @@ Package container provides functionality related to the NeoFS containers.
The base type is Container. To create new container in the NeoFS network
Container instance should be initialized
var cnr Container
cnr.Init()
// fill all the fields
// encode cnr and send
var cnr Container
cnr.Init()
// fill all the fields
// encode cnr and send
After the container is persisted in the NeoFS network, applications can process
it using the instance of Container types
// recv binary container
var cnr Container
// recv binary container
err := cnr.Unmarshal(bin)
// ...
var cnr Container
// process the container data
err := cnr.Unmarshal(bin)
// ...
// process the container data
Instances can be also used to process NeoFS API V2 protocol messages
(see neo.fs.v2.container package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/container"
var msg container.Container
@ -32,6 +35,7 @@ On client side:
// send msg
On server side:
// recv msg
var cnr Container
@ -41,6 +45,5 @@ On server side:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package container

View file

@ -3,6 +3,5 @@ Package cid provides primitives to work with container identification in NeoFS.
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package cid

View file

@ -16,7 +16,8 @@ import (
// Instances can be created using built-in var declaration.
//
// Note that direct typecast is not safe and may result in loss of compatibility:
// _ = ID([32]byte) // not recommended
//
// _ = ID([32]byte) // not recommended
type ID [sha256.Size]byte
// ReadFromV2 reads ID from the refs.ContainerID message.

View file

@ -4,10 +4,10 @@ Package cidtest provides functions for convenient testing of cid package API.
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
cid := cidtest.ID()
// test the value
*/
package cidtest

View file

@ -2,6 +2,7 @@
Package neofscrypto collects NeoFS cryptographic primitives.
Signer type unifies entities for signing NeoFS data.
// instantiate Signer
// select data to be signed
@ -16,6 +17,7 @@ SDK natively supports several signature schemes that are implemented
in nested packages.
PublicKey allows to verify signatures.
// get signature to be verified
// compose signed data
@ -26,6 +28,7 @@ Signature can be also used to process NeoFS API V2 protocol messages
(see neo.fs.v2.refs package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/refs"
var msg refs.Signature
@ -34,6 +37,7 @@ On client side:
// send msg
On server side:
// recv msg
var sig neofscrypto.Signature
@ -43,6 +47,5 @@ On server side:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package neofscrypto

View file

@ -8,6 +8,5 @@ All these types provide corresponding interfaces from neofscrypto package.
Package import causes registration of next signature schemes via neofscrypto.RegisterScheme:
- neofscrypto.ECDSA_SHA512
- neofscrypto.ECDSA_DETERMINISTIC_SHA256
*/
package neofsecdsa

View file

@ -14,7 +14,8 @@ import (
// message. See ReadFromV2 / WriteToV2 methods.
//
// Note that direct typecast is not safe and may result in loss of compatibility:
// _ = Signature(refs.Signature{}) // not recommended
//
// _ = Signature(refs.Signature{}) // not recommended
type Signature refs.Signature
// ReadFromV2 reads Signature from the refs.Signature message. Checks if the

View file

@ -130,9 +130,9 @@ func ActionFromV2(action v2acl.Action) (a Action) {
// String returns string representation of Action.
//
// String mapping:
// * ActionAllow: ALLOW;
// * ActionDeny: DENY;
// * ActionUnknown, default: ACTION_UNSPECIFIED.
// - ActionAllow: ALLOW;
// - ActionDeny: DENY;
// - ActionUnknown, default: ACTION_UNSPECIFIED.
func (a Action) String() string {
return a.ToV2().String()
}
@ -202,14 +202,14 @@ func OperationFromV2(operation v2acl.Operation) (o Operation) {
// String returns string representation of Operation.
//
// String mapping:
// * OperationGet: GET;
// * OperationHead: HEAD;
// * OperationPut: PUT;
// * OperationDelete: DELETE;
// * OperationSearch: SEARCH;
// * OperationRange: GETRANGE;
// * OperationRangeHash: GETRANGEHASH;
// * OperationUnknown, default: OPERATION_UNSPECIFIED.
// - OperationGet: GET;
// - OperationHead: HEAD;
// - OperationPut: PUT;
// - OperationDelete: DELETE;
// - OperationSearch: SEARCH;
// - OperationRange: GETRANGE;
// - OperationRangeHash: GETRANGEHASH;
// - OperationUnknown, default: OPERATION_UNSPECIFIED.
func (o Operation) String() string {
return o.ToV2().String()
}
@ -263,10 +263,10 @@ func RoleFromV2(role v2acl.Role) (r Role) {
// String returns string representation of Role.
//
// String mapping:
// * RoleUser: USER;
// * RoleSystem: SYSTEM;
// * RoleOthers: OTHERS;
// * RoleUnknown, default: ROLE_UNKNOWN.
// - RoleUser: USER;
// - RoleSystem: SYSTEM;
// - RoleOthers: OTHERS;
// - RoleUnknown, default: ROLE_UNKNOWN.
func (r Role) String() string {
return r.ToV2().String()
}
@ -316,9 +316,9 @@ func MatchFromV2(match v2acl.MatchType) (m Match) {
// String returns string representation of Match.
//
// String mapping:
// * MatchStringEqual: STRING_EQUAL;
// * MatchStringNotEqual: STRING_NOT_EQUAL;
// * MatchUnknown, default: MATCH_TYPE_UNSPECIFIED.
// - MatchStringEqual: STRING_EQUAL;
// - MatchStringNotEqual: STRING_NOT_EQUAL;
// - MatchUnknown, default: MATCH_TYPE_UNSPECIFIED.
func (m Match) String() string {
return m.ToV2().String()
}
@ -372,9 +372,9 @@ func FilterHeaderTypeFromV2(header v2acl.HeaderType) (h FilterHeaderType) {
// String returns string representation of FilterHeaderType.
//
// String mapping:
// * HeaderFromRequest: REQUEST;
// * HeaderFromObject: OBJECT;
// * HeaderTypeUnknown, default: HEADER_UNSPECIFIED.
// - HeaderFromRequest: REQUEST;
// - HeaderFromObject: OBJECT;
// - HeaderTypeUnknown, default: HEADER_UNSPECIFIED.
func (h FilterHeaderType) String() string {
return h.ToV2().String()
}

View file

@ -142,10 +142,10 @@ func (k *filterKey) fromString(s string) {
// NewFilter creates, initializes and returns blank Filter instance.
//
// Defaults:
// - header type: HeaderTypeUnknown;
// - matcher: MatchUnknown;
// - key: "";
// - value: "".
// - header type: HeaderTypeUnknown;
// - matcher: MatchUnknown;
// - key: "";
// - value: "".
func NewFilter() *Filter {
return NewFilterFromV2(new(v2acl.HeaderFilter))
}

View file

@ -191,10 +191,10 @@ func (r *Record) ToV2() *v2acl.Record {
// NewRecord creates and returns blank Record instance.
//
// Defaults:
// - action: ActionUnknown;
// - operation: OperationUnknown;
// - targets: nil,
// - filters: nil.
// - action: ActionUnknown;
// - operation: OperationUnknown;
// - targets: nil,
// - filters: nil.
func NewRecord() *Record {
return new(Record)
}

View file

@ -91,11 +91,11 @@ func (t *Table) ToV2() *v2acl.Table {
// NewTable creates, initializes and returns blank Table instance.
//
// Defaults:
// - version: version.Current();
// - container ID: nil;
// - records: nil;
// - session token: nil;
// - signature: nil.
// - version: version.Current();
// - container ID: nil;
// - records: nil;
// - session token: nil;
// - signature: nil.
func NewTable() *Table {
t := new(Table)
t.SetVersion(version.Current())

View file

@ -105,8 +105,8 @@ func (t *Target) ToV2() *v2acl.Target {
// NewTarget creates, initializes and returns blank Target instance.
//
// Defaults:
// - role: RoleUnknown;
// - keys: nil.
// - role: RoleUnknown;
// - keys: nil.
func NewTarget() *Target {
return NewTargetFromV2(new(v2acl.Target))
}

View file

@ -51,9 +51,9 @@ func (v *Validator) CalculateAction(unit *ValidationUnit) (Action, bool) {
}
// returns:
// - positive value if no matching header is found for at least one filter;
// - zero if at least one suitable header is found for all filters;
// - negative value if the headers of at least one filter cannot be obtained.
// - positive value if no matching header is found for at least one filter;
// - zero if at least one suitable header is found for all filters;
// - negative value if the headers of at least one filter cannot be obtained.
func matchFilters(hdrSrc TypedHeaderSource, filters []Filter) int {
matched := 0

View file

@ -18,6 +18,7 @@ Instances can be also used to process NeoFS API V2 protocol messages
(see neo.fs.v2.netmap package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/netmap"
var msg netmap.NodeInfo
@ -26,6 +27,7 @@ On client side:
// send msg
On server side:
// recv msg
var info NodeInfo
@ -37,6 +39,5 @@ On server side:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package netmap

View file

@ -2,6 +2,7 @@
Package ns provides functionality of NeoFS name system.
DNS type is designed to resolve NeoFS-related names using Domain Name System:
const containerName = "some-container"
var dns DNS
@ -10,6 +11,7 @@ DNS type is designed to resolve NeoFS-related names using Domain Name System:
// ...
NNS type is designed to resolve NeoFS-related names using Neo Name Service:
var nns NNS
err := nns.Dial(nnsServerAddress)
@ -17,6 +19,5 @@ NNS type is designed to resolve NeoFS-related names using Neo Name Service:
containerID, err := nns.ResolveContainerName(containerName)
// ...
*/
package ns

View file

@ -19,8 +19,8 @@ func NewAttributeFromV2(aV2 *object.Attribute) *Attribute {
// Works similar as NewAttributeFromV2(new(Attribute)).
//
// Defaults:
// - key: "";
// - value: "".
// - key: "";
// - value: "".
func NewAttribute() *Attribute {
return NewAttributeFromV2(new(object.Attribute))
}

View file

@ -6,6 +6,5 @@ while ID represents identity within a fixed container.
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package oid

View file

@ -19,7 +19,8 @@ import (
// Instances can be created using built-in var declaration.
//
// Note that direct typecast is not safe and may result in loss of compatibility:
// _ = ID([32]byte{}) // not recommended
//
// _ = ID([32]byte{}) // not recommended
type ID [sha256.Size]byte
// ReadFromV2 reads ID from the refs.ObjectID message. Returns an error if

View file

@ -4,10 +4,10 @@ Package oidtest provides functions for convenient testing of oid package API.
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import oidtest "github.com/nspcc-dev/neofs-sdk-go/object/id/test"
value := oidtest.ID()
// test the value
*/
package oidtest

View file

@ -20,9 +20,9 @@ import (
// Type is compatible with NeoFS API V2 protocol.
//
// Instance can be created depending on scenario:
// * InitCreation (an object to be placed in container);
// * New (blank instance, usually needed for decoding);
// * NewFromV2 (when working under NeoFS API V2 protocol).
// - InitCreation (an object to be placed in container);
// - New (blank instance, usually needed for decoding);
// - NewFromV2 (when working under NeoFS API V2 protocol).
type Object object.Object
// RequiredFields contains the minimum set of object data that must be set

View file

@ -17,8 +17,8 @@ func NewRangeFromV2(rV2 *object.Range) *Range {
// NewRange creates and initializes blank Range.
//
// Defaults:
// - offset: 0;
// - length: 0.
// - offset: 0;
// - length: 0.
func NewRange() *Range {
return NewRangeFromV2(new(object.Range))
}

View file

@ -57,11 +57,11 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) {
// String returns string representation of SearchMatchType.
//
// String mapping:
// * MatchStringEqual: STRING_EQUAL;
// * MatchStringNotEqual: STRING_NOT_EQUAL;
// * MatchNotPresent: NOT_PRESENT;
// * MatchCommonPrefix: COMMON_PREFIX;
// * MatchUnknown, default: MATCH_TYPE_UNSPECIFIED.
// - MatchStringEqual: STRING_EQUAL;
// - MatchStringNotEqual: STRING_NOT_EQUAL;
// - MatchNotPresent: NOT_PRESENT;
// - MatchCommonPrefix: COMMON_PREFIX;
// - MatchUnknown, default: MATCH_TYPE_UNSPECIFIED.
func (m SearchMatchType) String() string {
return m.ToV2().String()
}

View file

@ -12,7 +12,7 @@ type SplitID struct {
// NewSplitID returns UUID representation of splitID attribute.
//
// Defaults:
// - id: random UUID.
// - id: random UUID.
func NewSplitID() *SplitID {
return &SplitID{
uuid: uuid.New(),

View file

@ -21,9 +21,9 @@ func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo {
// NewSplitInfo creates and initializes blank SplitInfo.
//
// Defaults:
// - splitID: nil;
// - lastPart nil;
// - link: nil.
// - splitID: nil;
// - lastPart nil;
// - link: nil.
func NewSplitInfo() *SplitInfo {
return NewSplitInfoFromV2(new(object.SplitInfo))
}

View file

@ -19,9 +19,9 @@ func NewTombstoneFromV2(tV2 *tombstone.Tombstone) *Tombstone {
// NewTombstone creates and initializes blank Tombstone.
//
// Defaults:
// - exp: 0;
// - splitID: nil;
// - members: nil.
// - exp: 0;
// - splitID: nil;
// - members: nil.
func NewTombstone() *Tombstone {
return NewTombstoneFromV2(new(tombstone.Tombstone))
}

View file

@ -24,10 +24,10 @@ func TypeFromV2(t object.Type) Type {
// String returns string representation of Type.
//
// String mapping:
// * TypeTombstone: TOMBSTONE;
// * TypeStorageGroup: STORAGE_GROUP;
// * TypeLock: LOCK;
// * TypeRegular, default: REGULAR.
// - TypeTombstone: TOMBSTONE;
// - TypeStorageGroup: STORAGE_GROUP;
// - TypeLock: LOCK;
// - TypeRegular, default: REGULAR.
func (t Type) String() string {
return t.ToV2().String()
}

View file

@ -9,6 +9,7 @@ Create pool instance with 3 nodes connection.
This InitParameters will make pool use 192.168.130.71 node while it is healthy. Otherwise, it will make the pool use
192.168.130.72 for 90% of requests and 192.168.130.73 for remaining 10%.
:
var prm pool.InitParameters
prm.SetKey(key)
prm.AddNode(NewNodeParam(1, "192.168.130.71", 1))
@ -20,10 +21,12 @@ This InitParameters will make pool use 192.168.130.71 node while it is healthy.
// ...
Connect to the NeoFS server:
err := p.Dial(ctx)
// ...
Execute NeoFS operation on the server:
var prm pool.PrmContainerPut
prm.SetContainer(cnr)
// ...
@ -32,6 +35,7 @@ Execute NeoFS operation on the server:
// ...
Execute NeoFS operation on the server and check error:
var prm pool.PrmObjectHead
prm.SetAddress(addr)
// ...
@ -43,7 +47,7 @@ Execute NeoFS operation on the server and check error:
// ...
Close the connection:
p.Close()
p.Close()
*/
package pool

View file

@ -2051,8 +2051,9 @@ func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjec
// PutContainer sends request to save container in NeoFS and waits for the operation to complete.
//
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
// polling interval: 5s
// waiting timeout: 120s
//
// polling interval: 5s
// waiting timeout: 120s
//
// Success can be verified by reading by identifier (see GetContainer).
//
@ -2091,8 +2092,9 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.
// DeleteContainer sends request to remove the NeoFS container and waits for the operation to complete.
//
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
// polling interval: 5s
// waiting timeout: 120s
//
// polling interval: 5s
// waiting timeout: 120s
//
// Success can be verified by reading by identifier (see GetContainer).
func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) error {
@ -2119,8 +2121,9 @@ func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, e
// SetEACL sends request to update eACL table of the NeoFS container and waits for the operation to complete.
//
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
// polling interval: 5s
// waiting timeout: 120s
//
// polling interval: 5s
// waiting timeout: 120s
//
// Success can be verified by reading by identifier (see GetEACL).
func (p *Pool) SetEACL(ctx context.Context, prm PrmContainerSetEACL) error {

View file

@ -12,6 +12,7 @@ Instances can be also used to process NeoFS API V2 protocol messages
(see neo.fs.v2.reputation package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/reputation"
var msg reputation.GlobalTrust
@ -20,6 +21,7 @@ On client side:
// send trust
On server side:
// recv msg
var trust reputation.GlobalTrust
@ -29,6 +31,5 @@ On server side:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package reputation

View file

@ -10,6 +10,7 @@ scope related to some NeoFS service: Object, Container, etc.
Both parties agree on a secret (private session key), the possession of which
will be authenticated by a trusted person. The principal confirms his trust by
signing the public part of the secret (public session key).
var tok Container
tok.ForVerb(VerbContainerDelete)
tok.SetAuthKey(trustedKey)
@ -26,6 +27,7 @@ Instances can be also used to process NeoFS API V2 protocol messages
(see neo.fs.v2.accounting package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/session"
var msg session.Token
@ -34,6 +36,7 @@ On client side:
// send msg
On server side:
// recv msg
var tok session.Container
@ -43,6 +46,5 @@ On server side:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package session

View file

@ -4,10 +4,10 @@ Package sessiontest provides functions for convenient testing of session package
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import sessiontest "github.com/nspcc-dev/neofs-sdk-go/session/test"
val := sessiontest.Container()
// test the value
*/
package sessiontest

View file

@ -3,6 +3,7 @@ Package storagegroup provides features to work with information that is
used for proof of storage in NeoFS system.
StorageGroup type groups verification values for Data Audit sessions:
// receive sg info
sg.ExpirationEpoch() // expiration of the storage group
@ -14,6 +15,7 @@ Instances can be also used to process NeoFS API V2 protocol messages
(see neo.fs.v2.storagegroup package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/storagegroup"
var msg storagegroup.StorageGroup
@ -22,6 +24,7 @@ On client side:
// send msg
On server side:
// recv msg
var sg StorageGroupDecimal
@ -31,6 +34,5 @@ On server side:
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package storagegroup

View file

@ -21,7 +21,8 @@ import (
// Instances can be created using built-in var declaration.
//
// Note that direct typecast is not safe and may result in loss of compatibility:
// _ = StorageGroup(storagegroup.StorageGroup) // not recommended
//
// _ = StorageGroup(storagegroup.StorageGroup) // not recommended
type StorageGroup storagegroup.StorageGroup
// reads StorageGroup from the storagegroup.StorageGroup message. If checkFieldPresence is set,
@ -289,9 +290,9 @@ func ReadFromObject(sg *StorageGroup, o objectSDK.Object) error {
// have it at all.
//
// Written information:
// * expiration epoch;
// * object type (TypeStorageGroup);
// * raw payload.
// - expiration epoch;
// - object type (TypeStorageGroup);
// - raw payload.
func WriteToObject(sg StorageGroup, o *objectSDK.Object) {
sgRaw, err := sg.Marshal()
if err != nil {

View file

@ -4,10 +4,10 @@ Package storagegrouptest provides functions for convenient testing of storagegro
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import storagegrouptest "github.com/nspcc-dev/neofs-sdk-go/storagegroup/test"
val := storagegrouptest.StorageGroup()
// test the value
*/
package storagegrouptest

View file

@ -5,6 +5,5 @@ Subnet of a particular NeoFS network consists of a subset of the storage nodes
of that network. Subnet of the whole network is called zero. Info type acts as
a subnet descriptor. Each subnet is owned by the user who created it. Information
about all subnets is stored in the Subnet contract of the NeoFS Sidechain.
*/
package subnet

View file

@ -5,6 +5,5 @@ ID type is used for global subnet identity inside the NeoFS network.
Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible.
*/
package subnetid

View file

@ -4,10 +4,10 @@ Package subnetidtest provides functions for convenient testing of subnetid packa
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import subnetidtest "github.com/nspcc-dev/neofs-sdk-go/suibnet/id/test"
value := subnetidtest.ID()
// test the value
*/
package subnetidtest

View file

@ -4,10 +4,10 @@ Package subnettest provides functions for convenient testing of subnet package A
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import subnettest "github.com/nspcc-dev/neofs-sdk-go/suibnet/test"
value := subnettest.Info()
// test the value
*/
package subnettest

View file

@ -5,6 +5,7 @@ User identity is reflected in ID type. Each user has its own unique identifier
within the same network.
NeoFS user identification is compatible with Neo accounts:
import "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
import "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
@ -17,6 +18,7 @@ NeoFS user identification is compatible with Neo accounts:
user.IDFromKey(&id, k.PrivateKey.PublicKey)
ID is compatible with the NeoFS Smart Contract API:
var id user.ID
// ...
@ -25,6 +27,7 @@ ID is compatible with the NeoFS Smart Contract API:
// use wallet in call
Encoding/decoding mechanisms are used to transfer identifiers:
var id user.ID
// ...
@ -35,6 +38,7 @@ Instances can be also used to process NeoFS API protocol messages
(see neo.fs.v2.refs package in https://github.com/nspcc-dev/neofs-api).
On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/refs"
var msg refs.OwnerID
@ -43,6 +47,7 @@ On client side:
// send msg
On server side:
// recv msg
var id user.ID

View file

@ -4,10 +4,10 @@ Package usertest provides functions for convenient testing of user package API.
Note that importing the package into source files is highly discouraged.
Random instance generation functions can be useful when testing expects any value, e.g.:
import usertest "github.com/nspcc-dev/neofs-sdk-go/user/test"
id := usertest.ID()
// test the value
*/
package usertest

View file

@ -6,9 +6,11 @@ the API.
In most of the cases it will be enough to use the latest supported NeoFS API
version in SDK:
ver := version.Current()
It is possible to specify arbitrary version by setting major and minor numbers:
var ver version.Version
ver.SetMajor(2)
ver.SetMinor(5)

View file

@ -14,7 +14,8 @@ import (
// Instances can be created using built-in var declaration.
//
// Note that direct typecast is not safe and may result in loss of compatibility:
// _ = Version(refs.Version{}) // not recommended
//
// _ = Version(refs.Version{}) // not recommended
type Version refs.Version
const sdkMjr, sdkMnr = 2, 13