forked from TrueCloudLab/frostfs-sdk-go
[#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:
parent
7537fa0dec
commit
84888854ab
69 changed files with 272 additions and 219 deletions
|
@ -10,6 +10,7 @@ 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
|
||||
type Decimal accounting.Decimal
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,6 +18,7 @@ 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
|
||||
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.
|
||||
//
|
||||
// Does nothing if the passed type is not one of the:
|
||||
// * SHA256;
|
||||
// * TZ.
|
||||
// - SHA256;
|
||||
// - TZ.
|
||||
//
|
||||
// Does not mutate the passed value.
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -155,9 +155,11 @@ type PrmDial struct {
|
|||
// Required parameter.
|
||||
//
|
||||
// Format of the URI:
|
||||
//
|
||||
// [scheme://]host:port
|
||||
//
|
||||
// Supported schemes:
|
||||
//
|
||||
// grpc
|
||||
// grpcs
|
||||
//
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -268,6 +268,7 @@ func (x *ObjectReader) close(ignoreEOF bool) (*ResObjectGet, error) {
|
|||
// codes are returned as error.
|
||||
//
|
||||
// Return errors:
|
||||
//
|
||||
// *object.SplitInfoError (returned on virtual objects with PrmObjectGet.MakeRaw).
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Return errors:
|
||||
//
|
||||
// *object.SplitInfoError (returned on virtual objects with PrmObjectHead.MakeRaw).
|
||||
//
|
||||
// Return statuses:
|
||||
|
@ -676,6 +678,7 @@ func (x *ObjectRangeReader) close(ignoreEOF bool) (*ResObjectRange, error) {
|
|||
// codes are returned as error.
|
||||
//
|
||||
// Return errors:
|
||||
//
|
||||
// *object.SplitInfoError (returned on virtual objects with PrmObjectRange.MakeRaw).
|
||||
//
|
||||
// Return statuses:
|
||||
|
|
|
@ -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
|
||||
// - code: SIGNATURE_VERIFICATION_FAIL;
|
||||
// - string message: written message via SetMessage or
|
||||
// "signature verification failed" as a default message;
|
||||
// * details: empty.
|
||||
// - details: empty.
|
||||
func (x SignatureVerification) ToStatusV2() *status.Status {
|
||||
x.v2.SetCode(globalizeCodeV2(status.SignatureVerificationFail, status.GlobalizeCommonFail))
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
//
|
||||
// However, these similarities should only be used for better understanding,
|
||||
// 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.
|
||||
// Op MUST be one of the Op enumeration. Role MUST be one of:
|
||||
//
|
||||
// RoleOwner
|
||||
// RoleContainer
|
||||
// RoleOthers
|
||||
//
|
||||
// and if role is RoleContainer, op MUST NOT be:
|
||||
//
|
||||
// OpObjectGet
|
||||
// OpObjectHead
|
||||
// OpObjectPut
|
||||
|
@ -146,6 +151,7 @@ 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
|
||||
|
@ -153,6 +159,7 @@ func (x *Basic) AllowOp(op Op, role Role) {
|
|||
// OpObjectHash
|
||||
//
|
||||
// RoleInnerRing members are allowed to data audit ops only:
|
||||
//
|
||||
// OpObjectGet
|
||||
// OpObjectHead
|
||||
// OpObjectHash
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
Container instance should be initialized
|
||||
|
||||
var cnr Container
|
||||
cnr.Init()
|
||||
// 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
|
||||
it using the instance of Container types
|
||||
|
||||
// recv binary 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).
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,6 +16,7 @@ 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
|
||||
type ID [sha256.Size]byte
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,6 +14,7 @@ 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
|
||||
type Signature refs.Signature
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,6 +19,7 @@ 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
|
||||
type ID [sha256.Size]byte
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
||||
//
|
||||
// polling interval: 5s
|
||||
// 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.
|
||||
//
|
||||
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
||||
//
|
||||
// polling interval: 5s
|
||||
// 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.
|
||||
//
|
||||
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
||||
//
|
||||
// polling interval: 5s
|
||||
// waiting timeout: 120s
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,6 +21,7 @@ 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
|
||||
type StorageGroup storagegroup.StorageGroup
|
||||
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -14,6 +14,7 @@ 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
|
||||
type Version refs.Version
|
||||
|
||||
|
|
Loading…
Reference in a new issue