[#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,6 +10,7 @@ import "github.com/nspcc-dev/neofs-api-go/v2/accounting"
// Instances can be created using built-in var declaration. // Instances can be created using built-in var declaration.
// //
// Note that direct typecast is not safe and may result in loss of compatibility: // 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 type Decimal accounting.Decimal

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 Decimal type provides functionality to process user balances. For example, when
working with Fixed8 balance precision: working with Fixed8 balance precision:
var dec accounting.Decimal var dec accounting.Decimal
dec.SetValue(val) dec.SetValue(val)
dec.SetPrecision(8) 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). (see neo.fs.v2.accounting package in https://github.com/nspcc-dev/neofs-api).
On client side: On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/accounting" import "github.com/nspcc-dev/neofs-api-go/v2/accounting"
var msg accounting.Decimal var msg accounting.Decimal
@ -19,6 +21,7 @@ On client side:
// send msg // send msg
On server side: On server side:
// recv msg // recv msg
var dec accounting.Decimal var dec accounting.Decimal
@ -28,6 +31,5 @@ On server side:
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package accounting 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. 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.: 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" import accountingtest "github.com/nspcc-dev/neofs-sdk-go/accounting/test"
dec := accountingtest.Decimal() dec := accountingtest.Decimal()
// test the value // test the value
*/ */
package accountingtest package accountingtest

View file

@ -2,6 +2,7 @@
Package audit provides features to process data audit in NeoFS system. Package audit provides features to process data audit in NeoFS system.
Result type groups values which can be gathered during data audit process: Result type groups values which can be gathered during data audit process:
var res audit.Result var res audit.Result
res.ForEpoch(32) res.ForEpoch(32)
res.ForContainer(cnr) res.ForContainer(cnr)
@ -9,16 +10,17 @@ Result type groups values which can be gathered during data audit process:
res.Complete() res.Complete()
Result instances can be stored in a binary format. On reporter side: Result instances can be stored in a binary format. On reporter side:
data := res.Marshal() data := res.Marshal()
// send data // send data
On receiver side: On receiver side:
var res audit.Result var res audit.Result
err := res.Unmarshal(data) err := res.Unmarshal(data)
// ... // ...
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package audit 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. 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.: 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" import audittest "github.com/nspcc-dev/neofs-sdk-go/audit/test"
dec := audittest.Result() dec := audittest.Result()
// test the value // test the value
*/ */
package audittest 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 Define bearer token by setting correct lifetime, extended ACL and owner ID of
the user that will attach token to its requests. the user that will attach token to its requests.
var bearerToken bearer.Token var bearerToken bearer.Token
bearerToken.SetExpiration(500) bearerToken.SetExpiration(500)
bearerToken.SetIssuedAt(10) bearerToken.SetIssuedAt(10)
@ -15,10 +16,12 @@ the user that will attach token to its requests.
bearerToken.SetOwner(ownerID) bearerToken.SetOwner(ownerID)
Bearer token must be signed by owner of the container. Bearer token must be signed by owner of the container.
err := bearerToken.Sign(privateKey) err := bearerToken.Sign(privateKey)
Provide signed token in JSON or binary format to the request sender. Request Provide signed token in JSON or binary format to the request sender. Request
sender can attach this bearer token to the object service requests: sender can attach this bearer token to the object service requests:
import sdkClient "github.com/nspcc-dev/neofs-sdk-go/client" import sdkClient "github.com/nspcc-dev/neofs-sdk-go/client"
var headParams sdkClient.PrmObjectHead var headParams sdkClient.PrmObjectHead

View file

@ -18,6 +18,7 @@ import (
// Instances can be created using built-in var declaration. // Instances can be created using built-in var declaration.
// //
// Note that direct typecast is not safe and may result in loss of compatibility: // 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 Checksum refs.Checksum
@ -106,8 +107,8 @@ func (c *Checksum) SetSHA256(v [sha256.Size]byte) {
// to the passed checksum. Checksum must not be nil. // to the passed checksum. Checksum must not be nil.
// //
// Does nothing if the passed type is not one of the: // Does nothing if the passed type is not one of the:
// * SHA256; // - SHA256;
// * TZ. // - TZ.
// //
// Does not mutate the passed value. // 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. Checksum is a basic type of data checksums.
For example, calculating checksums: For example, calculating checksums:
// retrieving any payload for hashing // retrieving any payload for hashing
var sha256Sum Checksum var sha256Sum Checksum
@ -13,6 +14,5 @@ For example, calculating checksums:
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package checksum 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. 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.: 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" import checksumtest "github.com/nspcc-dev/neofs-sdk-go/checksum/test"
cs := checksumtest.Checksum() cs := checksumtest.Checksum()
// test the value // test the value
*/ */
package checksumtest package checksumtest

View file

@ -155,9 +155,11 @@ type PrmDial struct {
// Required parameter. // Required parameter.
// //
// Format of the URI: // Format of the URI:
//
// [scheme://]host:port // [scheme://]host:port
// //
// Supported schemes: // Supported schemes:
//
// grpc // grpc
// grpcs // grpcs
// //

View file

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

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. and provides methods for executing operations on the server.
Create client instance: Create client instance:
var c client.Client var c client.Client
Initialize client state: Initialize client state:
var prm client.PrmInit var prm client.PrmInit
prm.SetDefaultPrivateKey(key) prm.SetDefaultPrivateKey(key)
// ... // ...
@ -15,6 +17,7 @@ Initialize client state:
c.Init(prm) c.Init(prm)
Connect to the NeoFS server: Connect to the NeoFS server:
var prm client.PrmDial var prm client.PrmDial
prm.SetServerURI("localhost:8080") prm.SetServerURI("localhost:8080")
prm.SetDefaultPrivateKey(key) prm.SetDefaultPrivateKey(key)
@ -24,6 +27,7 @@ Connect to the NeoFS server:
// ... // ...
Execute NeoFS operation on the server: Execute NeoFS operation on the server:
var prm client.PrmContainerPut var prm client.PrmContainerPut
prm.SetContainer(cnr) prm.SetContainer(cnr)
// ... // ...
@ -36,6 +40,7 @@ Execute NeoFS operation on the server:
// ... // ...
Consume custom service of the server: Consume custom service of the server:
syntax = "proto3"; syntax = "proto3";
service CustomService { service CustomService {
@ -58,6 +63,7 @@ Consume custom service of the server:
// ... // ...
Close the connection: Close the connection:
err := c.Close() 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 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 read-only. To be able to override client behavior (e.g. for tests), abstract it
with an interface: with an interface:
import "github.com/nspcc-dev/neofs-sdk-go/client" import "github.com/nspcc-dev/neofs-sdk-go/client"
type NeoFSClient interface { type NeoFSClient interface {
@ -80,6 +87,5 @@ with an interface:
func (x *client) CreateContainer(context.Context, container.Container) error { func (x *client) CreateContainer(context.Context, container.Container) error {
// ... // ...
} }
*/ */
package client package client

View file

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

View file

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

View file

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

View file

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

View file

@ -3,8 +3,8 @@ package apistatus
// Status defines a variety of NeoFS API status returns. // Status defines a variety of NeoFS API status returns.
// //
// All statuses are split into two disjoint subsets: successful and failed, and: // All statuses are split into two disjoint subsets: successful and failed, and:
// * statuses that implement the build-in error interface are considered failed statuses; // - statuses that implement the build-in error interface are considered failed statuses;
// * all other value types are considered successes (nil is a default success). // - 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. // 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. // 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. // ToStatusV2 implements StatusV2 interface method.
// If the value was returned by FromStatusV2, returns the source message. // If the value was returned by FromStatusV2, returns the source message.
// Otherwise, returns message with // Otherwise, returns message with
// * code: OK; // - code: OK;
// * string message: empty; // - string message: empty;
// * details: empty. // - details: empty.
func (x SuccessDefaultV2) ToStatusV2() *status.Status { func (x SuccessDefaultV2) ToStatusV2() *status.Status {
if x.isNil || x.v2 != nil { if x.isNil || x.v2 != nil {
return x.v2 return x.v2

View file

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

View file

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

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. 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 Basic provides interface of rule composition. Package acl also exports some frequently used settings like
private or public. private or public.
*/ */
package acl package acl

View file

@ -3,6 +3,7 @@ Package container provides functionality related to the NeoFS containers.
The base type is Container. To create new container in the NeoFS network The base type is Container. To create new container in the NeoFS network
Container instance should be initialized Container instance should be initialized
var cnr Container var cnr Container
cnr.Init() cnr.Init()
// fill all the fields // fill all the fields
@ -11,6 +12,7 @@ Container instance should be initialized
After the container is persisted in the NeoFS network, applications can process After the container is persisted in the NeoFS network, applications can process
it using the instance of Container types it using the instance of Container types
// recv binary container // recv binary container
var cnr Container var cnr Container
@ -24,6 +26,7 @@ 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). (see neo.fs.v2.container package in https://github.com/nspcc-dev/neofs-api).
On client side: On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/container" import "github.com/nspcc-dev/neofs-api-go/v2/container"
var msg container.Container var msg container.Container
@ -32,6 +35,7 @@ On client side:
// send msg // send msg
On server side: On server side:
// recv msg // recv msg
var cnr Container var cnr Container
@ -41,6 +45,5 @@ On server side:
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package container 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 Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package cid package cid

View file

@ -16,6 +16,7 @@ import (
// Instances can be created using built-in var declaration. // Instances can be created using built-in var declaration.
// //
// Note that direct typecast is not safe and may result in loss of compatibility: // 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 type ID [sha256.Size]byte

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. 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.: 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" import cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
cid := cidtest.ID() cid := cidtest.ID()
// test the value // test the value
*/ */
package cidtest package cidtest

View file

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

View file

@ -14,6 +14,7 @@ import (
// message. See ReadFromV2 / WriteToV2 methods. // message. See ReadFromV2 / WriteToV2 methods.
// //
// Note that direct typecast is not safe and may result in loss of compatibility: // 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 type Signature refs.Signature

View file

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

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). (see neo.fs.v2.netmap package in https://github.com/nspcc-dev/neofs-api).
On client side: On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/netmap" import "github.com/nspcc-dev/neofs-api-go/v2/netmap"
var msg netmap.NodeInfo var msg netmap.NodeInfo
@ -26,6 +27,7 @@ On client side:
// send msg // send msg
On server side: On server side:
// recv msg // recv msg
var info NodeInfo var info NodeInfo
@ -37,6 +39,5 @@ On server side:
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package netmap package netmap

View file

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

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 Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package oid package oid

View file

@ -19,6 +19,7 @@ import (
// Instances can be created using built-in var declaration. // Instances can be created using built-in var declaration.
// //
// Note that direct typecast is not safe and may result in loss of compatibility: // 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 type ID [sha256.Size]byte

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. 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.: 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" import oidtest "github.com/nspcc-dev/neofs-sdk-go/object/id/test"
value := oidtest.ID() value := oidtest.ID()
// test the value // test the value
*/ */
package oidtest package oidtest

View file

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

View file

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

View file

@ -24,10 +24,10 @@ func TypeFromV2(t object.Type) Type {
// String returns string representation of Type. // String returns string representation of Type.
// //
// String mapping: // String mapping:
// * TypeTombstone: TOMBSTONE; // - TypeTombstone: TOMBSTONE;
// * TypeStorageGroup: STORAGE_GROUP; // - TypeStorageGroup: STORAGE_GROUP;
// * TypeLock: LOCK; // - TypeLock: LOCK;
// * TypeRegular, default: REGULAR. // - TypeRegular, default: REGULAR.
func (t Type) String() string { func (t Type) String() string {
return t.ToV2().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 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%. 192.168.130.72 for 90% of requests and 192.168.130.73 for remaining 10%.
: :
var prm pool.InitParameters var prm pool.InitParameters
prm.SetKey(key) prm.SetKey(key)
prm.AddNode(NewNodeParam(1, "192.168.130.71", 1)) 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: Connect to the NeoFS server:
err := p.Dial(ctx) err := p.Dial(ctx)
// ... // ...
Execute NeoFS operation on the server: Execute NeoFS operation on the server:
var prm pool.PrmContainerPut var prm pool.PrmContainerPut
prm.SetContainer(cnr) prm.SetContainer(cnr)
// ... // ...
@ -32,6 +35,7 @@ Execute NeoFS operation on the server:
// ... // ...
Execute NeoFS operation on the server and check error: Execute NeoFS operation on the server and check error:
var prm pool.PrmObjectHead var prm pool.PrmObjectHead
prm.SetAddress(addr) prm.SetAddress(addr)
// ... // ...
@ -43,7 +47,7 @@ Execute NeoFS operation on the server and check error:
// ... // ...
Close the connection: Close the connection:
p.Close()
p.Close()
*/ */
package pool package pool

View file

@ -2051,6 +2051,7 @@ 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. // 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: // Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
//
// polling interval: 5s // polling interval: 5s
// waiting timeout: 120s // waiting timeout: 120s
// //
@ -2091,6 +2092,7 @@ 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. // 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: // Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
//
// polling interval: 5s // polling interval: 5s
// waiting timeout: 120s // waiting timeout: 120s
// //
@ -2119,6 +2121,7 @@ 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. // 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: // Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
//
// polling interval: 5s // polling interval: 5s
// waiting timeout: 120s // waiting timeout: 120s
// //

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). (see neo.fs.v2.reputation package in https://github.com/nspcc-dev/neofs-api).
On client side: On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/reputation" import "github.com/nspcc-dev/neofs-api-go/v2/reputation"
var msg reputation.GlobalTrust var msg reputation.GlobalTrust
@ -20,6 +21,7 @@ On client side:
// send trust // send trust
On server side: On server side:
// recv msg // recv msg
var trust reputation.GlobalTrust var trust reputation.GlobalTrust
@ -29,6 +31,5 @@ On server side:
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package reputation 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 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 will be authenticated by a trusted person. The principal confirms his trust by
signing the public part of the secret (public session key). signing the public part of the secret (public session key).
var tok Container var tok Container
tok.ForVerb(VerbContainerDelete) tok.ForVerb(VerbContainerDelete)
tok.SetAuthKey(trustedKey) 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). (see neo.fs.v2.accounting package in https://github.com/nspcc-dev/neofs-api).
On client side: On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/session" import "github.com/nspcc-dev/neofs-api-go/v2/session"
var msg session.Token var msg session.Token
@ -34,6 +36,7 @@ On client side:
// send msg // send msg
On server side: On server side:
// recv msg // recv msg
var tok session.Container var tok session.Container
@ -43,6 +46,5 @@ On server side:
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package session 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. 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.: 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" import sessiontest "github.com/nspcc-dev/neofs-sdk-go/session/test"
val := sessiontest.Container() val := sessiontest.Container()
// test the value // test the value
*/ */
package sessiontest 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. used for proof of storage in NeoFS system.
StorageGroup type groups verification values for Data Audit sessions: StorageGroup type groups verification values for Data Audit sessions:
// receive sg info // receive sg info
sg.ExpirationEpoch() // expiration of the storage group 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). (see neo.fs.v2.storagegroup package in https://github.com/nspcc-dev/neofs-api).
On client side: On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/storagegroup" import "github.com/nspcc-dev/neofs-api-go/v2/storagegroup"
var msg storagegroup.StorageGroup var msg storagegroup.StorageGroup
@ -22,6 +24,7 @@ On client side:
// send msg // send msg
On server side: On server side:
// recv msg // recv msg
var sg StorageGroupDecimal var sg StorageGroupDecimal
@ -31,6 +34,5 @@ On server side:
Using package types in an application is recommended to potentially work with Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package storagegroup package storagegroup

View file

@ -21,6 +21,7 @@ import (
// Instances can be created using built-in var declaration. // Instances can be created using built-in var declaration.
// //
// Note that direct typecast is not safe and may result in loss of compatibility: // 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 type StorageGroup storagegroup.StorageGroup
@ -289,9 +290,9 @@ func ReadFromObject(sg *StorageGroup, o objectSDK.Object) error {
// have it at all. // have it at all.
// //
// Written information: // Written information:
// * expiration epoch; // - expiration epoch;
// * object type (TypeStorageGroup); // - object type (TypeStorageGroup);
// * raw payload. // - raw payload.
func WriteToObject(sg StorageGroup, o *objectSDK.Object) { func WriteToObject(sg StorageGroup, o *objectSDK.Object) {
sgRaw, err := sg.Marshal() sgRaw, err := sg.Marshal()
if err != nil { 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. 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.: 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" import storagegrouptest "github.com/nspcc-dev/neofs-sdk-go/storagegroup/test"
val := storagegrouptest.StorageGroup() val := storagegrouptest.StorageGroup()
// test the value // test the value
*/ */
package storagegrouptest 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 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 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. about all subnets is stored in the Subnet contract of the NeoFS Sidechain.
*/ */
package subnet 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 Using package types in an application is recommended to potentially work with
different protocol versions with which these types are compatible. different protocol versions with which these types are compatible.
*/ */
package subnetid 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. 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.: 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" import subnetidtest "github.com/nspcc-dev/neofs-sdk-go/suibnet/id/test"
value := subnetidtest.ID() value := subnetidtest.ID()
// test the value // test the value
*/ */
package subnetidtest 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. 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.: 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" import subnettest "github.com/nspcc-dev/neofs-sdk-go/suibnet/test"
value := subnettest.Info() value := subnettest.Info()
// test the value // test the value
*/ */
package subnettest 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. within the same network.
NeoFS user identification is compatible with Neo accounts: 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/keys"
import "github.com/nspcc-dev/neo-go/pkg/crypto/hash" 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) user.IDFromKey(&id, k.PrivateKey.PublicKey)
ID is compatible with the NeoFS Smart Contract API: ID is compatible with the NeoFS Smart Contract API:
var id user.ID var id user.ID
// ... // ...
@ -25,6 +27,7 @@ ID is compatible with the NeoFS Smart Contract API:
// use wallet in call // use wallet in call
Encoding/decoding mechanisms are used to transfer identifiers: Encoding/decoding mechanisms are used to transfer identifiers:
var id user.ID 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). (see neo.fs.v2.refs package in https://github.com/nspcc-dev/neofs-api).
On client side: On client side:
import "github.com/nspcc-dev/neofs-api-go/v2/refs" import "github.com/nspcc-dev/neofs-api-go/v2/refs"
var msg refs.OwnerID var msg refs.OwnerID
@ -43,6 +47,7 @@ On client side:
// send msg // send msg
On server side: On server side:
// recv msg // recv msg
var id user.ID 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. 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.: 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" import usertest "github.com/nspcc-dev/neofs-sdk-go/user/test"
id := usertest.ID() id := usertest.ID()
// test the value // test the value
*/ */
package usertest 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 In most of the cases it will be enough to use the latest supported NeoFS API
version in SDK: version in SDK:
ver := version.Current() ver := version.Current()
It is possible to specify arbitrary version by setting major and minor numbers: It is possible to specify arbitrary version by setting major and minor numbers:
var ver version.Version var ver version.Version
ver.SetMajor(2) ver.SetMajor(2)
ver.SetMinor(5) ver.SetMinor(5)

View file

@ -14,6 +14,7 @@ import (
// Instances can be created using built-in var declaration. // Instances can be created using built-in var declaration.
// //
// Note that direct typecast is not safe and may result in loss of compatibility: // 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 type Version refs.Version