diff --git a/accounting/decimal.go b/accounting/decimal.go index 7a4eaeb..da9281f 100644 --- a/accounting/decimal.go +++ b/accounting/decimal.go @@ -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 diff --git a/accounting/doc.go b/accounting/doc.go index 1f18a00..f1a3037 100644 --- a/accounting/doc.go +++ b/accounting/doc.go @@ -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 diff --git a/accounting/test/doc.go b/accounting/test/doc.go index bdabe46..b2619ea 100644 --- a/accounting/test/doc.go +++ b/accounting/test/doc.go @@ -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 diff --git a/audit/doc.go b/audit/doc.go index e671c59..a41f88d 100644 --- a/audit/doc.go +++ b/audit/doc.go @@ -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 diff --git a/audit/test/doc.go b/audit/test/doc.go index 9d71d19..e999409 100644 --- a/audit/test/doc.go +++ b/audit/test/doc.go @@ -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 diff --git a/bearer/doc.go b/bearer/doc.go index 3888dbe..52436eb 100644 --- a/bearer/doc.go +++ b/bearer/doc.go @@ -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 diff --git a/checksum/checksum.go b/checksum/checksum.go index 59a0711..5d69c70 100644 --- a/checksum/checksum.go +++ b/checksum/checksum.go @@ -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. // diff --git a/checksum/doc.go b/checksum/doc.go index 1acac9f..859d67f 100644 --- a/checksum/doc.go +++ b/checksum/doc.go @@ -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 diff --git a/checksum/test/doc.go b/checksum/test/doc.go index bb75038..ad428ec 100644 --- a/checksum/test/doc.go +++ b/checksum/test/doc.go @@ -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 diff --git a/client/accounting.go b/client/accounting.go index a86a0ac..b77d8e2 100644 --- a/client/accounting.go +++ b/client/accounting.go @@ -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: diff --git a/client/client.go b/client/client.go index 89684ce..655fa93 100644 --- a/client/client.go +++ b/client/client.go @@ -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) { diff --git a/client/common.go b/client/common.go index 4ec59f8..fbcaac3 100644 --- a/client/common.go +++ b/client/common.go @@ -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 { diff --git a/client/container.go b/client/container.go index 8ce53ee..f1e21c2 100644 --- a/client/container.go +++ b/client/container.go @@ -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 { diff --git a/client/doc.go b/client/doc.go index b6e7ccc..35a3a07 100644 --- a/client/doc.go +++ b/client/doc.go @@ -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 diff --git a/client/netmap.go b/client/netmap.go index 13ef045..5bee411 100644 --- a/client/netmap.go +++ b/client/netmap.go @@ -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 { diff --git a/client/object_get.go b/client/object_get.go index 29844bb..0bf0729 100644 --- a/client/object_get.go +++ b/client/object_get.go @@ -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); diff --git a/client/reputation.go b/client/reputation.go index a37a1e2..16a4714 100644 --- a/client/reputation.go +++ b/client/reputation.go @@ -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 { diff --git a/client/session.go b/client/session.go index 754a7be..f90c10b 100644 --- a/client/session.go +++ b/client/session.go @@ -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 { diff --git a/client/status/common.go b/client/status/common.go index 8fec31e..58c2540 100644 --- a/client/status/common.go +++ b/client/status/common.go @@ -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)) diff --git a/client/status/container.go b/client/status/container.go index 9501cf5..f7f6437 100644 --- a/client/status/container.go +++ b/client/status/container.go @@ -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") diff --git a/client/status/object.go b/client/status/object.go index a7c0b91..9e8c32b 100644 --- a/client/status/object.go +++ b/client/status/object.go @@ -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") diff --git a/client/status/session.go b/client/status/session.go index 102b512..da40bd7 100644 --- a/client/status/session.go +++ b/client/status/session.go @@ -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") diff --git a/client/status/status.go b/client/status/status.go index e5facd0..78f5c0f 100644 --- a/client/status/status.go +++ b/client/status/status.go @@ -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. diff --git a/client/status/success.go b/client/status/success.go index 83e5fc9..bd9ee82 100644 --- a/client/status/success.go +++ b/client/status/success.go @@ -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 diff --git a/client/status/v2.go b/client/status/v2.go index 29376ff..d9bc019 100644 --- a/client/status/v2.go +++ b/client/status/v2.go @@ -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) diff --git a/container/acl/acl_basic.go b/container/acl/acl_basic.go index 8197a9d..e1ee3ef 100644 --- a/container/acl/acl_basic.go +++ b/container/acl/acl_basic.go @@ -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. diff --git a/container/acl/doc.go b/container/acl/doc.go index 568f31a..3bf14d3 100644 --- a/container/acl/doc.go +++ b/container/acl/doc.go @@ -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 diff --git a/container/doc.go b/container/doc.go index 79646a0..e333d48 100644 --- a/container/doc.go +++ b/container/doc.go @@ -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 diff --git a/container/id/doc.go b/container/id/doc.go index e0141b9..a1597fc 100644 --- a/container/id/doc.go +++ b/container/id/doc.go @@ -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 diff --git a/container/id/id.go b/container/id/id.go index cdbddce..bf39511 100644 --- a/container/id/id.go +++ b/container/id/id.go @@ -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. diff --git a/container/id/test/doc.go b/container/id/test/doc.go index f2d4d32..14857d0 100644 --- a/container/id/test/doc.go +++ b/container/id/test/doc.go @@ -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 diff --git a/crypto/doc.go b/crypto/doc.go index b3566f0..fe97a31 100644 --- a/crypto/doc.go +++ b/crypto/doc.go @@ -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 diff --git a/crypto/ecdsa/doc.go b/crypto/ecdsa/doc.go index c2fccc5..09d03ee 100644 --- a/crypto/ecdsa/doc.go +++ b/crypto/ecdsa/doc.go @@ -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 diff --git a/crypto/signature.go b/crypto/signature.go index bb21867..af5a769 100644 --- a/crypto/signature.go +++ b/crypto/signature.go @@ -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 diff --git a/eacl/enums.go b/eacl/enums.go index 8046ba7..17c9623 100644 --- a/eacl/enums.go +++ b/eacl/enums.go @@ -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() } diff --git a/eacl/filter.go b/eacl/filter.go index 0a32ba5..778b042 100644 --- a/eacl/filter.go +++ b/eacl/filter.go @@ -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)) } diff --git a/eacl/record.go b/eacl/record.go index 9b5e13c..806c79d 100644 --- a/eacl/record.go +++ b/eacl/record.go @@ -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) } diff --git a/eacl/table.go b/eacl/table.go index a17d78a..68eda7a 100644 --- a/eacl/table.go +++ b/eacl/table.go @@ -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()) diff --git a/eacl/target.go b/eacl/target.go index 768bbdc..537e33a 100644 --- a/eacl/target.go +++ b/eacl/target.go @@ -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)) } diff --git a/eacl/validator.go b/eacl/validator.go index d176626..dd313bb 100644 --- a/eacl/validator.go +++ b/eacl/validator.go @@ -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 diff --git a/netmap/doc.go b/netmap/doc.go index 464dbf1..931e874 100644 --- a/netmap/doc.go +++ b/netmap/doc.go @@ -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 diff --git a/ns/doc.go b/ns/doc.go index 3e00856..c469c5c 100644 --- a/ns/doc.go +++ b/ns/doc.go @@ -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 diff --git a/object/attribute.go b/object/attribute.go index 0e4ac9e..7c74cb9 100644 --- a/object/attribute.go +++ b/object/attribute.go @@ -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)) } diff --git a/object/id/doc.go b/object/id/doc.go index 0117742..00da20b 100644 --- a/object/id/doc.go +++ b/object/id/doc.go @@ -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 diff --git a/object/id/id.go b/object/id/id.go index 7df4e4f..a7edb8c 100644 --- a/object/id/id.go +++ b/object/id/id.go @@ -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 diff --git a/object/id/test/doc.go b/object/id/test/doc.go index 4aad5e7..1b7c40e 100644 --- a/object/id/test/doc.go +++ b/object/id/test/doc.go @@ -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 diff --git a/object/object.go b/object/object.go index 0475ded..b57afdc 100644 --- a/object/object.go +++ b/object/object.go @@ -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 diff --git a/object/range.go b/object/range.go index 1c50ca1..ea2238b 100644 --- a/object/range.go +++ b/object/range.go @@ -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)) } diff --git a/object/search.go b/object/search.go index f0da590..2174a29 100644 --- a/object/search.go +++ b/object/search.go @@ -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() } diff --git a/object/splitid.go b/object/splitid.go index 84288f2..45b4a47 100644 --- a/object/splitid.go +++ b/object/splitid.go @@ -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(), diff --git a/object/splitinfo.go b/object/splitinfo.go index 4e9039d..e15cee5 100644 --- a/object/splitinfo.go +++ b/object/splitinfo.go @@ -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)) } diff --git a/object/tombstone.go b/object/tombstone.go index f7ff3d5..0614910 100644 --- a/object/tombstone.go +++ b/object/tombstone.go @@ -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)) } diff --git a/object/type.go b/object/type.go index ba6dde4..f87d108 100644 --- a/object/type.go +++ b/object/type.go @@ -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() } diff --git a/pool/doc.go b/pool/doc.go index f209377..b7d54eb 100644 --- a/pool/doc.go +++ b/pool/doc.go @@ -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 diff --git a/pool/pool.go b/pool/pool.go index f8be9dc..b5099ac 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -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 { diff --git a/reputation/doc.go b/reputation/doc.go index b4ce2d6..7e59ace 100644 --- a/reputation/doc.go +++ b/reputation/doc.go @@ -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 diff --git a/session/doc.go b/session/doc.go index a954bde..29b8420 100644 --- a/session/doc.go +++ b/session/doc.go @@ -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 diff --git a/session/test/doc.go b/session/test/doc.go index 9038ff1..4279ff3 100644 --- a/session/test/doc.go +++ b/session/test/doc.go @@ -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 diff --git a/storagegroup/doc.go b/storagegroup/doc.go index 207a9a7..cf478b8 100644 --- a/storagegroup/doc.go +++ b/storagegroup/doc.go @@ -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 diff --git a/storagegroup/storagegroup.go b/storagegroup/storagegroup.go index 76bce38..94bc2f7 100644 --- a/storagegroup/storagegroup.go +++ b/storagegroup/storagegroup.go @@ -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 { diff --git a/storagegroup/test/doc.go b/storagegroup/test/doc.go index 5cfb6cb..9d3d015 100644 --- a/storagegroup/test/doc.go +++ b/storagegroup/test/doc.go @@ -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 diff --git a/subnet/doc.go b/subnet/doc.go index f68816f..f434fba 100644 --- a/subnet/doc.go +++ b/subnet/doc.go @@ -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 diff --git a/subnet/id/doc.go b/subnet/id/doc.go index e8ee2cb..508a2a7 100644 --- a/subnet/id/doc.go +++ b/subnet/id/doc.go @@ -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 diff --git a/subnet/id/test/doc.go b/subnet/id/test/doc.go index 409f2b2..72dd20c 100644 --- a/subnet/id/test/doc.go +++ b/subnet/id/test/doc.go @@ -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 diff --git a/subnet/test/doc.go b/subnet/test/doc.go index e74db82..4315696 100644 --- a/subnet/test/doc.go +++ b/subnet/test/doc.go @@ -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 diff --git a/user/doc.go b/user/doc.go index 800677d..dab0121 100644 --- a/user/doc.go +++ b/user/doc.go @@ -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 diff --git a/user/test/doc.go b/user/test/doc.go index 9584719..367264a 100644 --- a/user/test/doc.go +++ b/user/test/doc.go @@ -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 diff --git a/version/doc.go b/version/doc.go index bd1ca8e..e5e90f9 100644 --- a/version/doc.go +++ b/version/doc.go @@ -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) diff --git a/version/version.go b/version/version.go index 296e9df..0a05fcc 100644 --- a/version/version.go +++ b/version/version.go @@ -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