Update dependencies, rename NeoFS to FrostFS in comments #4
84 changed files with 455 additions and 454 deletions
28
README.md
28
README.md
|
@ -1,5 +1,5 @@
|
||||||
# frostfs-sdk-go
|
# frostfs-sdk-go
|
||||||
Go implementation of NeoFS SDK. It contains high-level version-independent wrappers
|
Go implementation of FrostFS SDK. It contains high-level version-independent wrappers
|
||||||
for structures from [frostfs-api-go](https://github.com/TrueCloudLab/frostfs-api-go) as well as
|
for structures from [frostfs-api-go](https://github.com/TrueCloudLab/frostfs-api-go) as well as
|
||||||
helper functions for simplifying node/dApp implementations.
|
helper functions for simplifying node/dApp implementations.
|
||||||
|
|
||||||
|
@ -10,39 +10,39 @@ Contains fixed-point `Decimal` type for performing balance calculations.
|
||||||
|
|
||||||
### eacl
|
### eacl
|
||||||
Contains Extended ACL types for fine-grained access control.
|
Contains Extended ACL types for fine-grained access control.
|
||||||
There is also a reference implementation of checking algorithm which is used in NeoFS node.
|
There is also a reference implementation of checking algorithm which is used in FrostFS node.
|
||||||
|
|
||||||
### checksum
|
### checksum
|
||||||
Contains `Checksum` type encapsulating checksum as well as it's kind.
|
Contains `Checksum` type encapsulating checksum as well as it's kind.
|
||||||
Currently Sha256 and [Tillich-Zemor hashsum](https://github.com/TrueCloudLab/tzhash) are in use.
|
Currently Sha256 and [Tillich-Zemor hashsum](https://github.com/TrueCloudLab/tzhash) are in use.
|
||||||
|
|
||||||
### owner
|
### owner
|
||||||
`owner.ID` type represents single account interacting with NeoFS. In v2 version of protocol
|
`owner.ID` type represents single account interacting with FrostFS. In v2 version of protocol
|
||||||
it is just raw bytes behing [base58-encoded address](https://docs.neo.org/docs/en-us/basic/concept/wallets.html#address)
|
it is just raw bytes behing [base58-encoded address](https://docs.neo.org/docs/en-us/basic/concept/wallets.html#address)
|
||||||
in Neo blockchain. Note that for historical reasons it contains
|
in Neo blockchain. Note that for historical reasons it contains
|
||||||
version prefix and checksum in addition to script-hash.
|
version prefix and checksum in addition to script-hash.
|
||||||
|
|
||||||
### token
|
### token
|
||||||
Contains Bearer token type with several NeoFS-specific methods.
|
Contains Bearer token type with several FrostFS-specific methods.
|
||||||
|
|
||||||
### ns
|
### ns
|
||||||
In NeoFS there are 2 types of name resolution: DNS and NNS. NNS stands for Neo Name Service
|
In FrostFS there are 2 types of name resolution: DNS and NNS. NNS stands for Neo Name Service
|
||||||
is just a [contract](https://github.com/TrueCloudLab/frostfs-contract) deployed on a Neo blockchain.
|
is just a [contract](https://github.com/TrueCloudLab/frostfs-contract) deployed on a Neo blockchain.
|
||||||
Basically, NNS is just a DNS-on-chain which can be used for resolving container nice-names as well
|
Basically, NNS is just a DNS-on-chain which can be used for resolving container nice-names as well
|
||||||
as any other name in dApps. See our [CoreDNS plugin](https://github.com/nspcc-dev/coredns/tree/master/plugin/nns)
|
as any other name in dApps. See our [CoreDNS plugin](https://github.com/nspcc-dev/coredns/tree/master/plugin/nns)
|
||||||
for the example of how NNS can be integrated in DNS.
|
for the example of how NNS can be integrated in DNS.
|
||||||
|
|
||||||
### session
|
### session
|
||||||
To help lightweight clients interact with NeoFS without sacrificing trust, NeoFS has a concept
|
To help lightweight clients interact with FrostFS without sacrificing trust, FrostFS has a concept
|
||||||
of session token. It is signed by client and allows any node with which a session is established
|
of session token. It is signed by client and allows any node with which a session is established
|
||||||
to perform certain actions on behalf of the user.
|
to perform certain actions on behalf of the user.
|
||||||
|
|
||||||
### client
|
### client
|
||||||
Contains client for working with NeoFS.
|
Contains client for working with FrostFS.
|
||||||
```go
|
```go
|
||||||
var prmInit client.PrmInit
|
var prmInit client.PrmInit
|
||||||
prmInit.SetDefaultPrivateKey(key) // private key for request signing
|
prmInit.SetDefaultPrivateKey(key) // private key for request signing
|
||||||
prmInit.ResolveNeoFSFailures() // enable erroneous status parsing
|
prmInit.ResolveFrostFSFailures() // enable erroneous status parsing
|
||||||
|
|
||||||
var c client.Client
|
var c client.Client
|
||||||
c.Init(prmInit)
|
c.Init(prmInit)
|
||||||
|
@ -70,15 +70,15 @@ fmt.Printf("Balance for %s: %v\n", acc, res.Amount())
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Response status
|
#### Response status
|
||||||
In NeoFS every operation can fail on multiple levels, so a single `error` doesn't suffice,
|
In FrostFS every operation can fail on multiple levels, so a single `error` doesn't suffice,
|
||||||
e.g. consider a case when object was put on 4 out of 5 replicas. Thus, all request execution
|
e.g. consider a case when object was put on 4 out of 5 replicas. Thus, all request execution
|
||||||
details are contained in `Status` returned from every RPC call. dApp can inspect them
|
details are contained in `Status` returned from every RPC call. dApp can inspect them
|
||||||
if needed and perform any desired action. In the case above we may want to report
|
if needed and perform any desired action. In the case above we may want to report
|
||||||
these details to the user as well as retry an operation, possibly with different parameters.
|
these details to the user as well as retry an operation, possibly with different parameters.
|
||||||
Status wire-format is extendable and each node can report any set of details it wants.
|
Status wire-format is extendable and each node can report any set of details it wants.
|
||||||
The set of reserved status codes can be found in
|
The set of reserved status codes can be found in
|
||||||
[NeoFS API](https://github.com/TrueCloudLab/frostfs-api/blob/master/status/types.proto). There is also
|
[FrostFS API](https://github.com/TrueCloudLab/frostfs-api/blob/master/status/types.proto). There is also
|
||||||
a `client.PrmInit.ResolveNeoFSFailures()` to seamlessly convert erroneous statuses into Go error type.
|
a `client.PrmInit.ResolveFrostFSFailures()` to seamlessly convert erroneous statuses into Go error type.
|
||||||
|
|
||||||
### policy
|
### policy
|
||||||
Contains helpers allowing conversion of placing policy from/to JSON representation
|
Contains helpers allowing conversion of placing policy from/to JSON representation
|
||||||
|
@ -107,7 +107,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func placementNodes(addr *object.Address, p *netmap.PlacementPolicy, frostfsNodes []netmap.NodeInfo) {
|
func placementNodes(addr *object.Address, p *netmap.PlacementPolicy, frostfsNodes []netmap.NodeInfo) {
|
||||||
// Convert list of nodes in NeoFS API format to the intermediate representation.
|
// Convert list of nodes in FrostFS API format to the intermediate representation.
|
||||||
nodes := netmap.NodesFromInfo(nodes)
|
nodes := netmap.NodesFromInfo(nodes)
|
||||||
|
|
||||||
// Create new netmap (errors are skipped for the sake of clarity).
|
// Create new netmap (errors are skipped for the sake of clarity).
|
||||||
|
@ -122,13 +122,13 @@ func placementNodes(addr *object.Address, p *netmap.PlacementPolicy, frostfsNode
|
||||||
```
|
```
|
||||||
|
|
||||||
### pool
|
### pool
|
||||||
Simple pool for managing connections to NeoFS nodes.
|
Simple pool for managing connections to FrostFS nodes.
|
||||||
|
|
||||||
### acl, checksum, version, signature
|
### acl, checksum, version, signature
|
||||||
Contain simple API wrappers.
|
Contain simple API wrappers.
|
||||||
|
|
||||||
### logger
|
### logger
|
||||||
Wrapper over `zap.Logger` which is used across NeoFS codebase.
|
Wrapper over `zap.Logger` which is used across FrostFS codebase.
|
||||||
|
|
||||||
### util
|
### util
|
||||||
Utilities for working with signature-related code.
|
Utilities for working with signature-related code.
|
|
@ -15,7 +15,7 @@ import "github.com/TrueCloudLab/frostfs-api-go/v2/accounting"
|
||||||
type Decimal accounting.Decimal
|
type Decimal accounting.Decimal
|
||||||
|
|
||||||
// ReadFromV2 reads Decimal from the accounting.Decimal message. Checks if the
|
// ReadFromV2 reads Decimal from the accounting.Decimal message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (d *Decimal) ReadFromV2(m accounting.Decimal) error {
|
func (d *Decimal) ReadFromV2(m accounting.Decimal) error {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package accounting provides primitives to perform accounting operations in NeoFS.
|
Package accounting provides primitives to perform accounting operations in FrostFS.
|
||||||
|
|
||||||
Decimal type provides functionality to process user balances. For example, when
|
Decimal type provides functionality to process user balances. For example, when
|
||||||
working with Fixed8 balance precision:
|
working with Fixed8 balance precision:
|
||||||
|
@ -8,7 +8,7 @@ working with Fixed8 balance precision:
|
||||||
dec.SetValue(val)
|
dec.SetValue(val)
|
||||||
dec.SetPrecision(8)
|
dec.SetPrecision(8)
|
||||||
|
|
||||||
Instances can be also used to process NeoFS API V2 protocol messages
|
Instances can be also used to process FrostFS API V2 protocol messages
|
||||||
(see neo.fs.v2.accounting package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.accounting package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package audit provides features to process data audit in NeoFS system.
|
Package audit provides features to process data audit in FrostFS system.
|
||||||
|
|
||||||
Result type groups values which can be gathered during data audit process:
|
Result type groups values which can be gathered during data audit process:
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/version"
|
"github.com/TrueCloudLab/frostfs-sdk-go/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Result represents report on the results of the data audit in NeoFS system.
|
// Result represents report on the results of the data audit in FrostFS system.
|
||||||
//
|
//
|
||||||
// Result is mutually binary-compatible with github.com/TrueCloudLab/frostfs-api-go/v2/audit.DataAuditResult
|
// Result is mutually binary-compatible with github.com/TrueCloudLab/frostfs-api-go/v2/audit.DataAuditResult
|
||||||
// message. See Marshal / Unmarshal methods.
|
// message. See Marshal / Unmarshal methods.
|
||||||
|
@ -23,7 +23,7 @@ type Result struct {
|
||||||
v2 audit.DataAuditResult
|
v2 audit.DataAuditResult
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes Result into a canonical NeoFS binary format (Protocol Buffers
|
// Marshal encodes Result into a canonical FrostFS binary format (Protocol Buffers
|
||||||
// with direct field order).
|
// with direct field order).
|
||||||
//
|
//
|
||||||
// Writes version.Current() protocol version into the resulting message if Result
|
// Writes version.Current() protocol version into the resulting message if Result
|
||||||
|
@ -43,7 +43,7 @@ func (r *Result) Marshal() []byte {
|
||||||
|
|
||||||
var errCIDNotSet = errors.New("container ID is not set")
|
var errCIDNotSet = errors.New("container ID is not set")
|
||||||
|
|
||||||
// Unmarshal decodes Result from its canonical NeoFS binary format (Protocol Buffers
|
// Unmarshal decodes Result from its canonical FrostFS binary format (Protocol Buffers
|
||||||
// with direct field order). Returns an error describing a format violation.
|
// with direct field order). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also Marshal.
|
// See also Marshal.
|
||||||
|
@ -91,7 +91,7 @@ func (r *Result) Unmarshal(data []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Epoch returns NeoFS epoch when the data associated with the Result was audited.
|
// Epoch returns FrostFS epoch when the data associated with the Result was audited.
|
||||||
//
|
//
|
||||||
// Zero Result has zero epoch.
|
// Zero Result has zero epoch.
|
||||||
//
|
//
|
||||||
|
@ -100,7 +100,7 @@ func (r Result) Epoch() uint64 {
|
||||||
return r.v2.GetAuditEpoch()
|
return r.v2.GetAuditEpoch()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForEpoch specifies NeoFS epoch when the data associated with the Result was audited.
|
// ForEpoch specifies FrostFS epoch when the data associated with the Result was audited.
|
||||||
//
|
//
|
||||||
// See also Epoch.
|
// See also Epoch.
|
||||||
func (r *Result) ForEpoch(epoch uint64) {
|
func (r *Result) ForEpoch(epoch uint64) {
|
||||||
|
@ -136,8 +136,8 @@ func (r *Result) ForContainer(cnr cid.ID) {
|
||||||
r.v2.SetContainerID(&cidV2)
|
r.v2.SetContainerID(&cidV2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuditorKey returns public key of the auditing NeoFS Inner Ring node in
|
// AuditorKey returns public key of the auditing FrostFS Inner Ring node in
|
||||||
// a NeoFS binary key format.
|
// a FrostFS binary key format.
|
||||||
//
|
//
|
||||||
// Zero Result has nil key. Return value MUST NOT be mutated: to do this,
|
// Zero Result has nil key. Return value MUST NOT be mutated: to do this,
|
||||||
// first make a copy.
|
// first make a copy.
|
||||||
|
@ -147,8 +147,8 @@ func (r Result) AuditorKey() []byte {
|
||||||
return r.v2.GetPublicKey()
|
return r.v2.GetPublicKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAuditorKey specifies public key of the auditing NeoFS Inner Ring node in
|
// SetAuditorKey specifies public key of the auditing FrostFS Inner Ring node in
|
||||||
// a NeoFS binary key format.
|
// a FrostFS binary key format.
|
||||||
//
|
//
|
||||||
// Argument MUST NOT be mutated at least until the end of using the Result.
|
// Argument MUST NOT be mutated at least until the end of using the Result.
|
||||||
//
|
//
|
||||||
|
|
|
@ -136,7 +136,7 @@ func (b Token) WriteToV2(m *acl.BearerToken) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExp sets "exp" (expiration time) claim which identifies the
|
// SetExp sets "exp" (expiration time) claim which identifies the
|
||||||
// expiration time (in NeoFS epochs) after which the Token MUST NOT be
|
// expiration time (in FrostFS epochs) after which the Token MUST NOT be
|
||||||
// accepted for processing. The processing of the "exp" claim requires
|
// accepted for processing. The processing of the "exp" claim requires
|
||||||
// that the current epoch MUST be before or equal to the expiration epoch
|
// that the current epoch MUST be before or equal to the expiration epoch
|
||||||
// listed in the "exp" claim.
|
// listed in the "exp" claim.
|
||||||
|
@ -150,7 +150,7 @@ func (b *Token) SetExp(exp uint64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNbf sets "nbf" (not before) claim which identifies the time (in
|
// SetNbf sets "nbf" (not before) claim which identifies the time (in
|
||||||
// NeoFS epochs) before which the Token MUST NOT be accepted for processing. The
|
// FrostFS epochs) before which the Token MUST NOT be accepted for processing. The
|
||||||
// processing of the "nbf" claim requires that the current epoch MUST be
|
// processing of the "nbf" claim requires that the current epoch MUST be
|
||||||
// after or equal to the not-before epoch listed in the "nbf" claim.
|
// after or equal to the not-before epoch listed in the "nbf" claim.
|
||||||
//
|
//
|
||||||
|
@ -162,7 +162,7 @@ func (b *Token) SetNbf(nbf uint64) {
|
||||||
b.lifetimeSet = true
|
b.lifetimeSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIat sets "iat" (issued at) claim which identifies the time (in NeoFS
|
// SetIat sets "iat" (issued at) claim which identifies the time (in FrostFS
|
||||||
// epochs) at which the Token was issued. This claim can be used to determine
|
// epochs) at which the Token was issued. This claim can be used to determine
|
||||||
// the age of the Token.
|
// the age of the Token.
|
||||||
//
|
//
|
||||||
|
@ -189,7 +189,7 @@ func (b Token) InvalidAt(epoch uint64) bool {
|
||||||
// within any issuer's container.
|
// within any issuer's container.
|
||||||
//
|
//
|
||||||
// SetEACLTable MUST be called if Token is going to be transmitted over
|
// SetEACLTable MUST be called if Token is going to be transmitted over
|
||||||
// NeoFS API V2 protocol.
|
// FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also EACLTable, AssertContainer.
|
// See also EACLTable, AssertContainer.
|
||||||
func (b *Token) SetEACLTable(table eacl.Table) {
|
func (b *Token) SetEACLTable(table eacl.Table) {
|
||||||
|
@ -249,7 +249,7 @@ func (b Token) AssertUser(id user.ID) bool {
|
||||||
// Returns signature calculation errors.
|
// Returns signature calculation errors.
|
||||||
//
|
//
|
||||||
// Sign MUST be called if Token is going to be transmitted over
|
// Sign MUST be called if Token is going to be transmitted over
|
||||||
// NeoFS API V2 protocol.
|
// FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// Note that any Token mutation is likely to break the signature, so it is
|
// Note that any Token mutation is likely to break the signature, so it is
|
||||||
// expected to be calculated as a final stage of Token formation.
|
// expected to be calculated as a final stage of Token formation.
|
||||||
|
@ -285,7 +285,7 @@ func (b Token) VerifySignature() bool {
|
||||||
return sig.ReadFromV2(b.sig) == nil && sig.Verify(b.signedData())
|
return sig.ReadFromV2(b.sig) == nil && sig.Verify(b.signedData())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes Token into a binary format of the NeoFS API protocol
|
// Marshal encodes Token into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers V3 with direct field order).
|
// (Protocol Buffers V3 with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -296,7 +296,7 @@ func (b Token) Marshal() []byte {
|
||||||
return m.StableMarshal(nil)
|
return m.StableMarshal(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes NeoFS API protocol binary data into the Token
|
// Unmarshal decodes FrostFS API protocol binary data into the Token
|
||||||
// (Protocol Buffers V3 with direct field order). Returns an error describing
|
// (Protocol Buffers V3 with direct field order). Returns an error describing
|
||||||
// a format violation.
|
// a format violation.
|
||||||
//
|
//
|
||||||
|
@ -312,7 +312,7 @@ func (b *Token) Unmarshal(data []byte) error {
|
||||||
return b.readFromV2(m, false)
|
return b.readFromV2(m, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes Token into a JSON format of the NeoFS API protocol
|
// MarshalJSON encodes Token into a JSON format of the FrostFS API protocol
|
||||||
// (Protocol Buffers V3 JSON).
|
// (Protocol Buffers V3 JSON).
|
||||||
//
|
//
|
||||||
// See also UnmarshalJSON.
|
// See also UnmarshalJSON.
|
||||||
|
@ -323,7 +323,7 @@ func (b Token) MarshalJSON() ([]byte, error) {
|
||||||
return m.MarshalJSON()
|
return m.MarshalJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON decodes NeoFS API protocol JSON data into the Token
|
// UnmarshalJSON decodes FrostFS API protocol JSON data into the Token
|
||||||
// (Protocol Buffers V3 JSON). Returns an error describing a format violation.
|
// (Protocol Buffers V3 JSON). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also MarshalJSON.
|
// See also MarshalJSON.
|
||||||
|
@ -339,7 +339,7 @@ func (b *Token) UnmarshalJSON(data []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SigningKeyBytes returns issuer's public key in a binary format of
|
// SigningKeyBytes returns issuer's public key in a binary format of
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Unsigned Token has empty key.
|
// Unsigned Token has empty key.
|
||||||
//
|
//
|
||||||
|
|
|
@ -38,7 +38,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReadFromV2 reads Checksum from the refs.Checksum message. Checks if the
|
// ReadFromV2 reads Checksum from the refs.Checksum message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (c *Checksum) ReadFromV2(m refs.Checksum) error {
|
func (c *Checksum) ReadFromV2(m refs.Checksum) error {
|
||||||
|
|
|
@ -19,7 +19,7 @@ type PrmBalanceGet struct {
|
||||||
account user.ID
|
account user.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAccount sets identifier of the NeoFS account for which the balance is requested.
|
// SetAccount sets identifier of the FrostFS account for which the balance is requested.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *PrmBalanceGet) SetAccount(id user.ID) {
|
func (x *PrmBalanceGet) SetAccount(id user.ID) {
|
||||||
x.account = id
|
x.account = id
|
||||||
|
@ -33,17 +33,17 @@ type ResBalanceGet struct {
|
||||||
amount accounting.Decimal
|
amount accounting.Decimal
|
||||||
}
|
}
|
||||||
|
|
||||||
// Amount returns current amount of funds on the NeoFS account as decimal number.
|
// Amount returns current amount of funds on the FrostFS account as decimal number.
|
||||||
func (x ResBalanceGet) Amount() accounting.Decimal {
|
func (x ResBalanceGet) Amount() accounting.Decimal {
|
||||||
return x.amount
|
return x.amount
|
||||||
}
|
}
|
||||||
|
|
||||||
// BalanceGet requests current balance of the NeoFS account.
|
// BalanceGet requests current balance of the FrostFS account.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`,
|
// Any client's internal or transport errors are returned as `error`,
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmBalanceGet docs).
|
// Immediately panics if parameters are set incorrectly (see PrmBalanceGet docs).
|
||||||
|
|
|
@ -9,13 +9,13 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// interface of NeoFS API server. Exists for test purposes only.
|
// interface of FrostFS API server. Exists for test purposes only.
|
||||||
type neoFSAPIServer interface {
|
type frostFSAPIServer interface {
|
||||||
netMapSnapshot(context.Context, v2netmap.SnapshotRequest) (*v2netmap.SnapshotResponse, error)
|
netMapSnapshot(context.Context, v2netmap.SnapshotRequest) (*v2netmap.SnapshotResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrapper over real client connection which communicates over NeoFS API protocol.
|
// wrapper over real client connection which communicates over FrostFS API protocol.
|
||||||
// Provides neoFSAPIServer for Client instances used in real applications.
|
// Provides frostFSAPIServer for Client instances used in real applications.
|
||||||
type coreServer client.Client
|
type coreServer client.Client
|
||||||
|
|
||||||
// unifies errors of all RPC.
|
// unifies errors of all RPC.
|
||||||
|
@ -23,7 +23,7 @@ func rpcErr(e error) error {
|
||||||
return fmt.Errorf("rpc failure: %w", e)
|
return fmt.Errorf("rpc failure: %w", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// executes NetmapService.NetmapSnapshot RPC declared in NeoFS API protocol
|
// executes NetmapService.NetmapSnapshot RPC declared in FrostFS API protocol
|
||||||
// using underlying client.Client.
|
// using underlying client.Client.
|
||||||
func (x *coreServer) netMapSnapshot(ctx context.Context, req v2netmap.SnapshotRequest) (*v2netmap.SnapshotResponse, error) {
|
func (x *coreServer) netMapSnapshot(ctx context.Context, req v2netmap.SnapshotRequest) (*v2netmap.SnapshotResponse, error) {
|
||||||
resp, err := rpcapi.NetMapSnapshot((*client.Client)(x), &req, client.WithContext(ctx))
|
resp, err := rpcapi.NetMapSnapshot((*client.Client)(x), &req, client.WithContext(ctx))
|
||||||
|
|
|
@ -12,14 +12,14 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client represents virtual connection to the NeoFS network to communicate
|
// Client represents virtual connection to the FrostFS network to communicate
|
||||||
// with NeoFS server using NeoFS API protocol. It is designed to provide
|
// with FrostFS server using FrostFS API protocol. It is designed to provide
|
||||||
// an abstraction interface from the protocol details of data transfer over
|
// an abstraction interface from the protocol details of data transfer over
|
||||||
// a network in NeoFS.
|
// a network in FrostFS.
|
||||||
//
|
//
|
||||||
// Client can be created using simple Go variable declaration. Before starting
|
// Client can be created using simple Go variable declaration. Before starting
|
||||||
// work with the Client, it SHOULD BE correctly initialized (see Init method).
|
// work with the Client, it SHOULD BE correctly initialized (see Init method).
|
||||||
// Before executing the NeoFS operations using the Client, connection to the
|
// Before executing the FrostFS operations using the Client, connection to the
|
||||||
// server MUST BE correctly established (see Dial method and pay attention
|
// server MUST BE correctly established (see Dial method and pay attention
|
||||||
// to the mandatory parameters). Using the Client before connecting have
|
// to the mandatory parameters). Using the Client before connecting have
|
||||||
// been established can lead to a panic. After the work, the Client SHOULD BE
|
// been established can lead to a panic. After the work, the Client SHOULD BE
|
||||||
|
@ -28,7 +28,7 @@ import (
|
||||||
// during the communication process step strongly discouraged as it leads to
|
// during the communication process step strongly discouraged as it leads to
|
||||||
// undefined behavior.
|
// undefined behavior.
|
||||||
//
|
//
|
||||||
// Each method which produces a NeoFS API call may return a server response.
|
// Each method which produces a FrostFS API call may return a server response.
|
||||||
// Status responses are returned in the result structure, and can be cast
|
// Status responses are returned in the result structure, and can be cast
|
||||||
// to built-in error instance (or in the returned error if the client is
|
// to built-in error instance (or in the returned error if the client is
|
||||||
// configured accordingly). Certain statuses can be checked using `apistatus`
|
// configured accordingly). Certain statuses can be checked using `apistatus`
|
||||||
|
@ -48,7 +48,7 @@ type Client struct {
|
||||||
|
|
||||||
c client.Client
|
c client.Client
|
||||||
|
|
||||||
server neoFSAPIServer
|
server frostFSAPIServer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init brings the Client instance to its initial state.
|
// Init brings the Client instance to its initial state.
|
||||||
|
@ -61,7 +61,7 @@ func (c *Client) Init(prm PrmInit) {
|
||||||
c.prm = prm
|
c.prm = prm
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dial establishes a connection to the server from the NeoFS network.
|
// Dial establishes a connection to the server from the FrostFS network.
|
||||||
// Returns an error describing failure reason. If failed, the Client
|
// Returns an error describing failure reason. If failed, the Client
|
||||||
// SHOULD NOT be used.
|
// SHOULD NOT be used.
|
||||||
//
|
//
|
||||||
|
@ -103,7 +103,7 @@ func (c *Client) Dial(prm PrmDial) error {
|
||||||
client.WithRWTimeout(prm.streamTimeout),
|
client.WithRWTimeout(prm.streamTimeout),
|
||||||
)...)
|
)...)
|
||||||
|
|
||||||
c.setNeoFSAPIServer((*coreServer)(&c.c))
|
c.setFrostFSAPIServer((*coreServer)(&c.c))
|
||||||
|
|
||||||
if prm.parentCtx == nil {
|
if prm.parentCtx == nil {
|
||||||
prm.parentCtx = context.Background()
|
prm.parentCtx = context.Background()
|
||||||
|
@ -121,15 +121,15 @@ func (c *Client) Dial(prm PrmDial) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets underlying provider of neoFSAPIServer. The method is used for testing as an approach
|
// sets underlying provider of frostFSAPIServer. The method is used for testing as an approach
|
||||||
// to skip Dial stage and override NeoFS API server. MUST NOT be used outside test code.
|
// to skip Dial stage and override FrostFS API server. MUST NOT be used outside test code.
|
||||||
// In real applications wrapper over github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client
|
// In real applications wrapper over github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client
|
||||||
// is statically used.
|
// is statically used.
|
||||||
func (c *Client) setNeoFSAPIServer(server neoFSAPIServer) {
|
func (c *Client) setFrostFSAPIServer(server frostFSAPIServer) {
|
||||||
c.server = server
|
c.server = server
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close closes underlying connection to the NeoFS server. Implements io.Closer.
|
// Close closes underlying connection to the FrostFS server. Implements io.Closer.
|
||||||
// MUST NOT be called before successful Dial. Can be called concurrently
|
// MUST NOT be called before successful Dial. Can be called concurrently
|
||||||
// with server operations processing on running goroutines: in this case
|
// with server operations processing on running goroutines: in this case
|
||||||
// they are likely to fail due to a connection error.
|
// they are likely to fail due to a connection error.
|
||||||
|
@ -146,7 +146,7 @@ func (c *Client) Close() error {
|
||||||
//
|
//
|
||||||
// See also Init.
|
// See also Init.
|
||||||
type PrmInit struct {
|
type PrmInit struct {
|
||||||
resolveNeoFSErrors bool
|
resolveFrostFSErrors bool
|
||||||
|
|
||||||
key ecdsa.PrivateKey
|
key ecdsa.PrivateKey
|
||||||
|
|
||||||
|
@ -163,16 +163,16 @@ func (x *PrmInit) SetDefaultPrivateKey(key ecdsa.PrivateKey) {
|
||||||
x.key = key
|
x.key = key
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolveNeoFSFailures makes the Client to resolve failure statuses of the
|
// ResolveFrostFSFailures makes the Client to resolve failure statuses of the
|
||||||
// NeoFS protocol into Go built-in errors. These errors are returned from
|
// FrostFS protocol into Go built-in errors. These errors are returned from
|
||||||
// each protocol operation. By default, statuses aren't resolved and written
|
// each protocol operation. By default, statuses aren't resolved and written
|
||||||
// to the resulting structure (see corresponding Res* docs).
|
// to the resulting structure (see corresponding Res* docs).
|
||||||
func (x *PrmInit) ResolveNeoFSFailures() {
|
func (x *PrmInit) ResolveFrostFSFailures() {
|
||||||
x.resolveNeoFSErrors = true
|
x.resolveFrostFSErrors = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetResponseInfoCallback makes the Client to pass ResponseMetaInfo from each
|
// SetResponseInfoCallback makes the Client to pass ResponseMetaInfo from each
|
||||||
// NeoFS server response to f. Nil (default) means ignore response meta info.
|
// FrostFS server response to f. Nil (default) means ignore response meta info.
|
||||||
func (x *PrmInit) SetResponseInfoCallback(f func(ResponseMetaInfo) error) {
|
func (x *PrmInit) SetResponseInfoCallback(f func(ResponseMetaInfo) error) {
|
||||||
x.cbRespInfo = f
|
x.cbRespInfo = f
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ type PrmDial struct {
|
||||||
parentCtx context.Context
|
parentCtx context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetServerURI sets server URI in the NeoFS network.
|
// SetServerURI sets server URI in the FrostFS network.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
//
|
//
|
||||||
// Format of the URI:
|
// Format of the URI:
|
||||||
|
@ -212,7 +212,7 @@ func (x *PrmDial) SetServerURI(endpoint string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTLSConfig sets tls.Config to open TLS client connection
|
// SetTLSConfig sets tls.Config to open TLS client connection
|
||||||
// to the NeoFS server. Nil (default) means insecure connection.
|
// to the FrostFS server. Nil (default) means insecure connection.
|
||||||
//
|
//
|
||||||
// See also SetServerURI.
|
// See also SetServerURI.
|
||||||
func (x *PrmDial) SetTLSConfig(tlsConfig *tls.Config) {
|
func (x *PrmDial) SetTLSConfig(tlsConfig *tls.Config) {
|
||||||
|
|
|
@ -28,13 +28,13 @@ func assertStatusErr(tb testing.TB, res interface{ Status() apistatus.Status })
|
||||||
require.Equal(tb, statusErr.Message(), res.Status().(*apistatus.ServerInternal).Message())
|
require.Equal(tb, statusErr.Message(), res.Status().(*apistatus.ServerInternal).Message())
|
||||||
}
|
}
|
||||||
|
|
||||||
func newClient(server neoFSAPIServer) *Client {
|
func newClient(server frostFSAPIServer) *Client {
|
||||||
var prm PrmInit
|
var prm PrmInit
|
||||||
prm.SetDefaultPrivateKey(*key)
|
prm.SetDefaultPrivateKey(*key)
|
||||||
|
|
||||||
var c Client
|
var c Client
|
||||||
c.Init(prm)
|
c.Init(prm)
|
||||||
c.setNeoFSAPIServer(server)
|
c.setFrostFSAPIServer(server)
|
||||||
|
|
||||||
return &c
|
return &c
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (x statusRes) Status() apistatus.Status {
|
||||||
|
|
||||||
// groups meta parameters shared between all Client operations.
|
// groups meta parameters shared between all Client operations.
|
||||||
type prmCommonMeta struct {
|
type prmCommonMeta struct {
|
||||||
// NeoFS request X-Headers
|
// FrostFS request X-Headers
|
||||||
xHeaders []string
|
xHeaders []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ type contextCall struct {
|
||||||
// if set, protocol errors will be expanded into a final error
|
// if set, protocol errors will be expanded into a final error
|
||||||
resolveAPIFailures bool
|
resolveAPIFailures bool
|
||||||
|
|
||||||
// NeoFS network magic
|
// FrostFS network magic
|
||||||
netMagic uint64
|
netMagic uint64
|
||||||
|
|
||||||
// Meta parameters
|
// Meta parameters
|
||||||
|
@ -256,7 +256,7 @@ func (c *Client) processResponse(resp responseV2) (apistatus.Status, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
st := apistatus.FromStatusV2(resp.GetMetaHeader().GetStatus())
|
st := apistatus.FromStatusV2(resp.GetMetaHeader().GetStatus())
|
||||||
if c.prm.resolveNeoFSErrors {
|
if c.prm.resolveFrostFSErrors {
|
||||||
return st, apistatus.ErrFromStatus(st)
|
return st, apistatus.ErrFromStatus(st)
|
||||||
}
|
}
|
||||||
return st, nil
|
return st, nil
|
||||||
|
@ -329,14 +329,14 @@ func (x *contextCall) processCall() bool {
|
||||||
// initializes static cross-call parameters inherited from client.
|
// initializes static cross-call parameters inherited from client.
|
||||||
func (c *Client) initCallContext(ctx *contextCall) {
|
func (c *Client) initCallContext(ctx *contextCall) {
|
||||||
ctx.key = c.prm.key
|
ctx.key = c.prm.key
|
||||||
ctx.resolveAPIFailures = c.prm.resolveNeoFSErrors
|
ctx.resolveAPIFailures = c.prm.resolveFrostFSErrors
|
||||||
ctx.callbackResp = c.prm.cbRespInfo
|
ctx.callbackResp = c.prm.cbRespInfo
|
||||||
ctx.netMagic = c.prm.netMagic
|
ctx.netMagic = c.prm.netMagic
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecRaw executes f with underlying github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client.Client
|
// ExecRaw executes f with underlying github.com/TrueCloudLab/frostfs-api-go/v2/rpc/client.Client
|
||||||
// instance. Communicate over the Protocol Buffers protocol in a more flexible way:
|
// instance. Communicate over the Protocol Buffers protocol in a more flexible way:
|
||||||
// most often used to transmit data over a fixed version of the NeoFS protocol, as well
|
// most often used to transmit data over a fixed version of the FrostFS protocol, as well
|
||||||
// as to support custom services.
|
// as to support custom services.
|
||||||
//
|
//
|
||||||
// The f must not manipulate the client connection passed into it.
|
// The f must not manipulate the client connection passed into it.
|
||||||
|
|
|
@ -30,7 +30,7 @@ type PrmContainerPut struct {
|
||||||
session session.Container
|
session session.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets structured information about new NeoFS container.
|
// SetContainer sets structured information about new FrostFS container.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *PrmContainerPut) SetContainer(cnr container.Container) {
|
func (x *PrmContainerPut) SetContainer(cnr container.Container) {
|
||||||
x.cnr = cnr
|
x.cnr = cnr
|
||||||
|
@ -64,12 +64,12 @@ func (x ResContainerPut) ID() cid.ID {
|
||||||
return x.id
|
return x.id
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerPut sends request to save container in NeoFS.
|
// ContainerPut sends request to save container in FrostFS.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
||||||
|
@ -196,12 +196,12 @@ func (x ResContainerGet) Container() container.Container {
|
||||||
return x.cnr
|
return x.cnr
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerGet reads NeoFS container by ID.
|
// ContainerGet reads FrostFS container by ID.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmContainerGet docs).
|
// Immediately panics if parameters are set incorrectly (see PrmContainerGet docs).
|
||||||
|
@ -275,7 +275,7 @@ type PrmContainerList struct {
|
||||||
ownerID user.ID
|
ownerID user.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAccount sets identifier of the NeoFS account to list the containers.
|
// SetAccount sets identifier of the FrostFS account to list the containers.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *PrmContainerList) SetAccount(id user.ID) {
|
func (x *PrmContainerList) SetAccount(id user.ID) {
|
||||||
x.ownerID = id
|
x.ownerID = id
|
||||||
|
@ -300,8 +300,8 @@ func (x ResContainerList) Containers() []cid.ID {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmContainerList docs).
|
// Immediately panics if parameters are set incorrectly (see PrmContainerList docs).
|
||||||
|
@ -377,7 +377,7 @@ type PrmContainerDelete struct {
|
||||||
tok session.Container
|
tok session.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets identifier of the NeoFS container to be removed.
|
// SetContainer sets identifier of the FrostFS container to be removed.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *PrmContainerDelete) SetContainer(id cid.ID) {
|
func (x *PrmContainerDelete) SetContainer(id cid.ID) {
|
||||||
x.id = id
|
x.id = id
|
||||||
|
@ -400,12 +400,12 @@ type ResContainerDelete struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerDelete sends request to remove the NeoFS container.
|
// ContainerDelete sends request to remove the FrostFS container.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
||||||
|
@ -501,7 +501,7 @@ type PrmContainerEACL struct {
|
||||||
id cid.ID
|
id cid.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets identifier of the NeoFS container to read the eACL table.
|
// SetContainer sets identifier of the FrostFS container to read the eACL table.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *PrmContainerEACL) SetContainer(id cid.ID) {
|
func (x *PrmContainerEACL) SetContainer(id cid.ID) {
|
||||||
x.id = id
|
x.id = id
|
||||||
|
@ -520,12 +520,12 @@ func (x ResContainerEACL) Table() eacl.Table {
|
||||||
return x.table
|
return x.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerEACL reads eACL table of the NeoFS container.
|
// ContainerEACL reads eACL table of the FrostFS container.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmContainerEACL docs).
|
// Immediately panics if parameters are set incorrectly (see PrmContainerEACL docs).
|
||||||
|
@ -629,12 +629,12 @@ type ResContainerSetEACL struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerSetEACL sends request to update eACL table of the NeoFS container.
|
// ContainerSetEACL sends request to update eACL table of the FrostFS container.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
||||||
|
@ -738,8 +738,8 @@ type ResAnnounceSpace struct {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
// Operation is asynchronous and no guaranteed even in the absence of errors.
|
||||||
|
@ -761,13 +761,13 @@ func (c *Client) ContainerAnnounceUsedSpace(ctx context.Context, prm PrmAnnounce
|
||||||
panic("missing announcements")
|
panic("missing announcements")
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert list of SDK announcement structures into NeoFS-API v2 list
|
// convert list of SDK announcement structures into FrostFS-API v2 list
|
||||||
v2announce := make([]v2container.UsedSpaceAnnouncement, len(prm.announcements))
|
v2announce := make([]v2container.UsedSpaceAnnouncement, len(prm.announcements))
|
||||||
for i := range prm.announcements {
|
for i := range prm.announcements {
|
||||||
prm.announcements[i].WriteToV2(&v2announce[i])
|
prm.announcements[i].WriteToV2(&v2announce[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare body of the NeoFS-API v2 request and request itself
|
// prepare body of the FrostFS-API v2 request and request itself
|
||||||
reqBody := new(v2container.AnnounceUsedSpaceRequestBody)
|
reqBody := new(v2container.AnnounceUsedSpaceRequestBody)
|
||||||
reqBody.SetAnnouncements(v2announce)
|
reqBody.SetAnnouncements(v2announce)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package client provides NeoFS API client implementation.
|
Package client provides FrostFS API client implementation.
|
||||||
|
|
||||||
The main component is Client type. It is a virtual connection to the network
|
The main component is Client type. It is a virtual connection to the network
|
||||||
and provides methods for executing operations on the server.
|
and provides methods for executing operations on the server.
|
||||||
|
@ -16,7 +16,7 @@ Initialize client state:
|
||||||
|
|
||||||
c.Init(prm)
|
c.Init(prm)
|
||||||
|
|
||||||
Connect to the NeoFS server:
|
Connect to the FrostFS server:
|
||||||
|
|
||||||
var prm client.PrmDial
|
var prm client.PrmDial
|
||||||
prm.SetServerURI("localhost:8080")
|
prm.SetServerURI("localhost:8080")
|
||||||
|
@ -26,7 +26,7 @@ Connect to the NeoFS server:
|
||||||
err := c.Dial(prm)
|
err := c.Dial(prm)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
Execute NeoFS operation on the server:
|
Execute FrostFS operation on the server:
|
||||||
|
|
||||||
var prm client.PrmContainerPut
|
var prm client.PrmContainerPut
|
||||||
prm.SetContainer(cnr)
|
prm.SetContainer(cnr)
|
||||||
|
@ -74,7 +74,7 @@ with an interface:
|
||||||
|
|
||||||
import "github.com/TrueCloudLab/frostfs-sdk-go/client"
|
import "github.com/TrueCloudLab/frostfs-sdk-go/client"
|
||||||
|
|
||||||
type NeoFSClient interface {
|
type FrostFSClient interface {
|
||||||
// Operations according to the application needs
|
// Operations according to the application needs
|
||||||
CreateContainer(context.Context, container.Container) error
|
CreateContainer(context.Context, container.Container) error
|
||||||
// ...
|
// ...
|
||||||
|
|
|
@ -16,7 +16,7 @@ func unwrapErr(err error) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrContainerNotFound checks if err corresponds to NeoFS status
|
// IsErrContainerNotFound checks if err corresponds to FrostFS status
|
||||||
// return corresponding to missing container. Supports wrapped errors.
|
// return corresponding to missing container. Supports wrapped errors.
|
||||||
func IsErrContainerNotFound(err error) bool {
|
func IsErrContainerNotFound(err error) bool {
|
||||||
switch unwrapErr(err).(type) {
|
switch unwrapErr(err).(type) {
|
||||||
|
@ -29,7 +29,7 @@ func IsErrContainerNotFound(err error) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrEACLNotFound checks if err corresponds to NeoFS status
|
// IsErrEACLNotFound checks if err corresponds to FrostFS status
|
||||||
// return corresponding to missing eACL table. Supports wrapped errors.
|
// return corresponding to missing eACL table. Supports wrapped errors.
|
||||||
func IsErrEACLNotFound(err error) bool {
|
func IsErrEACLNotFound(err error) bool {
|
||||||
switch unwrapErr(err).(type) {
|
switch unwrapErr(err).(type) {
|
||||||
|
@ -42,7 +42,7 @@ func IsErrEACLNotFound(err error) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrObjectNotFound checks if err corresponds to NeoFS status
|
// IsErrObjectNotFound checks if err corresponds to FrostFS status
|
||||||
// return corresponding to missing object. Supports wrapped errors.
|
// return corresponding to missing object. Supports wrapped errors.
|
||||||
func IsErrObjectNotFound(err error) bool {
|
func IsErrObjectNotFound(err error) bool {
|
||||||
switch unwrapErr(err).(type) {
|
switch unwrapErr(err).(type) {
|
||||||
|
@ -55,7 +55,7 @@ func IsErrObjectNotFound(err error) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrObjectAlreadyRemoved checks if err corresponds to NeoFS status
|
// IsErrObjectAlreadyRemoved checks if err corresponds to FrostFS status
|
||||||
// return corresponding to already removed object. Supports wrapped errors.
|
// return corresponding to already removed object. Supports wrapped errors.
|
||||||
func IsErrObjectAlreadyRemoved(err error) bool {
|
func IsErrObjectAlreadyRemoved(err error) bool {
|
||||||
switch unwrapErr(err).(type) {
|
switch unwrapErr(err).(type) {
|
||||||
|
@ -68,7 +68,7 @@ func IsErrObjectAlreadyRemoved(err error) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrSessionExpired checks if err corresponds to NeoFS status return
|
// IsErrSessionExpired checks if err corresponds to FrostFS status return
|
||||||
// corresponding to expired session. Supports wrapped errors.
|
// corresponding to expired session. Supports wrapped errors.
|
||||||
func IsErrSessionExpired(err error) bool {
|
func IsErrSessionExpired(err error) bool {
|
||||||
switch unwrapErr(err).(type) {
|
switch unwrapErr(err).(type) {
|
||||||
|
@ -81,7 +81,7 @@ func IsErrSessionExpired(err error) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrSessionNotFound checks if err corresponds to NeoFS status return
|
// IsErrSessionNotFound checks if err corresponds to FrostFS status return
|
||||||
// corresponding to missing session. Supports wrapped errors.
|
// corresponding to missing session. Supports wrapped errors.
|
||||||
func IsErrSessionNotFound(err error) bool {
|
func IsErrSessionNotFound(err error) bool {
|
||||||
switch unwrapErr(err).(type) {
|
switch unwrapErr(err).(type) {
|
||||||
|
@ -99,7 +99,7 @@ func newErrMissingResponseField(name string) error {
|
||||||
return fmt.Errorf("missing %s field in the response", name)
|
return fmt.Errorf("missing %s field in the response", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns error describing invalid field (according to the NeoFS protocol)
|
// returns error describing invalid field (according to the FrostFS protocol)
|
||||||
// with the given name and format violation err.
|
// with the given name and format violation err.
|
||||||
func newErrInvalidResponseField(name string, err error) error {
|
func newErrInvalidResponseField(name string, err error) error {
|
||||||
return fmt.Errorf("invalid %s field in the response: %w", name, err)
|
return fmt.Errorf("invalid %s field in the response: %w", name, err)
|
||||||
|
|
|
@ -28,12 +28,12 @@ type ResEndpointInfo struct {
|
||||||
ni netmap.NodeInfo
|
ni netmap.NodeInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// LatestVersion returns latest NeoFS API protocol's version in use.
|
// LatestVersion returns latest FrostFS API protocol's version in use.
|
||||||
func (x ResEndpointInfo) LatestVersion() version.Version {
|
func (x ResEndpointInfo) LatestVersion() version.Version {
|
||||||
return x.version
|
return x.version
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInfo returns information about the NeoFS node served on the remote endpoint.
|
// NodeInfo returns information about the FrostFS node served on the remote endpoint.
|
||||||
func (x ResEndpointInfo) NodeInfo() netmap.NodeInfo {
|
func (x ResEndpointInfo) NodeInfo() netmap.NodeInfo {
|
||||||
return x.ni
|
return x.ni
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ func (x ResEndpointInfo) NodeInfo() netmap.NodeInfo {
|
||||||
// Method can be used as a health check to see if node is alive and responds to requests.
|
// Method can be used as a health check to see if node is alive and responds to requests.
|
||||||
//
|
//
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmEndpointInfo docs).
|
// Immediately panics if parameters are set incorrectly (see PrmEndpointInfo docs).
|
||||||
|
@ -132,16 +132,16 @@ type ResNetworkInfo struct {
|
||||||
info netmap.NetworkInfo
|
info netmap.NetworkInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info returns structured information about the NeoFS network.
|
// Info returns structured information about the FrostFS network.
|
||||||
func (x ResNetworkInfo) Info() netmap.NetworkInfo {
|
func (x ResNetworkInfo) Info() netmap.NetworkInfo {
|
||||||
return x.info
|
return x.info
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfo requests information about the NeoFS network of which the remote server is a part.
|
// NetworkInfo requests information about the FrostFS network of which the remote server is a part.
|
||||||
//
|
//
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmNetworkInfo docs).
|
// Immediately panics if parameters are set incorrectly (see PrmNetworkInfo docs).
|
||||||
|
@ -220,8 +220,8 @@ func (x ResNetMapSnapshot) NetMap() netmap.NetMap {
|
||||||
// NetMapSnapshot requests current network view of the remote server.
|
// NetMapSnapshot requests current network view of the remote server.
|
||||||
//
|
//
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Context is required and MUST NOT be nil. It is used for network communication.
|
// Context is required and MUST NOT be nil. It is used for network communication.
|
||||||
|
|
|
@ -55,7 +55,7 @@ func (x *PrmObjectDelete) WithBearerToken(t bearer.Token) {
|
||||||
x.meta.SetBearerToken(&v2token)
|
x.meta.SetBearerToken(&v2token)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromContainer specifies NeoFS container of the object.
|
// FromContainer specifies FrostFS container of the object.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *PrmObjectDelete) FromContainer(id cid.ID) {
|
func (x *PrmObjectDelete) FromContainer(id cid.ID) {
|
||||||
var cidV2 v2refs.ContainerID
|
var cidV2 v2refs.ContainerID
|
||||||
|
@ -100,7 +100,7 @@ func (x ResObjectDelete) Tombstone() oid.ID {
|
||||||
return x.tomb
|
return x.tomb
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectDelete marks an object for deletion from the container using NeoFS API protocol.
|
// ObjectDelete marks an object for deletion from the container using FrostFS API protocol.
|
||||||
// As a marker, a special unit called a tombstone is placed in the container.
|
// As a marker, a special unit called a tombstone is placed in the container.
|
||||||
// It confirms the user's intent to delete the object, and is itself a container object.
|
// It confirms the user's intent to delete the object, and is itself a container object.
|
||||||
// Explicit deletion is done asynchronously, and is generally not guaranteed.
|
// Explicit deletion is done asynchronously, and is generally not guaranteed.
|
||||||
|
@ -110,8 +110,8 @@ func (x ResObjectDelete) Tombstone() oid.ID {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`,
|
// Any client's internal or transport errors are returned as `error`,
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmObjectDelete docs).
|
// Immediately panics if parameters are set incorrectly (see PrmObjectDelete docs).
|
||||||
|
|
|
@ -72,7 +72,7 @@ func (x *prmObjectRead) WithBearerToken(t bearer.Token) {
|
||||||
x.meta.SetBearerToken(&v2token)
|
x.meta.SetBearerToken(&v2token)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromContainer specifies NeoFS container of the object.
|
// FromContainer specifies FrostFS container of the object.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *prmObjectRead) FromContainer(id cid.ID) {
|
func (x *prmObjectRead) FromContainer(id cid.ID) {
|
||||||
var cnrV2 v2refs.ContainerID
|
var cnrV2 v2refs.ContainerID
|
||||||
|
@ -100,7 +100,7 @@ type ResObjectGet struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectReader is designed to read one object from NeoFS system.
|
// ObjectReader is designed to read one object from FrostFS system.
|
||||||
//
|
//
|
||||||
// Must be initialized using Client.ObjectGetInit, any other
|
// Must be initialized using Client.ObjectGetInit, any other
|
||||||
// usage is unsafe.
|
// usage is unsafe.
|
||||||
|
@ -251,7 +251,7 @@ func (x *ObjectReader) close(ignoreEOF bool) (*ResObjectGet, error) {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as Go built-in error.
|
// Any client's internal or transport errors are returned as Go built-in error.
|
||||||
// If Client is tuned to resolve NeoFS API statuses, then NeoFS failures
|
// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures
|
||||||
// codes are returned as error.
|
// codes are returned as error.
|
||||||
//
|
//
|
||||||
// Return errors:
|
// Return errors:
|
||||||
|
@ -291,7 +291,7 @@ func (x *ObjectReader) Read(p []byte) (int, error) {
|
||||||
return n, nil
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectGetInit initiates reading an object through a remote server using NeoFS API protocol.
|
// ObjectGetInit initiates reading an object through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// The call only opens the transmission channel, explicit fetching is done using the ObjectReader.
|
// The call only opens the transmission channel, explicit fetching is done using the ObjectReader.
|
||||||
// Exactly one return value is non-nil. Resulting reader must be finally closed.
|
// Exactly one return value is non-nil. Resulting reader must be finally closed.
|
||||||
|
@ -392,12 +392,12 @@ func (x *ResObjectHead) ReadHeader(dst *object.Object) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectHead reads object header through a remote server using NeoFS API protocol.
|
// ObjectHead reads object header through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`,
|
// Any client's internal or transport errors are returned as `error`,
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmObjectHead docs).
|
// Immediately panics if parameters are set incorrectly (see PrmObjectHead docs).
|
||||||
|
@ -505,7 +505,7 @@ type ResObjectRange struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectRangeReader is designed to read payload range of one object
|
// ObjectRangeReader is designed to read payload range of one object
|
||||||
// from NeoFS system.
|
// from FrostFS system.
|
||||||
//
|
//
|
||||||
// Must be initialized using Client.ObjectRangeInit, any other
|
// Must be initialized using Client.ObjectRangeInit, any other
|
||||||
// usage is unsafe.
|
// usage is unsafe.
|
||||||
|
@ -616,7 +616,7 @@ func (x *ObjectRangeReader) close(ignoreEOF bool) (*ResObjectRange, error) {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as Go built-in error.
|
// Any client's internal or transport errors are returned as Go built-in error.
|
||||||
// If Client is tuned to resolve NeoFS API statuses, then NeoFS failures
|
// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures
|
||||||
// codes are returned as error.
|
// codes are returned as error.
|
||||||
//
|
//
|
||||||
// Return errors:
|
// Return errors:
|
||||||
|
@ -658,7 +658,7 @@ func (x *ObjectRangeReader) Read(p []byte) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectRangeInit initiates reading an object's payload range through a remote
|
// ObjectRangeInit initiates reading an object's payload range through a remote
|
||||||
// server using NeoFS API protocol.
|
// server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// The call only opens the transmission channel, explicit fetching is done using the ObjectRangeReader.
|
// The call only opens the transmission channel, explicit fetching is done using the ObjectRangeReader.
|
||||||
// Exactly one return value is non-nil. Resulting reader must be finally closed.
|
// Exactly one return value is non-nil. Resulting reader must be finally closed.
|
||||||
|
|
|
@ -69,7 +69,7 @@ func (x *PrmObjectHash) WithBearerToken(t bearer.Token) {
|
||||||
x.meta.SetBearerToken(&v2token)
|
x.meta.SetBearerToken(&v2token)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromContainer specifies NeoFS container of the object.
|
// FromContainer specifies FrostFS container of the object.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *PrmObjectHash) FromContainer(id cid.ID) {
|
func (x *PrmObjectHash) FromContainer(id cid.ID) {
|
||||||
var cidV2 v2refs.ContainerID
|
var cidV2 v2refs.ContainerID
|
||||||
|
@ -143,15 +143,15 @@ func (x ResObjectHash) Checksums() [][]byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectHash requests checksum of the range list of the object payload using
|
// ObjectHash requests checksum of the range list of the object payload using
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Returns a list of checksums in raw form: the format of hashes and their number
|
// Returns a list of checksums in raw form: the format of hashes and their number
|
||||||
// is left for the caller to check. Client preserves the order of the server's response.
|
// is left for the caller to check. Client preserves the order of the server's response.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`,
|
// Any client's internal or transport errors are returned as `error`,
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmObjectHash docs).
|
// Immediately panics if parameters are set incorrectly (see PrmObjectHash docs).
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (x ResObjectPut) StoredObjectID() oid.ID {
|
||||||
return x.obj
|
return x.obj
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectWriter is designed to write one object to NeoFS system.
|
// ObjectWriter is designed to write one object to FrostFS system.
|
||||||
//
|
//
|
||||||
// Must be initialized using Client.ObjectPutInit, any other
|
// Must be initialized using Client.ObjectPutInit, any other
|
||||||
// usage is unsafe.
|
// usage is unsafe.
|
||||||
|
@ -181,7 +181,7 @@ func (x *ObjectWriter) WritePayloadChunk(chunk []byte) bool {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as Go built-in error.
|
// Any client's internal or transport errors are returned as Go built-in error.
|
||||||
// If Client is tuned to resolve NeoFS API statuses, then NeoFS failures
|
// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures
|
||||||
// codes are returned as error.
|
// codes are returned as error.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
|
@ -230,7 +230,7 @@ func (x *ObjectWriter) Close() (*ResObjectPut, error) {
|
||||||
return &x.res, nil
|
return &x.res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectPutInit initiates writing an object through a remote server using NeoFS API protocol.
|
// ObjectPutInit initiates writing an object through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// The call only opens the transmission channel, explicit recording is done using the ObjectWriter.
|
// The call only opens the transmission channel, explicit recording is done using the ObjectWriter.
|
||||||
// Exactly one return value is non-nil. Resulting writer must be finally closed.
|
// Exactly one return value is non-nil. Resulting writer must be finally closed.
|
||||||
|
|
|
@ -94,7 +94,7 @@ type ResObjectSearch struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectListReader is designed to read list of object identifiers from NeoFS system.
|
// ObjectListReader is designed to read list of object identifiers from FrostFS system.
|
||||||
//
|
//
|
||||||
// Must be initialized using Client.ObjectSearch, any other usage is unsafe.
|
// Must be initialized using Client.ObjectSearch, any other usage is unsafe.
|
||||||
type ObjectListReader struct {
|
type ObjectListReader struct {
|
||||||
|
@ -194,7 +194,7 @@ func (x *ObjectListReader) Iterate(f func(oid.ID) bool) error {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as Go built-in error.
|
// Any client's internal or transport errors are returned as Go built-in error.
|
||||||
// If Client is tuned to resolve NeoFS API statuses, then NeoFS failures
|
// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures
|
||||||
// codes are returned as error.
|
// codes are returned as error.
|
||||||
//
|
//
|
||||||
// Return statuses:
|
// Return statuses:
|
||||||
|
@ -212,7 +212,7 @@ func (x *ObjectListReader) Close() (*ResObjectSearch, error) {
|
||||||
return &x.res, nil
|
return &x.res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectSearchInit initiates object selection through a remote server using NeoFS API protocol.
|
// ObjectSearchInit initiates object selection through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// The call only opens the transmission channel, explicit fetching of matched objects
|
// The call only opens the transmission channel, explicit fetching of matched objects
|
||||||
// is done using the ObjectListReader. Exactly one return value is non-nil.
|
// is done using the ObjectListReader. Exactly one return value is non-nil.
|
||||||
|
|
|
@ -18,13 +18,13 @@ type PrmAnnounceLocalTrust struct {
|
||||||
trusts []reputation.Trust
|
trusts []reputation.Trust
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEpoch sets number of NeoFS epoch in which the trust was assessed.
|
// SetEpoch sets number of FrostFS epoch in which the trust was assessed.
|
||||||
// Required parameter, must not be zero.
|
// Required parameter, must not be zero.
|
||||||
func (x *PrmAnnounceLocalTrust) SetEpoch(epoch uint64) {
|
func (x *PrmAnnounceLocalTrust) SetEpoch(epoch uint64) {
|
||||||
x.epoch = epoch
|
x.epoch = epoch
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetValues sets values describing trust of the client to the NeoFS network participants.
|
// SetValues sets values describing trust of the client to the FrostFS network participants.
|
||||||
// Required parameter. Must not be empty.
|
// Required parameter. Must not be empty.
|
||||||
//
|
//
|
||||||
// Must not be mutated before the end of the operation.
|
// Must not be mutated before the end of the operation.
|
||||||
|
@ -37,12 +37,12 @@ type ResAnnounceLocalTrust struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceLocalTrust sends client's trust values to the NeoFS network participants.
|
// AnnounceLocalTrust sends client's trust values to the FrostFS network participants.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmAnnounceLocalTrust docs).
|
// Immediately panics if parameters are set incorrectly (see PrmAnnounceLocalTrust docs).
|
||||||
|
@ -113,7 +113,7 @@ type PrmAnnounceIntermediateTrust struct {
|
||||||
trust reputation.PeerToPeerTrust
|
trust reputation.PeerToPeerTrust
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEpoch sets number of NeoFS epoch with which client's calculation algorithm is initialized.
|
// SetEpoch sets number of FrostFS epoch with which client's calculation algorithm is initialized.
|
||||||
// Required parameter, must not be zero.
|
// Required parameter, must not be zero.
|
||||||
func (x *PrmAnnounceIntermediateTrust) SetEpoch(epoch uint64) {
|
func (x *PrmAnnounceIntermediateTrust) SetEpoch(epoch uint64) {
|
||||||
x.epoch = epoch
|
x.epoch = epoch
|
||||||
|
@ -137,13 +137,13 @@ type ResAnnounceIntermediateTrust struct {
|
||||||
statusRes
|
statusRes
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceIntermediateTrust sends global trust values calculated for the specified NeoFS network participants
|
// AnnounceIntermediateTrust sends global trust values calculated for the specified FrostFS network participants
|
||||||
// at some stage of client's calculation algorithm.
|
// at some stage of client's calculation algorithm.
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmAnnounceIntermediateTrust docs).
|
// Immediately panics if parameters are set incorrectly (see PrmAnnounceIntermediateTrust docs).
|
||||||
|
|
|
@ -2,7 +2,7 @@ package client
|
||||||
|
|
||||||
import "github.com/TrueCloudLab/frostfs-api-go/v2/session"
|
import "github.com/TrueCloudLab/frostfs-api-go/v2/session"
|
||||||
|
|
||||||
// ResponseMetaInfo groups meta information about any NeoFS API response.
|
// ResponseMetaInfo groups meta information about any FrostFS API response.
|
||||||
type ResponseMetaInfo struct {
|
type ResponseMetaInfo struct {
|
||||||
key []byte
|
key []byte
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ func (x ResponseMetaInfo) ResponderKey() []byte {
|
||||||
return x.key
|
return x.key
|
||||||
}
|
}
|
||||||
|
|
||||||
// Epoch returns local NeoFS epoch of the server.
|
// Epoch returns local FrostFS epoch of the server.
|
||||||
func (x ResponseMetaInfo) Epoch() uint64 {
|
func (x ResponseMetaInfo) Epoch() uint64 {
|
||||||
return x.epoch
|
return x.epoch
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (x *ResSessionCreate) setID(id []byte) {
|
||||||
x.id = id
|
x.id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID returns identifier of the opened session in a binary NeoFS API protocol format.
|
// ID returns identifier of the opened session in a binary FrostFS API protocol format.
|
||||||
//
|
//
|
||||||
// Client doesn't retain value so modification is safe.
|
// Client doesn't retain value so modification is safe.
|
||||||
func (x ResSessionCreate) ID() []byte {
|
func (x ResSessionCreate) ID() []byte {
|
||||||
|
@ -57,7 +57,7 @@ func (x *ResSessionCreate) setSessionKey(key []byte) {
|
||||||
x.sessionKey = key
|
x.sessionKey = key
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublicKey returns public key of the opened session in a binary NeoFS API protocol format.
|
// PublicKey returns public key of the opened session in a binary FrostFS API protocol format.
|
||||||
func (x ResSessionCreate) PublicKey() []byte {
|
func (x ResSessionCreate) PublicKey() []byte {
|
||||||
return x.sessionKey
|
return x.sessionKey
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ func (x ResSessionCreate) PublicKey() []byte {
|
||||||
//
|
//
|
||||||
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
// Any client's internal or transport errors are returned as `error`.
|
// Any client's internal or transport errors are returned as `error`.
|
||||||
// If PrmInit.ResolveNeoFSFailures has been called, unsuccessful
|
// If PrmInit.ResolveFrostFSFailures has been called, unsuccessful
|
||||||
// NeoFS status codes are returned as `error`, otherwise, are included
|
// FrostFS status codes are returned as `error`, otherwise, are included
|
||||||
// in the returned result structure.
|
// in the returned result structure.
|
||||||
//
|
//
|
||||||
// Immediately panics if parameters are set incorrectly (see PrmSessionCreate docs).
|
// Immediately panics if parameters are set incorrectly (see PrmSessionCreate docs).
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package apistatus
|
package apistatus
|
||||||
|
|
||||||
// Status defines a variety of NeoFS API status returns.
|
// Status defines a variety of FrostFS API status returns.
|
||||||
//
|
//
|
||||||
// All statuses are split into two disjoint subsets: successful and failed, and:
|
// All statuses are split into two disjoint subsets: successful and failed, and:
|
||||||
// - statuses that implement the build-in error interface are considered failed statuses;
|
// - statuses that implement the build-in error interface are considered failed statuses;
|
||||||
|
@ -14,7 +14,7 @@ package apistatus
|
||||||
// IsSuccessful function should be used (try to avoid nil comparison).
|
// IsSuccessful function should be used (try to avoid nil comparison).
|
||||||
// It should be noted that using direct typecasting is not a compatible approach.
|
// It should be noted that using direct typecasting is not a compatible approach.
|
||||||
//
|
//
|
||||||
// To transport statuses using the NeoFS API V2 protocol, see StatusV2 interface and FromStatusV2 and ToStatusV2 functions.
|
// To transport statuses using the FrostFS API V2 protocol, see StatusV2 interface and FromStatusV2 and ToStatusV2 functions.
|
||||||
type Status interface{}
|
type Status interface{}
|
||||||
|
|
||||||
// ErrFromStatus converts Status instance to error if it is failed. Returns nil on successful Status.
|
// ErrFromStatus converts Status instance to error if it is failed. Returns nil on successful Status.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/status"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StatusV2 defines a variety of Status instances compatible with NeoFS API V2 protocol.
|
// StatusV2 defines a variety of Status instances compatible with FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// Note: it is not recommended to use this type directly, it is intended for documentation of the library functionality.
|
// Note: it is not recommended to use this type directly, it is intended for documentation of the library functionality.
|
||||||
type StatusV2 interface {
|
type StatusV2 interface {
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Basic represents basic part of the NeoFS container's ACL. It includes
|
// Basic represents basic part of the FrostFS container's ACL. It includes
|
||||||
// common (pretty simple) access rules for operations inside the container.
|
// common (pretty simple) access rules for operations inside the container.
|
||||||
// See NeoFS Specification for details.
|
// See FrostFS Specification for details.
|
||||||
//
|
//
|
||||||
// One can find some similarities with the traditional Unix permission, such as
|
// One can find some similarities with the traditional Unix permission, such as
|
||||||
//
|
//
|
||||||
|
@ -236,7 +236,7 @@ const (
|
||||||
NamePublicAppendExtended = "eacl-public-append"
|
NamePublicAppendExtended = "eacl-public-append"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Frequently used Basic values. Bitmasks are taken from the NeoFS Specification.
|
// Frequently used Basic values. Bitmasks are taken from the FrostFS Specification.
|
||||||
const (
|
const (
|
||||||
Private = Basic(0x1C8C8CCC) // private
|
Private = Basic(0x1C8C8CCC) // private
|
||||||
PrivateExtended = Basic(0x0C8C8CCC) // eacl-private
|
PrivateExtended = Basic(0x0C8C8CCC) // eacl-private
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Package acl provides functionality to control access to data and operations on them in NeoFS containers.
|
Package acl provides functionality to control access to data and operations on them in FrostFS containers.
|
||||||
|
|
||||||
Type Basic represents basic ACL of the NeoFS container which specifies the general order of data access.
|
Type Basic represents basic ACL of the FrostFS container which specifies the general order of data access.
|
||||||
Basic provides interface of rule composition. Package acl also exports some frequently used settings like
|
Basic provides interface of rule composition. Package acl also exports some frequently used settings like
|
||||||
private or public.
|
private or public.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,17 +22,17 @@ import (
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Container represents descriptor of the NeoFS container. Container logically
|
// Container represents descriptor of the FrostFS container. Container logically
|
||||||
// stores NeoFS objects. Container is one of the basic and at the same time
|
// stores FrostFS objects. Container is one of the basic and at the same time
|
||||||
// necessary data storage units in the NeoFS. Container includes data about the
|
// necessary data storage units in the FrostFS. Container includes data about the
|
||||||
// owner, rules for placing objects and other information necessary for the
|
// owner, rules for placing objects and other information necessary for the
|
||||||
// system functioning.
|
// system functioning.
|
||||||
//
|
//
|
||||||
// Container type instances can represent different container states in the
|
// Container type instances can represent different container states in the
|
||||||
// system, depending on the context. To create new container in NeoFS zero
|
// system, depending on the context. To create new container in FrostFS zero
|
||||||
// instance SHOULD be declared, initialized using Init method and filled using
|
// instance SHOULD be declared, initialized using Init method and filled using
|
||||||
// dedicated methods. Once container is saved in the NeoFS network, it can't be
|
// dedicated methods. Once container is saved in the FrostFS network, it can't be
|
||||||
// changed: containers stored in the system are immutable, and NeoFS is a CAS
|
// changed: containers stored in the system are immutable, and FrostFS is a CAS
|
||||||
// of containers that are identified by a fixed length value (see cid.ID type).
|
// of containers that are identified by a fixed length value (see cid.ID type).
|
||||||
// Instances for existing containers can be initialized using decoding methods
|
// Instances for existing containers can be initialized using decoding methods
|
||||||
// (e.g Unmarshal).
|
// (e.g Unmarshal).
|
||||||
|
@ -137,7 +137,7 @@ func (x *Container) readFromV2(m container.Container, checkFieldPresence bool) e
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads Container from the container.Container message. Checks if the
|
// ReadFromV2 reads Container from the container.Container message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *Container) ReadFromV2(m container.Container) error {
|
func (x *Container) ReadFromV2(m container.Container) error {
|
||||||
|
@ -152,7 +152,7 @@ func (x Container) WriteToV2(m *container.Container) {
|
||||||
*m = x.v2
|
*m = x.v2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes Container into a binary format of the NeoFS API protocol
|
// Marshal encodes Container into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers with direct field order).
|
// (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -160,7 +160,7 @@ func (x Container) Marshal() []byte {
|
||||||
return x.v2.StableMarshal(nil)
|
return x.v2.StableMarshal(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes NeoFS API protocol binary format into the Container
|
// Unmarshal decodes FrostFS API protocol binary format into the Container
|
||||||
// (Protocol Buffers with direct field order). Returns an error describing
|
// (Protocol Buffers with direct field order). Returns an error describing
|
||||||
// a format violation.
|
// a format violation.
|
||||||
//
|
//
|
||||||
|
@ -176,7 +176,7 @@ func (x *Container) Unmarshal(data []byte) error {
|
||||||
return x.readFromV2(m, false)
|
return x.readFromV2(m, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes Container into a JSON format of the NeoFS API protocol
|
// MarshalJSON encodes Container into a JSON format of the FrostFS API protocol
|
||||||
// (Protocol Buffers JSON).
|
// (Protocol Buffers JSON).
|
||||||
//
|
//
|
||||||
// See also UnmarshalJSON.
|
// See also UnmarshalJSON.
|
||||||
|
@ -184,7 +184,7 @@ func (x Container) MarshalJSON() ([]byte, error) {
|
||||||
return x.v2.MarshalJSON()
|
return x.v2.MarshalJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON decodes NeoFS API protocol JSON format into the Container
|
// UnmarshalJSON decodes FrostFS API protocol JSON format into the Container
|
||||||
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also MarshalJSON.
|
// See also MarshalJSON.
|
||||||
|
@ -192,7 +192,7 @@ func (x *Container) UnmarshalJSON(data []byte) error {
|
||||||
return x.v2.UnmarshalJSON(data)
|
return x.v2.UnmarshalJSON(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init initializes all internal data of the Container required by NeoFS API
|
// Init initializes all internal data of the Container required by FrostFS API
|
||||||
// protocol. Init MUST be called when creating a new container. Init SHOULD NOT
|
// protocol. Init MUST be called when creating a new container. Init SHOULD NOT
|
||||||
// be called multiple times. Init SHOULD NOT be called if the Container instance
|
// be called multiple times. Init SHOULD NOT be called if the Container instance
|
||||||
// is used for decoding only.
|
// is used for decoding only.
|
||||||
|
@ -212,7 +212,7 @@ func (x *Container) Init() {
|
||||||
|
|
||||||
// SetOwner specifies the owner of the Container. Each Container has exactly
|
// SetOwner specifies the owner of the Container. Each Container has exactly
|
||||||
// one owner, so SetOwner MUST be called for instances to be saved in the
|
// one owner, so SetOwner MUST be called for instances to be saved in the
|
||||||
// NeoFS.
|
// FrostFS.
|
||||||
//
|
//
|
||||||
// See also Owner.
|
// See also Owner.
|
||||||
func (x *Container) SetOwner(owner user.ID) {
|
func (x *Container) SetOwner(owner user.ID) {
|
||||||
|
@ -224,7 +224,7 @@ func (x *Container) SetOwner(owner user.ID) {
|
||||||
|
|
||||||
// Owner returns owner of the Container set using SetOwner.
|
// Owner returns owner of the Container set using SetOwner.
|
||||||
//
|
//
|
||||||
// Zero Container has no owner which is incorrect according to NeoFS API
|
// Zero Container has no owner which is incorrect according to FrostFS API
|
||||||
// protocol.
|
// protocol.
|
||||||
func (x Container) Owner() (res user.ID) {
|
func (x Container) Owner() (res user.ID) {
|
||||||
m := x.v2.GetOwnerID()
|
m := x.v2.GetOwnerID()
|
||||||
|
@ -256,7 +256,7 @@ func (x Container) BasicACL() (res acl.Basic) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPlacementPolicy sets placement policy for the objects within the Container.
|
// SetPlacementPolicy sets placement policy for the objects within the Container.
|
||||||
// NeoFS storage layer strives to follow the specified policy.
|
// FrostFS storage layer strives to follow the specified policy.
|
||||||
//
|
//
|
||||||
// See also PlacementPolicy.
|
// See also PlacementPolicy.
|
||||||
func (x *Container) SetPlacementPolicy(policy netmap.PlacementPolicy) {
|
func (x *Container) SetPlacementPolicy(policy netmap.PlacementPolicy) {
|
||||||
|
@ -269,7 +269,7 @@ func (x *Container) SetPlacementPolicy(policy netmap.PlacementPolicy) {
|
||||||
// PlacementPolicy returns placement policy set using SetPlacementPolicy.
|
// PlacementPolicy returns placement policy set using SetPlacementPolicy.
|
||||||
//
|
//
|
||||||
// Zero Container has no placement policy which is incorrect according to
|
// Zero Container has no placement policy which is incorrect according to
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
func (x Container) PlacementPolicy() (res netmap.PlacementPolicy) {
|
func (x Container) PlacementPolicy() (res netmap.PlacementPolicy) {
|
||||||
m := x.v2.GetPlacementPolicy()
|
m := x.v2.GetPlacementPolicy()
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -284,7 +284,7 @@ func (x Container) PlacementPolicy() (res netmap.PlacementPolicy) {
|
||||||
|
|
||||||
// SetAttribute sets Container attribute value by key. Both key and value
|
// SetAttribute sets Container attribute value by key. Both key and value
|
||||||
// MUST NOT be empty. Attributes set by the creator (owner) are most commonly
|
// MUST NOT be empty. Attributes set by the creator (owner) are most commonly
|
||||||
// ignored by the NeoFS system and used for application layer. Some attributes
|
// ignored by the FrostFS system and used for application layer. Some attributes
|
||||||
// are so-called system or well-known attributes: they are reserved for system
|
// are so-called system or well-known attributes: they are reserved for system
|
||||||
// needs. System attributes SHOULD NOT be modified using SetAttribute, use
|
// needs. System attributes SHOULD NOT be modified using SetAttribute, use
|
||||||
// corresponding methods/functions. List of the reserved keys is documented
|
// corresponding methods/functions. List of the reserved keys is documented
|
||||||
|
@ -383,7 +383,7 @@ func CreatedAt(cnr Container) time.Time {
|
||||||
return time.Unix(sec, 0)
|
return time.Unix(sec, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSubnet places the Container on the specified NeoFS subnet. If called,
|
// SetSubnet places the Container on the specified FrostFS subnet. If called,
|
||||||
// container nodes will only be selected from the given subnet, otherwise from
|
// container nodes will only be selected from the given subnet, otherwise from
|
||||||
// the entire network.
|
// the entire network.
|
||||||
func SetSubnet(cnr *Container, subNet subnetid.ID) {
|
func SetSubnet(cnr *Container, subNet subnetid.ID) {
|
||||||
|
@ -423,7 +423,7 @@ func IsHomomorphicHashingDisabled(cnr Container) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Domain represents information about container domain registered in the NNS
|
// Domain represents information about container domain registered in the NNS
|
||||||
// contract deployed in the NeoFS network.
|
// contract deployed in the FrostFS network.
|
||||||
type Domain struct {
|
type Domain struct {
|
||||||
name, zone string
|
name, zone string
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ func ReadDomain(cnr Container) (res Domain) {
|
||||||
// CalculateSignature calculates signature of the Container using provided signer
|
// CalculateSignature calculates signature of the Container using provided signer
|
||||||
// and writes it into dst. Signature instance MUST NOT be nil. CalculateSignature
|
// and writes it into dst. Signature instance MUST NOT be nil. CalculateSignature
|
||||||
// is expected to be called after all the Container data is filled and before
|
// is expected to be called after all the Container data is filled and before
|
||||||
// saving the Container in the NeoFS network. Note that мany subsequent change
|
// saving the Container in the FrostFS network. Note that мany subsequent change
|
||||||
// will most likely break the signature.
|
// will most likely break the signature.
|
||||||
//
|
//
|
||||||
// See also VerifySignature.
|
// See also VerifySignature.
|
||||||
|
@ -492,7 +492,7 @@ func VerifySignature(sig frostfscrypto.Signature, cnr Container) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CalculateIDFromBinary calculates identifier of the binary-encoded container
|
// CalculateIDFromBinary calculates identifier of the binary-encoded container
|
||||||
// in CAS of the NeoFS containers and writes it into dst. ID instance MUST NOT
|
// in CAS of the FrostFS containers and writes it into dst. ID instance MUST NOT
|
||||||
// be nil.
|
// be nil.
|
||||||
//
|
//
|
||||||
// See also CalculateID, AssertID.
|
// See also CalculateID, AssertID.
|
||||||
|
@ -509,7 +509,7 @@ func CalculateID(dst *cid.ID, cnr Container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssertID checks if the given Container matches its identifier in CAS of the
|
// AssertID checks if the given Container matches its identifier in CAS of the
|
||||||
// NeoFS containers.
|
// FrostFS containers.
|
||||||
//
|
//
|
||||||
// See also CalculateID.
|
// See also CalculateID.
|
||||||
func AssertID(id cid.ID, cnr Container) bool {
|
func AssertID(id cid.ID, cnr Container) bool {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Package container provides functionality related to the NeoFS containers.
|
Package container provides functionality related to the FrostFS containers.
|
||||||
|
|
||||||
The base type is Container. To create new container in the NeoFS network
|
The base type is Container. To create new container in the FrostFS network
|
||||||
Container instance should be initialized
|
Container instance should be initialized
|
||||||
|
|
||||||
var cnr Container
|
var cnr Container
|
||||||
|
@ -10,7 +10,7 @@ Container instance should be initialized
|
||||||
|
|
||||||
// encode cnr and send
|
// encode cnr and send
|
||||||
|
|
||||||
After the container is persisted in the NeoFS network, applications can process
|
After the container is persisted in the FrostFS network, applications can process
|
||||||
it using the instance of Container types
|
it using the instance of Container types
|
||||||
|
|
||||||
// recv binary container
|
// recv binary container
|
||||||
|
@ -22,7 +22,7 @@ it using the instance of Container types
|
||||||
|
|
||||||
// process the container data
|
// process the container data
|
||||||
|
|
||||||
Instances can be also used to process NeoFS API V2 protocol messages
|
Instances can be also used to process FrostFS API V2 protocol messages
|
||||||
(see neo.fs.v2.container package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.container package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package cid provides primitives to work with container identification in NeoFS.
|
Package cid provides primitives to work with container identification in FrostFS.
|
||||||
|
|
||||||
Using package types in an application is recommended to potentially work with
|
Using package types in an application is recommended to potentially work with
|
||||||
different protocol versions with which these types are compatible.
|
different protocol versions with which these types are compatible.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID represents NeoFS container identifier.
|
// ID represents FrostFS container identifier.
|
||||||
//
|
//
|
||||||
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.ContainerID
|
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.ContainerID
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
|
@ -22,7 +22,7 @@ type ID [sha256.Size]byte
|
||||||
|
|
||||||
// ReadFromV2 reads ID from the refs.ContainerID message.
|
// ReadFromV2 reads ID from the refs.ContainerID message.
|
||||||
// Returns an error if the message is malformed according
|
// Returns an error if the message is malformed according
|
||||||
// to the NeoFS API V2 protocol.
|
// to the FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (id *ID) ReadFromV2(m refs.ContainerID) error {
|
func (id *ID) ReadFromV2(m refs.ContainerID) error {
|
||||||
|
@ -83,7 +83,7 @@ func (id ID) Equals(id2 ID) bool {
|
||||||
return id == id2
|
return id == id2
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeToString encodes ID into NeoFS API protocol string.
|
// EncodeToString encodes ID into FrostFS API protocol string.
|
||||||
//
|
//
|
||||||
// Zero ID is base58 encoding of 32 zeros.
|
// Zero ID is base58 encoding of 32 zeros.
|
||||||
//
|
//
|
||||||
|
@ -92,7 +92,7 @@ func (id ID) EncodeToString() string {
|
||||||
return base58.Encode(id[:])
|
return base58.Encode(id[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeString decodes string into ID according to NeoFS API protocol. Returns
|
// DecodeString decodes string into ID according to FrostFS API protocol. Returns
|
||||||
// an error if s is malformed.
|
// an error if s is malformed.
|
||||||
//
|
//
|
||||||
// See also DecodeString.
|
// See also DecodeString.
|
||||||
|
@ -109,7 +109,7 @@ func (id *ID) DecodeString(s string) error {
|
||||||
//
|
//
|
||||||
// String is designed to be human-readable, and its format MAY differ between
|
// String is designed to be human-readable, and its format MAY differ between
|
||||||
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
||||||
// be used to encode ID into NeoFS protocol string.
|
// be used to encode ID into FrostFS protocol string.
|
||||||
func (id ID) String() string {
|
func (id ID) String() string {
|
||||||
return id.EncodeToString()
|
return id.EncodeToString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// SizeEstimation groups information about estimation of the size of the data
|
// SizeEstimation groups information about estimation of the size of the data
|
||||||
// stored in the NeoFS container.
|
// stored in the FrostFS container.
|
||||||
//
|
//
|
||||||
// SizeEstimation is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/container.UsedSpaceAnnouncement
|
// SizeEstimation is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/container.UsedSpaceAnnouncement
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
|
@ -19,7 +19,7 @@ type SizeEstimation struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads SizeEstimation from the container.UsedSpaceAnnouncement message.
|
// ReadFromV2 reads SizeEstimation from the container.UsedSpaceAnnouncement message.
|
||||||
// Checks if the message conforms to NeoFS API V2 protocol.
|
// Checks if the message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *SizeEstimation) ReadFromV2(m container.UsedSpaceAnnouncement) error {
|
func (x *SizeEstimation) ReadFromV2(m container.UsedSpaceAnnouncement) error {
|
||||||
|
@ -63,7 +63,7 @@ func (x SizeEstimation) Epoch() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer specifies the container for which the amount of data is estimated.
|
// SetContainer specifies the container for which the amount of data is estimated.
|
||||||
// Required by the NeoFS API protocol.
|
// Required by the FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// See also Container.
|
// See also Container.
|
||||||
func (x *SizeEstimation) SetContainer(cnr cid.ID) {
|
func (x *SizeEstimation) SetContainer(cnr cid.ID) {
|
||||||
|
@ -76,7 +76,7 @@ func (x *SizeEstimation) SetContainer(cnr cid.ID) {
|
||||||
// Container returns container set using SetContainer.
|
// Container returns container set using SetContainer.
|
||||||
//
|
//
|
||||||
// Zero SizeEstimation is not bound to any container (returns zero) which is
|
// Zero SizeEstimation is not bound to any container (returns zero) which is
|
||||||
// incorrect according to NeoFS API protocol.
|
// incorrect according to FrostFS API protocol.
|
||||||
func (x SizeEstimation) Container() (res cid.ID) {
|
func (x SizeEstimation) Container() (res cid.ID) {
|
||||||
m := x.m.GetContainerID()
|
m := x.m.GetContainerID()
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Package frostfscrypto collects NeoFS cryptographic primitives.
|
Package frostfscrypto collects FrostFS cryptographic primitives.
|
||||||
|
|
||||||
Signer type unifies entities for signing NeoFS data.
|
Signer type unifies entities for signing FrostFS data.
|
||||||
|
|
||||||
// instantiate Signer
|
// instantiate Signer
|
||||||
// select data to be signed
|
// select data to be signed
|
||||||
|
@ -24,7 +24,7 @@ PublicKey allows to verify signatures.
|
||||||
isValid := sig.Verify(data)
|
isValid := sig.Verify(data)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
Signature can be also used to process NeoFS API V2 protocol messages
|
Signature can be also used to process FrostFS API V2 protocol messages
|
||||||
(see neo.fs.v2.refs package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.refs package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package frostfsecdsa collects ECDSA primitives for NeoFS cryptography.
|
Package frostfsecdsa collects ECDSA primitives for FrostFS cryptography.
|
||||||
|
|
||||||
Signer and PublicKey support ECDSA signature algorithm with SHA-512 hashing.
|
Signer and PublicKey support ECDSA signature algorithm with SHA-512 hashing.
|
||||||
SignerRFC6979 and PublicKeyRFC6979 implement signature algorithm described in RFC 6979.
|
SignerRFC6979 and PublicKeyRFC6979 implement signature algorithm described in RFC 6979.
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PublicKey is a wrapper over ecdsa.PublicKey used for NeoFS needs.
|
// PublicKey is a wrapper over ecdsa.PublicKey used for FrostFS needs.
|
||||||
// Provides frostfscrypto.PublicKey interface.
|
// Provides frostfscrypto.PublicKey interface.
|
||||||
//
|
//
|
||||||
// Instances MUST be initialized from ecdsa.PublicKey using type conversion.
|
// Instances MUST be initialized from ecdsa.PublicKey using type conversion.
|
||||||
|
@ -77,7 +77,7 @@ func (x PublicKey) Verify(data, signature []byte) bool {
|
||||||
return r != nil && s != nil && ecdsa.Verify((*ecdsa.PublicKey)(&x), h[:], r, s)
|
return r != nil && s != nil && ecdsa.Verify((*ecdsa.PublicKey)(&x), h[:], r, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublicKeyRFC6979 is a wrapper over ecdsa.PublicKey used for NeoFS needs.
|
// PublicKeyRFC6979 is a wrapper over ecdsa.PublicKey used for FrostFS needs.
|
||||||
// Provides frostfscrypto.PublicKey interface.
|
// Provides frostfscrypto.PublicKey interface.
|
||||||
//
|
//
|
||||||
// Instances MUST be initialized from ecdsa.PublicKey using type conversion.
|
// Instances MUST be initialized from ecdsa.PublicKey using type conversion.
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (x SignerWalletConnect) Public() frostfscrypto.PublicKey {
|
||||||
return (*PublicKeyWalletConnect)(&x.PublicKey)
|
return (*PublicKeyWalletConnect)(&x.PublicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublicKeyWalletConnect is a wrapper over ecdsa.PublicKey used for NeoFS needs.
|
// PublicKeyWalletConnect is a wrapper over ecdsa.PublicKey used for FrostFS needs.
|
||||||
// Provides frostfscrypto.PublicKey interface.
|
// Provides frostfscrypto.PublicKey interface.
|
||||||
//
|
//
|
||||||
// Instances MUST be initialized from ecdsa.PublicKey using type conversion.
|
// Instances MUST be initialized from ecdsa.PublicKey using type conversion.
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
type Signature refs.Signature
|
type Signature refs.Signature
|
||||||
|
|
||||||
// ReadFromV2 reads Signature from the refs.Signature message. Checks if the
|
// ReadFromV2 reads Signature from the refs.Signature message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *Signature) ReadFromV2(m refs.Signature) error {
|
func (x *Signature) ReadFromV2(m refs.Signature) error {
|
||||||
|
|
|
@ -45,7 +45,7 @@ func RegisterScheme(scheme Scheme, f func() PublicKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signer is an interface of entities that can be used for signing operations
|
// Signer is an interface of entities that can be used for signing operations
|
||||||
// in NeoFS. Unites secret and public parts. For example, an ECDSA private key
|
// in FrostFS. Unites secret and public parts. For example, an ECDSA private key
|
||||||
// or external auth service.
|
// or external auth service.
|
||||||
//
|
//
|
||||||
// See also PublicKey.
|
// See also PublicKey.
|
||||||
|
@ -63,7 +63,7 @@ type Signer interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublicKey represents a public key using fixed signature scheme supported by
|
// PublicKey represents a public key using fixed signature scheme supported by
|
||||||
// NeoFS.
|
// FrostFS.
|
||||||
//
|
//
|
||||||
// See also Signer.
|
// See also Signer.
|
||||||
type PublicKey interface {
|
type PublicKey interface {
|
||||||
|
|
|
@ -38,12 +38,12 @@ func (r Record) Filters() []Filter {
|
||||||
return r.filters
|
return r.filters
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operation returns NeoFS request verb to match.
|
// Operation returns FrostFS request verb to match.
|
||||||
func (r Record) Operation() Operation {
|
func (r Record) Operation() Operation {
|
||||||
return r.operation
|
return r.operation
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOperation sets NeoFS request verb to match.
|
// SetOperation sets FrostFS request verb to match.
|
||||||
func (r *Record) SetOperation(operation Operation) {
|
func (r *Record) SetOperation(operation Operation) {
|
||||||
r.operation = operation
|
r.operation = operation
|
||||||
}
|
}
|
||||||
|
|
30
go.mod
30
go.mod
|
@ -1,41 +1,41 @@
|
||||||
module github.com/TrueCloudLab/frostfs-sdk-go
|
module github.com/TrueCloudLab/frostfs-sdk-go
|
||||||
|
|
||||||
go 1.17
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/TrueCloudLab/frostfs-api-go/v2 v2.0.0-20221212144048-1351b6656d68
|
github.com/TrueCloudLab/frostfs-api-go/v2 v2.0.0-20221212144048-1351b6656d68
|
||||||
github.com/TrueCloudLab/frostfs-contract v0.0.0-20221213081248-6c805c1b4e42
|
github.com/TrueCloudLab/frostfs-contract v0.0.0-20221213081248-6c805c1b4e42
|
||||||
github.com/TrueCloudLab/hrw v1.1.0
|
github.com/TrueCloudLab/hrw v1.1.0
|
||||||
github.com/TrueCloudLab/tzhash v1.7.0
|
github.com/TrueCloudLab/tzhash v1.7.0
|
||||||
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10
|
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/hashicorp/golang-lru v0.5.4
|
github.com/hashicorp/golang-lru v0.6.0
|
||||||
github.com/mr-tron/base58 v1.2.0
|
github.com/mr-tron/base58 v1.2.0
|
||||||
github.com/nspcc-dev/neo-go v0.99.4
|
github.com/nspcc-dev/neo-go v0.100.1
|
||||||
github.com/stretchr/testify v1.8.0
|
github.com/stretchr/testify v1.8.1
|
||||||
go.uber.org/atomic v1.10.0
|
go.uber.org/atomic v1.10.0
|
||||||
go.uber.org/zap v1.23.0
|
go.uber.org/zap v1.24.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/TrueCloudLab/frostfs-crypto v0.5.0 // indirect
|
github.com/TrueCloudLab/frostfs-crypto v0.5.0 // indirect
|
||||||
github.com/TrueCloudLab/rfc6979 v0.3.0 // indirect
|
github.com/TrueCloudLab/rfc6979 v0.3.0 // indirect
|
||||||
github.com/btcsuite/btcd v0.22.0-beta // indirect
|
|
||||||
github.com/coreos/go-semver v0.3.0 // indirect
|
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/gorilla/websocket v1.4.2 // indirect
|
github.com/gorilla/websocket v1.4.2 // indirect
|
||||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect
|
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect
|
||||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 // indirect
|
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb // indirect
|
||||||
github.com/nspcc-dev/rfc6979 v0.2.0 // indirect
|
github.com/nspcc-dev/rfc6979 v0.2.0 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||||
go.uber.org/multierr v1.8.0 // indirect
|
go.uber.org/multierr v1.9.0 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
|
golang.org/x/crypto v0.4.0 // indirect
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
|
golang.org/x/exp v0.0.0-20221227203929-1b447090c38c // indirect
|
||||||
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
|
golang.org/x/net v0.3.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/sys v0.3.0 // indirect
|
||||||
|
golang.org/x/text v0.5.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
|
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
|
||||||
google.golang.org/grpc v1.48.0 // indirect
|
google.golang.org/grpc v1.48.0 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
|
|
BIN
go.sum
BIN
go.sum
Binary file not shown.
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
Package netmap provides functionality for working with information about the
|
Package netmap provides functionality for working with information about the
|
||||||
NeoFS network, primarily a layer of storage nodes.
|
FrostFS network, primarily a layer of storage nodes.
|
||||||
|
|
||||||
The package concentrates all the characteristics of NeoFS networks.
|
The package concentrates all the characteristics of FrostFS networks.
|
||||||
|
|
||||||
NetMap represents NeoFS network map - one of the main technologies used to
|
NetMap represents FrostFS network map - one of the main technologies used to
|
||||||
store data in the system. It is composed of information about all storage nodes
|
store data in the system. It is composed of information about all storage nodes
|
||||||
(NodeInfo type) in a particular network. NetMap methods allow you to impose
|
(NodeInfo type) in a particular network. NetMap methods allow you to impose
|
||||||
container storage policies (PlacementPolicy type) on a fixed composition of
|
container storage policies (PlacementPolicy type) on a fixed composition of
|
||||||
|
@ -14,7 +14,7 @@ container creator.
|
||||||
NetworkInfo type is dedicated to descriptive characterization of network state
|
NetworkInfo type is dedicated to descriptive characterization of network state
|
||||||
and settings.
|
and settings.
|
||||||
|
|
||||||
Instances can be also used to process NeoFS API V2 protocol messages
|
Instances can be also used to process FrostFS API V2 protocol messages
|
||||||
(see neo.fs.v2.netmap package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.netmap package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"github.com/TrueCloudLab/hrw"
|
"github.com/TrueCloudLab/hrw"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NetMap represents NeoFS network map. It includes information about all
|
// NetMap represents FrostFS network map. It includes information about all
|
||||||
// storage nodes registered in NeoFS the network.
|
// storage nodes registered in FrostFS the network.
|
||||||
//
|
//
|
||||||
// NetMap is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/netmap.NetMap
|
// NetMap is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/netmap.NetMap
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
|
@ -21,7 +21,7 @@ type NetMap struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads NetMap from the netmap.NetMap message. Checks if the
|
// ReadFromV2 reads NetMap from the netmap.NetMap message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (m *NetMap) ReadFromV2(msg netmap.NetMap) error {
|
func (m *NetMap) ReadFromV2(msg netmap.NetMap) error {
|
||||||
|
@ -66,7 +66,7 @@ func (m NetMap) WriteToV2(msg *netmap.NetMap) {
|
||||||
msg.SetEpoch(m.epoch)
|
msg.SetEpoch(m.epoch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNodes sets information list about all storage nodes from the NeoFS network.
|
// SetNodes sets information list about all storage nodes from the FrostFS network.
|
||||||
//
|
//
|
||||||
// Argument MUST NOT be mutated, make a copy first.
|
// Argument MUST NOT be mutated, make a copy first.
|
||||||
//
|
//
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NetworkInfo groups information about the NeoFS network state. Mainly used to
|
// NetworkInfo groups information about the FrostFS network state. Mainly used to
|
||||||
// describe the current state of the network.
|
// describe the current state of the network.
|
||||||
//
|
//
|
||||||
// NetworkInfo is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/netmap.NetworkInfo
|
// NetworkInfo is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/netmap.NetworkInfo
|
||||||
|
@ -24,7 +24,7 @@ type NetworkInfo struct {
|
||||||
|
|
||||||
// reads NetworkInfo from netmap.NetworkInfo message. If checkFieldPresence is set,
|
// reads NetworkInfo from netmap.NetworkInfo message. If checkFieldPresence is set,
|
||||||
// returns an error on absence of any protocol-required field. Verifies format of any
|
// returns an error on absence of any protocol-required field. Verifies format of any
|
||||||
// presented field according to NeoFS API V2 protocol.
|
// presented field according to FrostFS API V2 protocol.
|
||||||
func (x *NetworkInfo) readFromV2(m netmap.NetworkInfo, checkFieldPresence bool) error {
|
func (x *NetworkInfo) readFromV2(m netmap.NetworkInfo, checkFieldPresence bool) error {
|
||||||
c := m.GetNetworkConfig()
|
c := m.GetNetworkConfig()
|
||||||
if checkFieldPresence && c == nil {
|
if checkFieldPresence && c == nil {
|
||||||
|
@ -97,7 +97,7 @@ func (x *NetworkInfo) readFromV2(m netmap.NetworkInfo, checkFieldPresence bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads NetworkInfo from the netmap.NetworkInfo message. Checks if the
|
// ReadFromV2 reads NetworkInfo from the netmap.NetworkInfo message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *NetworkInfo) ReadFromV2(m netmap.NetworkInfo) error {
|
func (x *NetworkInfo) ReadFromV2(m netmap.NetworkInfo) error {
|
||||||
|
@ -119,7 +119,7 @@ func (x NetworkInfo) CurrentEpoch() uint64 {
|
||||||
return x.m.GetCurrentEpoch()
|
return x.m.GetCurrentEpoch()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCurrentEpoch sets current epoch of the NeoFS network.
|
// SetCurrentEpoch sets current epoch of the FrostFS network.
|
||||||
func (x *NetworkInfo) SetCurrentEpoch(epoch uint64) {
|
func (x *NetworkInfo) SetCurrentEpoch(epoch uint64) {
|
||||||
x.m.SetCurrentEpoch(epoch)
|
x.m.SetCurrentEpoch(epoch)
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ func (x NetworkInfo) MagicNumber() uint64 {
|
||||||
return x.m.GetMagicNumber()
|
return x.m.GetMagicNumber()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMagicNumber sets magic number of the NeoFS Sidechain.
|
// SetMagicNumber sets magic number of the FrostFS Sidechain.
|
||||||
//
|
//
|
||||||
// See also MagicNumber.
|
// See also MagicNumber.
|
||||||
func (x *NetworkInfo) SetMagicNumber(epoch uint64) {
|
func (x *NetworkInfo) SetMagicNumber(epoch uint64) {
|
||||||
|
@ -143,7 +143,7 @@ func (x NetworkInfo) MsPerBlock() int64 {
|
||||||
return x.m.GetMsPerBlock()
|
return x.m.GetMsPerBlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMsPerBlock sets MillisecondsPerBlock network parameter of the NeoFS Sidechain.
|
// SetMsPerBlock sets MillisecondsPerBlock network parameter of the FrostFS Sidechain.
|
||||||
//
|
//
|
||||||
// See also MsPerBlock.
|
// See also MsPerBlock.
|
||||||
func (x *NetworkInfo) SetMsPerBlock(v int64) {
|
func (x *NetworkInfo) SetMsPerBlock(v int64) {
|
||||||
|
@ -203,8 +203,8 @@ func (x NetworkInfo) configValue(name string) (res []byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRawNetworkParameter sets named NeoFS network parameter whose value is
|
// SetRawNetworkParameter sets named FrostFS network parameter whose value is
|
||||||
// transmitted but not interpreted by the NeoFS API protocol.
|
// transmitted but not interpreted by the FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Argument MUST NOT be mutated, make a copy first.
|
// Argument MUST NOT be mutated, make a copy first.
|
||||||
//
|
//
|
||||||
|
@ -441,8 +441,8 @@ func (x NetworkInfo) NumberOfEigenTrustIterations() uint64 {
|
||||||
|
|
||||||
const configEpochDuration = "EpochDuration"
|
const configEpochDuration = "EpochDuration"
|
||||||
|
|
||||||
// SetEpochDuration sets NeoFS epoch duration measured in number of blocks of
|
// SetEpochDuration sets FrostFS epoch duration measured in number of blocks of
|
||||||
// the NeoFS Sidechain.
|
// the FrostFS Sidechain.
|
||||||
//
|
//
|
||||||
// See also EpochDuration.
|
// See also EpochDuration.
|
||||||
func (x *NetworkInfo) SetEpochDuration(blocks uint64) {
|
func (x *NetworkInfo) SetEpochDuration(blocks uint64) {
|
||||||
|
@ -492,7 +492,7 @@ func (x NetworkInfo) MaxObjectSize() uint64 {
|
||||||
|
|
||||||
const configWithdrawalFee = "WithdrawFee"
|
const configWithdrawalFee = "WithdrawFee"
|
||||||
|
|
||||||
// SetWithdrawalFee sets fee for withdrawals from the NeoFS accounts that
|
// SetWithdrawalFee sets fee for withdrawals from the FrostFS accounts that
|
||||||
// account owners pay to each Alphabet node.
|
// account owners pay to each Alphabet node.
|
||||||
//
|
//
|
||||||
// See also WithdrawalFee.
|
// See also WithdrawalFee.
|
||||||
|
|
|
@ -14,9 +14,9 @@ import (
|
||||||
"github.com/TrueCloudLab/hrw"
|
"github.com/TrueCloudLab/hrw"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeInfo groups information about NeoFS storage node which is reflected
|
// NodeInfo groups information about FrostFS storage node which is reflected
|
||||||
// in the NeoFS network map. Storage nodes advertise this information when
|
// in the FrostFS network map. Storage nodes advertise this information when
|
||||||
// registering with the NeoFS network. After successful registration, information
|
// registering with the FrostFS network. After successful registration, information
|
||||||
// about the nodes is available to all network participants to work with the network
|
// about the nodes is available to all network participants to work with the network
|
||||||
// map (mainly to comply with container storage policies).
|
// map (mainly to comply with container storage policies).
|
||||||
//
|
//
|
||||||
|
@ -30,7 +30,7 @@ type NodeInfo struct {
|
||||||
|
|
||||||
// reads NodeInfo from netmap.NodeInfo message. If checkFieldPresence is set,
|
// reads NodeInfo from netmap.NodeInfo message. If checkFieldPresence is set,
|
||||||
// returns an error on absence of any protocol-required field. Verifies format of any
|
// returns an error on absence of any protocol-required field. Verifies format of any
|
||||||
// presented field according to NeoFS API V2 protocol.
|
// presented field according to FrostFS API V2 protocol.
|
||||||
func (x *NodeInfo) readFromV2(m netmap.NodeInfo, checkFieldPresence bool) error {
|
func (x *NodeInfo) readFromV2(m netmap.NodeInfo, checkFieldPresence bool) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ func (x *NodeInfo) readFromV2(m netmap.NodeInfo, checkFieldPresence bool) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads NodeInfo from the netmap.NodeInfo message. Checks if the
|
// ReadFromV2 reads NodeInfo from the netmap.NodeInfo message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *NodeInfo) ReadFromV2(m netmap.NodeInfo) error {
|
func (x *NodeInfo) ReadFromV2(m netmap.NodeInfo) error {
|
||||||
|
@ -106,7 +106,7 @@ func (x NodeInfo) WriteToV2(m *netmap.NodeInfo) {
|
||||||
*m = x.m
|
*m = x.m
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes NodeInfo into a binary format of the NeoFS API protocol
|
// Marshal encodes NodeInfo into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers with direct field order).
|
// (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -117,7 +117,7 @@ func (x NodeInfo) Marshal() []byte {
|
||||||
return m.StableMarshal(nil)
|
return m.StableMarshal(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes NeoFS API protocol binary format into the NodeInfo
|
// Unmarshal decodes FrostFS API protocol binary format into the NodeInfo
|
||||||
// (Protocol Buffers with direct field order). Returns an error describing
|
// (Protocol Buffers with direct field order). Returns an error describing
|
||||||
// a format violation.
|
// a format violation.
|
||||||
//
|
//
|
||||||
|
@ -133,7 +133,7 @@ func (x *NodeInfo) Unmarshal(data []byte) error {
|
||||||
return x.readFromV2(m, false)
|
return x.readFromV2(m, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes NodeInfo into a JSON format of the NeoFS API protocol
|
// MarshalJSON encodes NodeInfo into a JSON format of the FrostFS API protocol
|
||||||
// (Protocol Buffers JSON).
|
// (Protocol Buffers JSON).
|
||||||
//
|
//
|
||||||
// See also UnmarshalJSON.
|
// See also UnmarshalJSON.
|
||||||
|
@ -144,7 +144,7 @@ func (x NodeInfo) MarshalJSON() ([]byte, error) {
|
||||||
return m.MarshalJSON()
|
return m.MarshalJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON decodes NeoFS API protocol JSON format into the NodeInfo
|
// UnmarshalJSON decodes FrostFS API protocol JSON format into the NodeInfo
|
||||||
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also MarshalJSON.
|
// See also MarshalJSON.
|
||||||
|
@ -172,7 +172,7 @@ func (x *NodeInfo) SetPublicKey(key []byte) {
|
||||||
// PublicKey returns value set using SetPublicKey.
|
// PublicKey returns value set using SetPublicKey.
|
||||||
//
|
//
|
||||||
// Zero NodeInfo has no public key, which is incorrect according to
|
// Zero NodeInfo has no public key, which is incorrect according to
|
||||||
// NeoFS system requirements.
|
// FrostFS system requirements.
|
||||||
//
|
//
|
||||||
// Return value MUST not be mutated, make a copy first.
|
// Return value MUST not be mutated, make a copy first.
|
||||||
func (x NodeInfo) PublicKey() []byte {
|
func (x NodeInfo) PublicKey() []byte {
|
||||||
|
@ -186,7 +186,7 @@ func StringifyPublicKey(node NodeInfo) string {
|
||||||
|
|
||||||
// SetNetworkEndpoints sets list to the announced node's network endpoints.
|
// SetNetworkEndpoints sets list to the announced node's network endpoints.
|
||||||
// Node MUSt have at least one announced endpoint. List MUST be unique.
|
// Node MUSt have at least one announced endpoint. List MUST be unique.
|
||||||
// Endpoints are used for communication with the storage node within NeoFS
|
// Endpoints are used for communication with the storage node within FrostFS
|
||||||
// network. It is expected that node serves storage node services on these
|
// network. It is expected that node serves storage node services on these
|
||||||
// endpoints (it also adds a wait on their network availability).
|
// endpoints (it also adds a wait on their network availability).
|
||||||
//
|
//
|
||||||
|
@ -209,7 +209,7 @@ func (x NodeInfo) NumberOfNetworkEndpoints() int {
|
||||||
// MUST NOT be nil.
|
// MUST NOT be nil.
|
||||||
//
|
//
|
||||||
// Zero NodeInfo contains no endpoints which is incorrect according to
|
// Zero NodeInfo contains no endpoints which is incorrect according to
|
||||||
// NeoFS system requirements.
|
// FrostFS system requirements.
|
||||||
//
|
//
|
||||||
// See also SetNetworkEndpoints.
|
// See also SetNetworkEndpoints.
|
||||||
func (x NodeInfo) IterateNetworkEndpoints(f func(string) bool) {
|
func (x NodeInfo) IterateNetworkEndpoints(f func(string) bool) {
|
||||||
|
@ -297,7 +297,7 @@ func (x NodeInfo) capacity() uint64 {
|
||||||
const attrUNLOCODE = "UN-LOCODE"
|
const attrUNLOCODE = "UN-LOCODE"
|
||||||
|
|
||||||
// SetLOCODE specifies node's geographic location in UN/LOCODE format. Each
|
// SetLOCODE specifies node's geographic location in UN/LOCODE format. Each
|
||||||
// storage node MUST declare it for entrance to the NeoFS network. Node MAY
|
// storage node MUST declare it for entrance to the FrostFS network. Node MAY
|
||||||
// declare the code of the nearest location as needed, for example, when it is
|
// declare the code of the nearest location as needed, for example, when it is
|
||||||
// impossible to unambiguously attribute the node to any location from UN/LOCODE
|
// impossible to unambiguously attribute the node to any location from UN/LOCODE
|
||||||
// database.
|
// database.
|
||||||
|
@ -310,7 +310,7 @@ func (x *NodeInfo) SetLOCODE(locode string) {
|
||||||
// LOCODE returns node's location code set using SetLOCODE.
|
// LOCODE returns node's location code set using SetLOCODE.
|
||||||
//
|
//
|
||||||
// Zero NodeInfo has empty location code which is invalid according to
|
// Zero NodeInfo has empty location code which is invalid according to
|
||||||
// NeoFS API system requirement.
|
// FrostFS API system requirement.
|
||||||
func (x NodeInfo) LOCODE() string {
|
func (x NodeInfo) LOCODE() string {
|
||||||
return x.Attribute(attrUNLOCODE)
|
return x.Attribute(attrUNLOCODE)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
package parser
|
package parser
|
||||||
|
|
||||||
//go:generate antlr4 -Dlanguage=Go -visitor QueryLexer.g4 Query.g4
|
// ANTLR can be downloaded from https://www.antlr.org/download/antlr-4.11.1-complete.jar
|
||||||
|
//go:generate java -Xmx500M -cp "./antlr-4.11.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Go -visitor QueryLexer.g4 Query.g4
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
import "github.com/antlr/antlr4/runtime/Go/antlr"
|
import "github.com/antlr/antlr4/runtime/Go/antlr/v4"
|
||||||
|
|
||||||
// BaseQueryListener is a complete listener for a parse tree produced by Query.
|
// BaseQueryListener is a complete listener for a parse tree produced by Query.
|
||||||
type BaseQueryListener struct{}
|
type BaseQueryListener struct{}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
import "github.com/antlr/antlr4/runtime/Go/antlr"
|
import "github.com/antlr/antlr4/runtime/Go/antlr/v4"
|
||||||
|
|
||||||
type BaseQueryVisitor struct {
|
type BaseQueryVisitor struct {
|
||||||
*antlr.BaseParseTreeVisitor
|
*antlr.BaseParseTreeVisitor
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated from QueryLexer.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser
|
package parser
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/antlr/antlr4/runtime/Go/antlr"
|
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Suppress unused import error
|
// Suppress unused import error
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
import "github.com/antlr/antlr4/runtime/Go/antlr"
|
import "github.com/antlr/antlr4/runtime/Go/antlr/v4"
|
||||||
|
|
||||||
// QueryListener is a complete listener for a parse tree produced by Query.
|
// QueryListener is a complete listener for a parse tree produced by Query.
|
||||||
type QueryListener interface {
|
type QueryListener interface {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/antlr/antlr4/runtime/Go/antlr"
|
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Suppress unused import errors
|
// Suppress unused import errors
|
||||||
|
@ -133,7 +133,7 @@ func NewQuery(input antlr.TokenStream) *Query {
|
||||||
this.RuleNames = staticData.ruleNames
|
this.RuleNames = staticData.ruleNames
|
||||||
this.LiteralNames = staticData.literalNames
|
this.LiteralNames = staticData.literalNames
|
||||||
this.SymbolicNames = staticData.symbolicNames
|
this.SymbolicNames = staticData.symbolicNames
|
||||||
this.GrammarFileName = "Query.g4"
|
this.GrammarFileName = "java-escape"
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
@ -2461,7 +2461,7 @@ func (p *Query) Keyword() (localctx IKeywordContext) {
|
||||||
p.SetState(119)
|
p.SetState(119)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<QueryREP)|(1<<QueryIN)|(1<<QueryAS)|(1<<QuerySELECT)|(1<<QueryFROM)|(1<<QueryFILTER))) != 0) {
|
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1904) != 0) {
|
||||||
p.GetErrorHandler().RecoverInline(p)
|
p.GetErrorHandler().RecoverInline(p)
|
||||||
} else {
|
} else {
|
||||||
p.GetErrorHandler().ReportMatch(p)
|
p.GetErrorHandler().ReportMatch(p)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
// Code generated from java-escape by ANTLR 4.11.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
import "github.com/antlr/antlr4/runtime/Go/antlr"
|
import "github.com/antlr/antlr4/runtime/Go/antlr/v4"
|
||||||
|
|
||||||
// A complete Visitor for a parse tree produced by Query.
|
// A complete Visitor for a parse tree produced by Query.
|
||||||
type QueryVisitor interface {
|
type QueryVisitor interface {
|
||||||
|
|
|
@ -11,12 +11,12 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/netmap/parser"
|
"github.com/TrueCloudLab/frostfs-sdk-go/netmap/parser"
|
||||||
subnetid "github.com/TrueCloudLab/frostfs-sdk-go/subnet/id"
|
subnetid "github.com/TrueCloudLab/frostfs-sdk-go/subnet/id"
|
||||||
"github.com/antlr/antlr4/runtime/Go/antlr"
|
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PlacementPolicy declares policy to store objects in the NeoFS container.
|
// PlacementPolicy declares policy to store objects in the FrostFS container.
|
||||||
// Within itself, PlacementPolicy represents a set of rules to select a subset
|
// Within itself, PlacementPolicy represents a set of rules to select a subset
|
||||||
// of nodes from NeoFS network map - node-candidates for object storage.
|
// of nodes from FrostFS network map - node-candidates for object storage.
|
||||||
//
|
//
|
||||||
// PlacementPolicy is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/netmap.PlacementPolicy
|
// PlacementPolicy is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/netmap.PlacementPolicy
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
|
@ -57,7 +57,7 @@ func (p *PlacementPolicy) readFromV2(m netmap.PlacementPolicy, checkFieldPresenc
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes PlacementPolicy into a binary format of the NeoFS API
|
// Marshal encodes PlacementPolicy into a binary format of the FrostFS API
|
||||||
// protocol (Protocol Buffers with direct field order).
|
// protocol (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -68,7 +68,7 @@ func (p PlacementPolicy) Marshal() []byte {
|
||||||
return m.StableMarshal(nil)
|
return m.StableMarshal(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes NeoFS API protocol binary format into the PlacementPolicy
|
// Unmarshal decodes FrostFS API protocol binary format into the PlacementPolicy
|
||||||
// (Protocol Buffers with direct field order). Returns an error describing
|
// (Protocol Buffers with direct field order). Returns an error describing
|
||||||
// a format violation.
|
// a format violation.
|
||||||
//
|
//
|
||||||
|
@ -84,7 +84,7 @@ func (p *PlacementPolicy) Unmarshal(data []byte) error {
|
||||||
return p.readFromV2(m, false)
|
return p.readFromV2(m, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes PlacementPolicy into a JSON format of the NeoFS API
|
// MarshalJSON encodes PlacementPolicy into a JSON format of the FrostFS API
|
||||||
// protocol (Protocol Buffers JSON).
|
// protocol (Protocol Buffers JSON).
|
||||||
//
|
//
|
||||||
// See also UnmarshalJSON.
|
// See also UnmarshalJSON.
|
||||||
|
@ -95,7 +95,7 @@ func (p PlacementPolicy) MarshalJSON() ([]byte, error) {
|
||||||
return m.MarshalJSON()
|
return m.MarshalJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON decodes NeoFS API protocol JSON format into the PlacementPolicy
|
// UnmarshalJSON decodes FrostFS API protocol JSON format into the PlacementPolicy
|
||||||
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also MarshalJSON.
|
// See also MarshalJSON.
|
||||||
|
@ -111,7 +111,7 @@ func (p *PlacementPolicy) UnmarshalJSON(data []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads PlacementPolicy from the netmap.PlacementPolicy message.
|
// ReadFromV2 reads PlacementPolicy from the netmap.PlacementPolicy message.
|
||||||
// Checks if the message conforms to NeoFS API V2 protocol.
|
// Checks if the message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (p *PlacementPolicy) ReadFromV2(m netmap.PlacementPolicy) error {
|
func (p *PlacementPolicy) ReadFromV2(m netmap.PlacementPolicy) error {
|
||||||
|
@ -188,7 +188,7 @@ func (p *PlacementPolicy) AddReplicas(rs ...ReplicaDescriptor) {
|
||||||
// NumberOfReplicas returns number of replica descriptors set using AddReplicas.
|
// NumberOfReplicas returns number of replica descriptors set using AddReplicas.
|
||||||
//
|
//
|
||||||
// Zero PlacementPolicy has no replicas which is incorrect according to the
|
// Zero PlacementPolicy has no replicas which is incorrect according to the
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
func (p PlacementPolicy) NumberOfReplicas() int {
|
func (p PlacementPolicy) NumberOfReplicas() int {
|
||||||
return len(p.replicas)
|
return len(p.replicas)
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ func (p PlacementPolicy) ReplicaNumberByIndex(i int) uint32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainerBackupFactor sets container backup factor: it controls how deep
|
// SetContainerBackupFactor sets container backup factor: it controls how deep
|
||||||
// NeoFS will search for nodes alternatives to include into container's nodes subset.
|
// FrostFS will search for nodes alternatives to include into container's nodes subset.
|
||||||
//
|
//
|
||||||
// Zero PlacementPolicy has zero container backup factor.
|
// Zero PlacementPolicy has zero container backup factor.
|
||||||
func (p *PlacementPolicy) SetContainerBackupFactor(f uint32) {
|
func (p *PlacementPolicy) SetContainerBackupFactor(f uint32) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DNS looks up NeoFS names using system DNS.
|
// DNS looks up FrostFS names using system DNS.
|
||||||
//
|
//
|
||||||
// See also net package.
|
// See also net package.
|
||||||
type DNS struct{}
|
type DNS struct{}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Package ns provides functionality of NeoFS name system.
|
Package ns provides functionality of FrostFS name system.
|
||||||
|
|
||||||
DNS type is designed to resolve NeoFS-related names using Domain Name System:
|
DNS type is designed to resolve FrostFS-related names using Domain Name System:
|
||||||
|
|
||||||
const containerName = "some-container"
|
const containerName = "some-container"
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ DNS type is designed to resolve NeoFS-related names using Domain Name System:
|
||||||
containerID, err := dns.ResolveContainerName(containerName)
|
containerID, err := dns.ResolveContainerName(containerName)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
NNS type is designed to resolve NeoFS-related names using Neo Name Service:
|
NNS type is designed to resolve FrostFS-related names using Neo Name Service:
|
||||||
|
|
||||||
var nns NNS
|
var nns NNS
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NNS looks up NeoFS names using Neo Name Service.
|
// NNS looks up FrostFS names using Neo Name Service.
|
||||||
//
|
//
|
||||||
// Instances are created with a variable declaration. Before work, the connection
|
// Instances are created with a variable declaration. Before work, the connection
|
||||||
// to the NNS server MUST be established using Dial method.
|
// to the NNS server MUST be established using Dial method.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Address represents global object identifier in NeoFS network. Each object
|
// Address represents global object identifier in FrostFS network. Each object
|
||||||
// belongs to exactly one container and is uniquely addressed within the container.
|
// belongs to exactly one container and is uniquely addressed within the container.
|
||||||
//
|
//
|
||||||
// Address is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.Address
|
// Address is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.Address
|
||||||
|
@ -23,7 +23,7 @@ type Address struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads Address from the refs.Address message. Returns an error if
|
// ReadFromV2 reads Address from the refs.Address message. Returns an error if
|
||||||
// the message is malformed according to the NeoFS API V2 protocol.
|
// the message is malformed according to the FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *Address) ReadFromV2(m refs.Address) error {
|
func (x *Address) ReadFromV2(m refs.Address) error {
|
||||||
|
@ -65,7 +65,7 @@ func (x Address) WriteToV2(m *refs.Address) {
|
||||||
m.SetContainerID(&cnr)
|
m.SetContainerID(&cnr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes Address into a JSON format of the NeoFS API protocol
|
// MarshalJSON encodes Address into a JSON format of the FrostFS API protocol
|
||||||
// (Protocol Buffers JSON).
|
// (Protocol Buffers JSON).
|
||||||
//
|
//
|
||||||
// See also UnmarshalJSON.
|
// See also UnmarshalJSON.
|
||||||
|
@ -76,7 +76,7 @@ func (x Address) MarshalJSON() ([]byte, error) {
|
||||||
return m.MarshalJSON()
|
return m.MarshalJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON decodes NeoFS API protocol JSON format into the Address
|
// UnmarshalJSON decodes FrostFS API protocol JSON format into the Address
|
||||||
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also MarshalJSON.
|
// See also MarshalJSON.
|
||||||
|
@ -91,9 +91,9 @@ func (x *Address) UnmarshalJSON(data []byte) error {
|
||||||
return x.ReadFromV2(m)
|
return x.ReadFromV2(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container returns unique identifier of the NeoFS object container.
|
// Container returns unique identifier of the FrostFS object container.
|
||||||
//
|
//
|
||||||
// Zero Address has zero container ID, which is incorrect according to NeoFS
|
// Zero Address has zero container ID, which is incorrect according to FrostFS
|
||||||
// API protocol.
|
// API protocol.
|
||||||
//
|
//
|
||||||
// See also SetContainer.
|
// See also SetContainer.
|
||||||
|
@ -101,7 +101,7 @@ func (x Address) Container() cid.ID {
|
||||||
return x.cnr
|
return x.cnr
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainer sets unique identifier of the NeoFS object container.
|
// SetContainer sets unique identifier of the FrostFS object container.
|
||||||
//
|
//
|
||||||
// See also Container.
|
// See also Container.
|
||||||
func (x *Address) SetContainer(id cid.ID) {
|
func (x *Address) SetContainer(id cid.ID) {
|
||||||
|
@ -111,7 +111,7 @@ func (x *Address) SetContainer(id cid.ID) {
|
||||||
// Object returns unique identifier of the object in the container
|
// Object returns unique identifier of the object in the container
|
||||||
// identified by Container().
|
// identified by Container().
|
||||||
//
|
//
|
||||||
// Zero Address has zero object ID, which is incorrect according to NeoFS
|
// Zero Address has zero object ID, which is incorrect according to FrostFS
|
||||||
// API protocol.
|
// API protocol.
|
||||||
//
|
//
|
||||||
// See also SetObject.
|
// See also SetObject.
|
||||||
|
@ -130,7 +130,7 @@ func (x *Address) SetObject(id ID) {
|
||||||
// delimiter of container and object IDs in Address protocol string.
|
// delimiter of container and object IDs in Address protocol string.
|
||||||
const idDelimiter = "/"
|
const idDelimiter = "/"
|
||||||
|
|
||||||
// EncodeToString encodes Address into NeoFS API protocol string: concatenation
|
// EncodeToString encodes Address into FrostFS API protocol string: concatenation
|
||||||
// of the string-encoded container and object IDs delimited by a slash.
|
// of the string-encoded container and object IDs delimited by a slash.
|
||||||
//
|
//
|
||||||
// See also DecodeString.
|
// See also DecodeString.
|
||||||
|
@ -138,7 +138,7 @@ func (x Address) EncodeToString() string {
|
||||||
return x.cnr.EncodeToString() + "/" + x.obj.EncodeToString()
|
return x.cnr.EncodeToString() + "/" + x.obj.EncodeToString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeString decodes string into Address according to NeoFS API protocol. Returns
|
// DecodeString decodes string into Address according to FrostFS API protocol. Returns
|
||||||
// an error if s is malformed.
|
// an error if s is malformed.
|
||||||
//
|
//
|
||||||
// See also DecodeString.
|
// See also DecodeString.
|
||||||
|
@ -165,7 +165,7 @@ func (x *Address) DecodeString(s string) error {
|
||||||
//
|
//
|
||||||
// String is designed to be human-readable, and its format MAY differ between
|
// String is designed to be human-readable, and its format MAY differ between
|
||||||
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
||||||
// be used to encode Address into NeoFS protocol string.
|
// be used to encode Address into FrostFS protocol string.
|
||||||
func (x Address) String() string {
|
func (x Address) String() string {
|
||||||
return x.EncodeToString()
|
return x.EncodeToString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Package oid provides primitives to work with object identification in NeoFS.
|
Package oid provides primitives to work with object identification in FrostFS.
|
||||||
|
|
||||||
Address type is used for global object identity inside the NeoFS network,
|
Address type is used for global object identity inside the FrostFS network,
|
||||||
while ID represents identity within a fixed container.
|
while ID represents identity within a fixed container.
|
||||||
|
|
||||||
Using package types in an application is recommended to potentially work with
|
Using package types in an application is recommended to potentially work with
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID represents NeoFS object identifier in a container.
|
// ID represents FrostFS object identifier in a container.
|
||||||
//
|
//
|
||||||
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.ObjectID
|
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.ObjectID
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
|
@ -24,7 +24,7 @@ import (
|
||||||
type ID [sha256.Size]byte
|
type ID [sha256.Size]byte
|
||||||
|
|
||||||
// ReadFromV2 reads ID from the refs.ObjectID message. Returns an error if
|
// ReadFromV2 reads ID from the refs.ObjectID message. Returns an error if
|
||||||
// the message is malformed according to the NeoFS API V2 protocol.
|
// the message is malformed according to the FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (id *ID) ReadFromV2(m refs.ObjectID) error {
|
func (id *ID) ReadFromV2(m refs.ObjectID) error {
|
||||||
|
@ -85,7 +85,7 @@ func (id ID) Equals(id2 ID) bool {
|
||||||
return id == id2
|
return id == id2
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeToString encodes ID into NeoFS API protocol string.
|
// EncodeToString encodes ID into FrostFS API protocol string.
|
||||||
//
|
//
|
||||||
// Zero ID is base58 encoding of 32 zeros.
|
// Zero ID is base58 encoding of 32 zeros.
|
||||||
//
|
//
|
||||||
|
@ -94,7 +94,7 @@ func (id ID) EncodeToString() string {
|
||||||
return base58.Encode(id[:])
|
return base58.Encode(id[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeString decodes string into ID according to NeoFS API protocol. Returns
|
// DecodeString decodes string into ID according to FrostFS API protocol. Returns
|
||||||
// an error if s is malformed.
|
// an error if s is malformed.
|
||||||
//
|
//
|
||||||
// See also DecodeString.
|
// See also DecodeString.
|
||||||
|
@ -111,7 +111,7 @@ func (id *ID) DecodeString(s string) error {
|
||||||
//
|
//
|
||||||
// String is designed to be human-readable, and its format MAY differ between
|
// String is designed to be human-readable, and its format MAY differ between
|
||||||
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
||||||
// be used to encode ID into NeoFS protocol string.
|
// be used to encode ID into FrostFS protocol string.
|
||||||
func (id ID) String() string {
|
func (id ID) String() string {
|
||||||
return id.EncodeToString()
|
return id.EncodeToString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Lock represents record with locked objects. It is compatible with
|
// Lock represents record with locked objects. It is compatible with
|
||||||
// NeoFS API V2 protocol.
|
// FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// Lock instance can be written to the Object, see WriteLock/ReadLock.
|
// Lock instance can be written to the Object, see WriteLock/ReadLock.
|
||||||
type Lock v2object.Lock
|
type Lock v2object.Lock
|
||||||
|
@ -62,12 +62,12 @@ func (x *Lock) WriteMembers(ids []oid.ID) {
|
||||||
(*v2object.Lock)(x).SetMembers(members)
|
(*v2object.Lock)(x).SetMembers(members)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes the Lock into a NeoFS protocol binary format.
|
// Marshal encodes the Lock into a FrostFS protocol binary format.
|
||||||
func (x Lock) Marshal() []byte {
|
func (x Lock) Marshal() []byte {
|
||||||
return (*v2object.Lock)(&x).StableMarshal(nil)
|
return (*v2object.Lock)(&x).StableMarshal(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes the Lock from its NeoFS protocol binary representation.
|
// Unmarshal decodes the Lock from its FrostFS protocol binary representation.
|
||||||
func (x *Lock) Unmarshal(data []byte) error {
|
func (x *Lock) Unmarshal(data []byte) error {
|
||||||
return (*v2object.Lock)(x).Unmarshal(data)
|
return (*v2object.Lock)(x).Unmarshal(data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,22 +16,22 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/version"
|
"github.com/TrueCloudLab/frostfs-sdk-go/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Object represents in-memory structure of the NeoFS object.
|
// Object represents in-memory structure of the FrostFS object.
|
||||||
// Type is compatible with NeoFS API V2 protocol.
|
// Type is compatible with FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// Instance can be created depending on scenario:
|
// Instance can be created depending on scenario:
|
||||||
// - InitCreation (an object to be placed in container);
|
// - InitCreation (an object to be placed in container);
|
||||||
// - New (blank instance, usually needed for decoding);
|
// - New (blank instance, usually needed for decoding);
|
||||||
// - NewFromV2 (when working under NeoFS API V2 protocol).
|
// - NewFromV2 (when working under FrostFS API V2 protocol).
|
||||||
type Object object.Object
|
type Object object.Object
|
||||||
|
|
||||||
// RequiredFields contains the minimum set of object data that must be set
|
// RequiredFields contains the minimum set of object data that must be set
|
||||||
// by the NeoFS user at the stage of creation.
|
// by the FrostFS user at the stage of creation.
|
||||||
type RequiredFields struct {
|
type RequiredFields struct {
|
||||||
// Identifier of the NeoFS container associated with the object.
|
// Identifier of the FrostFS container associated with the object.
|
||||||
Container cid.ID
|
Container cid.ID
|
||||||
|
|
||||||
// Object owner's user ID in the NeoFS system.
|
// Object owner's user ID in the FrostFS system.
|
||||||
Owner user.ID
|
Owner user.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/object"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/object"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RawObject represents v2-compatible NeoFS object that provides
|
// RawObject represents v2-compatible FrostFS object that provides
|
||||||
// a convenient interface to fill in the fields of
|
// a convenient interface to fill in the fields of
|
||||||
// an object in isolation from its internal structure.
|
// an object in isolation from its internal structure.
|
||||||
//
|
//
|
||||||
|
|
|
@ -213,7 +213,7 @@ func (f *SearchFilters) addReservedFilter(op SearchMatchType, keyTyp filterKeyTy
|
||||||
}
|
}
|
||||||
|
|
||||||
// addFlagFilters adds filters that works like flags: they don't need to have
|
// addFlagFilters adds filters that works like flags: they don't need to have
|
||||||
// specific match type or value. They processed by NeoFS nodes by the fact
|
// specific match type or value. They processed by FrostFS nodes by the fact
|
||||||
// of presence in search query. E.g.: PHY, ROOT.
|
// of presence in search query. E.g.: PHY, ROOT.
|
||||||
func (f *SearchFilters) addFlagFilter(keyTyp filterKeyType) {
|
func (f *SearchFilters) addFlagFilter(keyTyp filterKeyType) {
|
||||||
f.addFilter(MatchUnknown, keyTyp, "", staticStringer(""))
|
f.addFilter(MatchUnknown, keyTyp, "", staticStringer(""))
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (t *Tombstone) ToV2() *tombstone.Tombstone {
|
||||||
return (*tombstone.Tombstone)(t)
|
return (*tombstone.Tombstone)(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExpirationEpoch returns the last NeoFS epoch
|
// ExpirationEpoch returns the last FrostFS epoch
|
||||||
// number of the tombstone lifetime.
|
// number of the tombstone lifetime.
|
||||||
//
|
//
|
||||||
// See also SetExpirationEpoch.
|
// See also SetExpirationEpoch.
|
||||||
|
@ -41,7 +41,7 @@ func (t *Tombstone) ExpirationEpoch() uint64 {
|
||||||
return (*tombstone.Tombstone)(t).GetExpirationEpoch()
|
return (*tombstone.Tombstone)(t).GetExpirationEpoch()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExpirationEpoch sets the last NeoFS epoch
|
// SetExpirationEpoch sets the last FrostFS epoch
|
||||||
// number of the tombstone lifetime.
|
// number of the tombstone lifetime.
|
||||||
//
|
//
|
||||||
// See also ExpirationEpoch.
|
// See also ExpirationEpoch.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package pool provides a wrapper for several NeoFS API clients.
|
Package pool provides a wrapper for several FrostFS API clients.
|
||||||
|
|
||||||
The main component is Pool type. It is a virtual connection to the network
|
The main component is Pool type. It is a virtual connection to the network
|
||||||
and provides methods for executing operations on the server. It also supports
|
and provides methods for executing operations on the server. It also supports
|
||||||
|
@ -20,12 +20,12 @@ This InitParameters will make pool use 192.168.130.71 node while it is healthy.
|
||||||
p, err := pool.NewPool(prm)
|
p, err := pool.NewPool(prm)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
Connect to the NeoFS server:
|
Connect to the FrostFS server:
|
||||||
|
|
||||||
err := p.Dial(ctx)
|
err := p.Dial(ctx)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
Execute NeoFS operation on the server:
|
Execute FrostFS operation on the server:
|
||||||
|
|
||||||
var prm pool.PrmContainerPut
|
var prm pool.PrmContainerPut
|
||||||
prm.SetContainer(cnr)
|
prm.SetContainer(cnr)
|
||||||
|
@ -34,7 +34,7 @@ Execute NeoFS operation on the server:
|
||||||
res, err := p.PutContainer(context.Background(), prm)
|
res, err := p.PutContainer(context.Background(), prm)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
Execute NeoFS operation on the server and check error:
|
Execute FrostFS operation on the server and check error:
|
||||||
|
|
||||||
var prm pool.PrmObjectHead
|
var prm pool.PrmObjectHead
|
||||||
prm.SetAddress(addr)
|
prm.SetAddress(addr)
|
||||||
|
|
78
pool/pool.go
78
pool/pool.go
|
@ -33,7 +33,7 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// client represents virtual connection to the single NeoFS network endpoint from which Pool is formed.
|
// client represents virtual connection to the single FrostFS network endpoint from which Pool is formed.
|
||||||
// This interface is expected to have exactly one production implementation - clientWrapper.
|
// This interface is expected to have exactly one production implementation - clientWrapper.
|
||||||
// Others are expected to be for test purposes only.
|
// Others are expected to be for test purposes only.
|
||||||
type client interface {
|
type client interface {
|
||||||
|
@ -233,7 +233,7 @@ type wrapperPrm struct {
|
||||||
poolRequestInfoCallback func(RequestInfo)
|
poolRequestInfoCallback func(RequestInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// setAddress sets endpoint to connect in NeoFS network.
|
// setAddress sets endpoint to connect in FrostFS network.
|
||||||
func (x *wrapperPrm) setAddress(address string) {
|
func (x *wrapperPrm) setAddress(address string) {
|
||||||
x.address = address
|
x.address = address
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ func newWrapper(prm wrapperPrm) *clientWrapper {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// dial establishes a connection to the server from the NeoFS network.
|
// dial establishes a connection to the server from the FrostFS network.
|
||||||
// Returns an error describing failure reason. If failed, the client
|
// Returns an error describing failure reason. If failed, the client
|
||||||
// SHOULD NOT be used.
|
// SHOULD NOT be used.
|
||||||
func (c *clientWrapper) dial(ctx context.Context) error {
|
func (c *clientWrapper) dial(ctx context.Context) error {
|
||||||
|
@ -605,7 +605,7 @@ func (c *clientWrapper) networkInfo(ctx context.Context, _ prmNetworkInfo) (netm
|
||||||
return res.Info(), nil
|
return res.Info(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// objectPut writes object to NeoFS.
|
// objectPut writes object to FrostFS.
|
||||||
func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) {
|
func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) {
|
||||||
cl, err := c.getClient()
|
cl, err := c.getClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1139,7 +1139,7 @@ func (x *NodeParam) SetWeight(weight float64) {
|
||||||
x.weight = weight
|
x.weight = weight
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitParams contains parameters used in polling is a something applied on NeoFS network.
|
// WaitParams contains parameters used in polling is a something applied on FrostFS network.
|
||||||
type WaitParams struct {
|
type WaitParams struct {
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
pollInterval time.Duration
|
pollInterval time.Duration
|
||||||
|
@ -1255,7 +1255,7 @@ type PrmObjectDelete struct {
|
||||||
addr oid.Address
|
addr oid.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAddress specifies NeoFS address of the object.
|
// SetAddress specifies FrostFS address of the object.
|
||||||
func (x *PrmObjectDelete) SetAddress(addr oid.Address) {
|
func (x *PrmObjectDelete) SetAddress(addr oid.Address) {
|
||||||
x.addr = addr
|
x.addr = addr
|
||||||
}
|
}
|
||||||
|
@ -1267,7 +1267,7 @@ type PrmObjectGet struct {
|
||||||
addr oid.Address
|
addr oid.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAddress specifies NeoFS address of the object.
|
// SetAddress specifies FrostFS address of the object.
|
||||||
func (x *PrmObjectGet) SetAddress(addr oid.Address) {
|
func (x *PrmObjectGet) SetAddress(addr oid.Address) {
|
||||||
x.addr = addr
|
x.addr = addr
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1280,7 @@ type PrmObjectHead struct {
|
||||||
raw bool
|
raw bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAddress specifies NeoFS address of the object.
|
// SetAddress specifies FrostFS address of the object.
|
||||||
func (x *PrmObjectHead) SetAddress(addr oid.Address) {
|
func (x *PrmObjectHead) SetAddress(addr oid.Address) {
|
||||||
x.addr = addr
|
x.addr = addr
|
||||||
}
|
}
|
||||||
|
@ -1298,7 +1298,7 @@ type PrmObjectRange struct {
|
||||||
off, ln uint64
|
off, ln uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAddress specifies NeoFS address of the object.
|
// SetAddress specifies FrostFS address of the object.
|
||||||
func (x *PrmObjectRange) SetAddress(addr oid.Address) {
|
func (x *PrmObjectRange) SetAddress(addr oid.Address) {
|
||||||
x.addr = addr
|
x.addr = addr
|
||||||
}
|
}
|
||||||
|
@ -1379,7 +1379,7 @@ type PrmContainerList struct {
|
||||||
ownerID user.ID
|
ownerID user.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOwnerID specifies identifier of the NeoFS account to list the containers.
|
// SetOwnerID specifies identifier of the FrostFS account to list the containers.
|
||||||
func (x *PrmContainerList) SetOwnerID(ownerID user.ID) {
|
func (x *PrmContainerList) SetOwnerID(ownerID user.ID) {
|
||||||
x.ownerID = ownerID
|
x.ownerID = ownerID
|
||||||
}
|
}
|
||||||
|
@ -1395,7 +1395,7 @@ type PrmContainerDelete struct {
|
||||||
waitParamsSet bool
|
waitParamsSet bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainerID specifies identifier of the NeoFS container to be removed.
|
// SetContainerID specifies identifier of the FrostFS container to be removed.
|
||||||
func (x *PrmContainerDelete) SetContainerID(cnrID cid.ID) {
|
func (x *PrmContainerDelete) SetContainerID(cnrID cid.ID) {
|
||||||
x.cnrID = cnrID
|
x.cnrID = cnrID
|
||||||
}
|
}
|
||||||
|
@ -1420,7 +1420,7 @@ type PrmContainerEACL struct {
|
||||||
cnrID cid.ID
|
cnrID cid.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContainerID specifies identifier of the NeoFS container to read the eACL table.
|
// SetContainerID specifies identifier of the FrostFS container to read the eACL table.
|
||||||
func (x *PrmContainerEACL) SetContainerID(cnrID cid.ID) {
|
func (x *PrmContainerEACL) SetContainerID(cnrID cid.ID) {
|
||||||
x.cnrID = cnrID
|
x.cnrID = cnrID
|
||||||
}
|
}
|
||||||
|
@ -1467,7 +1467,7 @@ type PrmBalanceGet struct {
|
||||||
account user.ID
|
account user.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAccount specifies identifier of the NeoFS account for which the balance is requested.
|
// SetAccount specifies identifier of the FrostFS account for which the balance is requested.
|
||||||
func (x *PrmBalanceGet) SetAccount(id user.ID) {
|
func (x *PrmBalanceGet) SetAccount(id user.ID) {
|
||||||
x.account = id
|
x.account = id
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1478,7 @@ type prmCreateSession struct {
|
||||||
key ecdsa.PrivateKey
|
key ecdsa.PrivateKey
|
||||||
}
|
}
|
||||||
|
|
||||||
// setExp sets number of the last NeoFS epoch in the lifetime of the session after which it will be expired.
|
// setExp sets number of the last FrostFS epoch in the lifetime of the session after which it will be expired.
|
||||||
func (x *prmCreateSession) setExp(exp uint64) {
|
func (x *prmCreateSession) setExp(exp uint64) {
|
||||||
x.exp = exp
|
x.exp = exp
|
||||||
}
|
}
|
||||||
|
@ -1502,13 +1502,13 @@ type resCreateSession struct {
|
||||||
sessionKey []byte
|
sessionKey []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pool represents virtual connection to the NeoFS network to communicate
|
// Pool represents virtual connection to the FrostFS network to communicate
|
||||||
// with multiple NeoFS servers without thinking about switching between servers
|
// with multiple FrostFS servers without thinking about switching between servers
|
||||||
// due to load balancing proportions or their unavailability.
|
// due to load balancing proportions or their unavailability.
|
||||||
// It is designed to provide a convenient abstraction from the multiple sdkClient.client types.
|
// It is designed to provide a convenient abstraction from the multiple sdkClient.client types.
|
||||||
//
|
//
|
||||||
// Pool can be created and initialized using NewPool function.
|
// Pool can be created and initialized using NewPool function.
|
||||||
// Before executing the NeoFS operations using the Pool, connection to the
|
// Before executing the FrostFS operations using the Pool, connection to the
|
||||||
// servers MUST BE correctly established (see Dial method).
|
// servers MUST BE correctly established (see Dial method).
|
||||||
// Using the Pool before connecting have been established can lead to a panic.
|
// Using the Pool before connecting have been established can lead to a panic.
|
||||||
// After the work, the Pool SHOULD BE closed (see Close method): it frees internal
|
// After the work, the Pool SHOULD BE closed (see Close method): it frees internal
|
||||||
|
@ -1516,7 +1516,7 @@ type resCreateSession struct {
|
||||||
// Calling Dial/Close methods during the communication process step strongly discouraged
|
// Calling Dial/Close methods during the communication process step strongly discouraged
|
||||||
// as it leads to undefined behavior.
|
// as it leads to undefined behavior.
|
||||||
//
|
//
|
||||||
// Each method which produces a NeoFS API call may return an error.
|
// Each method which produces a FrostFS API call may return an error.
|
||||||
// Status of underlying server response is casted to built-in error instance.
|
// Status of underlying server response is casted to built-in error instance.
|
||||||
// Certain statuses can be checked using `sdkClient` and standard `errors` packages.
|
// Certain statuses can be checked using `sdkClient` and standard `errors` packages.
|
||||||
// Note that package provides some helper functions to work with status returns
|
// Note that package provides some helper functions to work with status returns
|
||||||
|
@ -1586,7 +1586,7 @@ func NewPool(options InitParameters) (*Pool, error) {
|
||||||
return pool, nil
|
return pool, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dial establishes a connection to the servers from the NeoFS network.
|
// Dial establishes a connection to the servers from the FrostFS network.
|
||||||
// It also starts a routine that checks the health of the nodes and
|
// It also starts a routine that checks the health of the nodes and
|
||||||
// updates the weights of the nodes for balancing.
|
// updates the weights of the nodes for balancing.
|
||||||
// Returns an error describing failure reason.
|
// Returns an error describing failure reason.
|
||||||
|
@ -1690,7 +1690,7 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) {
|
||||||
|
|
||||||
func adjustNodeParams(nodeParams []NodeParam) ([]*nodesParam, error) {
|
func adjustNodeParams(nodeParams []NodeParam) ([]*nodesParam, error) {
|
||||||
if len(nodeParams) == 0 {
|
if len(nodeParams) == 0 {
|
||||||
return nil, errors.New("no NeoFS peers configured")
|
return nil, errors.New("no FrostFS peers configured")
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesParamsMap := make(map[int]*nodesParam)
|
nodesParamsMap := make(map[int]*nodesParam)
|
||||||
|
@ -2013,7 +2013,7 @@ func (p *Pool) fillAppropriateKey(prm *prmCommon) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutObject writes an object through a remote server using NeoFS API protocol.
|
// PutObject writes an object through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) {
|
func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) {
|
||||||
|
@ -2051,7 +2051,7 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error)
|
||||||
return id, nil
|
return id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteObject marks an object for deletion from the container using NeoFS API protocol.
|
// DeleteObject marks an object for deletion from the container using FrostFS API protocol.
|
||||||
// As a marker, a special unit called a tombstone is placed in the container.
|
// As a marker, a special unit called a tombstone is placed in the container.
|
||||||
// It confirms the user's intent to delete the object, and is itself a container object.
|
// It confirms the user's intent to delete the object, and is itself a container object.
|
||||||
// Explicit deletion is done asynchronously, and is generally not guaranteed.
|
// Explicit deletion is done asynchronously, and is generally not guaranteed.
|
||||||
|
@ -2116,14 +2116,14 @@ func (x *objectReadCloser) Close() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResGetObject is designed to provide object header nad read one object payload from NeoFS system.
|
// ResGetObject is designed to provide object header nad read one object payload from FrostFS system.
|
||||||
type ResGetObject struct {
|
type ResGetObject struct {
|
||||||
Header object.Object
|
Header object.Object
|
||||||
|
|
||||||
Payload io.ReadCloser
|
Payload io.ReadCloser
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetObject reads object header and initiates reading an object payload through a remote server using NeoFS API protocol.
|
// GetObject reads object header and initiates reading an object payload through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, error) {
|
func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, error) {
|
||||||
|
@ -2151,7 +2151,7 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, e
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// HeadObject reads object header through a remote server using NeoFS API protocol.
|
// HeadObject reads object header through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object, error) {
|
func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object, error) {
|
||||||
|
@ -2181,7 +2181,7 @@ func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResObjectRange is designed to read payload range of one object
|
// ResObjectRange is designed to read payload range of one object
|
||||||
// from NeoFS system.
|
// from FrostFS system.
|
||||||
//
|
//
|
||||||
// Must be initialized using Pool.ObjectRange, any other
|
// Must be initialized using Pool.ObjectRange, any other
|
||||||
// usage is unsafe.
|
// usage is unsafe.
|
||||||
|
@ -2206,7 +2206,7 @@ func (x *ResObjectRange) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectRange initiates reading an object's payload range through a remote
|
// ObjectRange initiates reading an object's payload range through a remote
|
||||||
// server using NeoFS API protocol.
|
// server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRange, error) {
|
func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRange, error) {
|
||||||
|
@ -2234,7 +2234,7 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRa
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResObjectSearch is designed to read list of object identifiers from NeoFS system.
|
// ResObjectSearch is designed to read list of object identifiers from FrostFS system.
|
||||||
//
|
//
|
||||||
// Must be initialized using Pool.SearchObjects, any other usage is unsafe.
|
// Must be initialized using Pool.SearchObjects, any other usage is unsafe.
|
||||||
type ResObjectSearch struct {
|
type ResObjectSearch struct {
|
||||||
|
@ -2270,7 +2270,7 @@ func (x *ResObjectSearch) Close() {
|
||||||
_, _ = x.r.Close()
|
_, _ = x.r.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SearchObjects initiates object selection through a remote server using NeoFS API protocol.
|
// SearchObjects initiates object selection through a remote server using FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// The call only opens the transmission channel, explicit fetching of matched objects
|
// The call only opens the transmission channel, explicit fetching of matched objects
|
||||||
// is done using the ResObjectSearch. Resulting reader must be finally closed.
|
// is done using the ResObjectSearch. Resulting reader must be finally closed.
|
||||||
|
@ -2302,7 +2302,7 @@ func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjec
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutContainer sends request to save container in NeoFS and waits for the operation to complete.
|
// PutContainer sends request to save container in FrostFS and waits for the operation to complete.
|
||||||
//
|
//
|
||||||
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
||||||
//
|
//
|
||||||
|
@ -2321,7 +2321,7 @@ func (p *Pool) PutContainer(ctx context.Context, prm PrmContainerPut) (cid.ID, e
|
||||||
return cp.containerPut(ctx, prm)
|
return cp.containerPut(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContainer reads NeoFS container by ID.
|
// GetContainer reads FrostFS container by ID.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (container.Container, error) {
|
func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (container.Container, error) {
|
||||||
|
@ -2343,7 +2343,7 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.
|
||||||
return cp.containerList(ctx, prm)
|
return cp.containerList(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteContainer sends request to remove the NeoFS container and waits for the operation to complete.
|
// DeleteContainer sends request to remove the FrostFS container and waits for the operation to complete.
|
||||||
//
|
//
|
||||||
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
||||||
//
|
//
|
||||||
|
@ -2360,7 +2360,7 @@ func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) erro
|
||||||
return cp.containerDelete(ctx, prm)
|
return cp.containerDelete(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEACL reads eACL table of the NeoFS container.
|
// GetEACL reads eACL table of the FrostFS container.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, error) {
|
func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, error) {
|
||||||
|
@ -2372,7 +2372,7 @@ func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, e
|
||||||
return cp.containerEACL(ctx, prm)
|
return cp.containerEACL(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEACL sends request to update eACL table of the NeoFS container and waits for the operation to complete.
|
// SetEACL sends request to update eACL table of the FrostFS container and waits for the operation to complete.
|
||||||
//
|
//
|
||||||
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
||||||
//
|
//
|
||||||
|
@ -2389,7 +2389,7 @@ func (p *Pool) SetEACL(ctx context.Context, prm PrmContainerSetEACL) error {
|
||||||
return cp.containerSetEACL(ctx, prm)
|
return cp.containerSetEACL(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Balance requests current balance of the NeoFS account.
|
// Balance requests current balance of the FrostFS account.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error) {
|
func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error) {
|
||||||
|
@ -2422,7 +2422,7 @@ func (p Pool) Statistic() Statistic {
|
||||||
return stat
|
return stat
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitForContainerPresence waits until the container is found on the NeoFS network.
|
// waitForContainerPresence waits until the container is found on the FrostFS network.
|
||||||
func waitForContainerPresence(ctx context.Context, cli client, cnrID cid.ID, waitParams *WaitParams) error {
|
func waitForContainerPresence(ctx context.Context, cli client, cnrID cid.ID, waitParams *WaitParams) error {
|
||||||
var prm PrmContainerGet
|
var prm PrmContainerGet
|
||||||
prm.SetContainerID(cnrID)
|
prm.SetContainerID(cnrID)
|
||||||
|
@ -2433,7 +2433,7 @@ func waitForContainerPresence(ctx context.Context, cli client, cnrID cid.ID, wai
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitForEACLPresence waits until the container eacl is applied on the NeoFS network.
|
// waitForEACLPresence waits until the container eacl is applied on the FrostFS network.
|
||||||
func waitForEACLPresence(ctx context.Context, cli client, cnrID *cid.ID, table *eacl.Table, waitParams *WaitParams) error {
|
func waitForEACLPresence(ctx context.Context, cli client, cnrID *cid.ID, table *eacl.Table, waitParams *WaitParams) error {
|
||||||
var prm PrmContainerEACL
|
var prm PrmContainerEACL
|
||||||
if cnrID != nil {
|
if cnrID != nil {
|
||||||
|
@ -2449,7 +2449,7 @@ func waitForEACLPresence(ctx context.Context, cli client, cnrID *cid.ID, table *
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitForContainerRemoved waits until the container is removed from the NeoFS network.
|
// waitForContainerRemoved waits until the container is removed from the FrostFS network.
|
||||||
func waitForContainerRemoved(ctx context.Context, cli client, cnrID *cid.ID, waitParams *WaitParams) error {
|
func waitForContainerRemoved(ctx context.Context, cli client, cnrID *cid.ID, waitParams *WaitParams) error {
|
||||||
var prm PrmContainerGet
|
var prm PrmContainerGet
|
||||||
if cnrID != nil {
|
if cnrID != nil {
|
||||||
|
@ -2485,7 +2485,7 @@ func waitFor(ctx context.Context, params *WaitParams, condition func(context.Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfo requests information about the NeoFS network of which the remote server is a part.
|
// NetworkInfo requests information about the FrostFS network of which the remote server is a part.
|
||||||
//
|
//
|
||||||
// Main return value MUST NOT be processed on an erroneous return.
|
// Main return value MUST NOT be processed on an erroneous return.
|
||||||
func (p *Pool) NetworkInfo(ctx context.Context) (netmap.NetworkInfo, error) {
|
func (p *Pool) NetworkInfo(ctx context.Context) (netmap.NetworkInfo, error) {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/*
|
||||||
Package reputation collects functionality related to the NeoFS reputation system.
|
Package reputation collects functionality related to the FrostFS reputation system.
|
||||||
|
|
||||||
The functionality is based on the system described in the NeoFS specification.
|
The functionality is based on the system described in the FrostFS specification.
|
||||||
|
|
||||||
Trust type represents simple instances of trust values. PeerToPeerTrust extends
|
Trust type represents simple instances of trust values. PeerToPeerTrust extends
|
||||||
Trust to support the direction of trust, i.e. from whom to whom. GlobalTrust
|
Trust to support the direction of trust, i.e. from whom to whom. GlobalTrust
|
||||||
is designed as a global measure of trust in a network member. See the docs
|
is designed as a global measure of trust in a network member. See the docs
|
||||||
for each type for details.
|
for each type for details.
|
||||||
|
|
||||||
Instances can be also used to process NeoFS API V2 protocol messages
|
Instances can be also used to process FrostFS API V2 protocol messages
|
||||||
(see neo.fs.v2.reputation package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.reputation package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PeerID represents unique identifier of the peer participating in the NeoFS
|
// PeerID represents unique identifier of the peer participating in the FrostFS
|
||||||
// reputation system.
|
// reputation system.
|
||||||
//
|
//
|
||||||
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.PeerID
|
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.PeerID
|
||||||
|
@ -21,7 +21,7 @@ type PeerID struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads PeerID from the reputation.PeerID message. Returns an
|
// ReadFromV2 reads PeerID from the reputation.PeerID message. Returns an
|
||||||
// error if the message is malformed according to the NeoFS API V2 protocol.
|
// error if the message is malformed according to the FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *PeerID) ReadFromV2(m reputation.PeerID) error {
|
func (x *PeerID) ReadFromV2(m reputation.PeerID) error {
|
||||||
|
@ -44,7 +44,7 @@ func (x PeerID) WriteToV2(m *reputation.PeerID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPublicKey sets PeerID as a binary-encoded public key which authenticates
|
// SetPublicKey sets PeerID as a binary-encoded public key which authenticates
|
||||||
// the participant of the NeoFS reputation system.
|
// the participant of the FrostFS reputation system.
|
||||||
//
|
//
|
||||||
// Argument MUST NOT be mutated, make a copy first.
|
// Argument MUST NOT be mutated, make a copy first.
|
||||||
//
|
//
|
||||||
|
@ -55,7 +55,7 @@ func (x *PeerID) SetPublicKey(key []byte) {
|
||||||
|
|
||||||
// PublicKey return public key set using SetPublicKey.
|
// PublicKey return public key set using SetPublicKey.
|
||||||
//
|
//
|
||||||
// Zero PeerID has zero key which is incorrect according to NeoFS API
|
// Zero PeerID has zero key which is incorrect according to FrostFS API
|
||||||
// protocol.
|
// protocol.
|
||||||
//
|
//
|
||||||
// Return value MUST NOT be mutated, make a copy first.
|
// Return value MUST NOT be mutated, make a copy first.
|
||||||
|
@ -69,7 +69,7 @@ func ComparePeerKey(peer PeerID, key []byte) bool {
|
||||||
return bytes.Equal(peer.PublicKey(), key)
|
return bytes.Equal(peer.PublicKey(), key)
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeToString encodes ID into NeoFS API protocol string.
|
// EncodeToString encodes ID into FrostFS API protocol string.
|
||||||
//
|
//
|
||||||
// Zero PeerID is base58 encoding of PeerIDSize zeros.
|
// Zero PeerID is base58 encoding of PeerIDSize zeros.
|
||||||
//
|
//
|
||||||
|
@ -78,7 +78,7 @@ func (x PeerID) EncodeToString() string {
|
||||||
return base58.Encode(x.m.GetPublicKey())
|
return base58.Encode(x.m.GetPublicKey())
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeString decodes string into PeerID according to NeoFS API protocol.
|
// DecodeString decodes string into PeerID according to FrostFS API protocol.
|
||||||
// Returns an error if s is malformed.
|
// Returns an error if s is malformed.
|
||||||
//
|
//
|
||||||
// See also DecodeString.
|
// See also DecodeString.
|
||||||
|
@ -97,7 +97,7 @@ func (x *PeerID) DecodeString(s string) error {
|
||||||
//
|
//
|
||||||
// String is designed to be human-readable, and its format MAY differ between
|
// String is designed to be human-readable, and its format MAY differ between
|
||||||
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
||||||
// be used to encode ID into NeoFS protocol string.
|
// be used to encode ID into FrostFS protocol string.
|
||||||
func (x PeerID) String() string {
|
func (x PeerID) String() string {
|
||||||
return x.EncodeToString()
|
return x.EncodeToString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Trust represents quantitative assessment of the trust of a participant in the
|
// Trust represents quantitative assessment of the trust of a participant in the
|
||||||
// NeoFS reputation system.
|
// FrostFS reputation system.
|
||||||
//
|
//
|
||||||
// Trust is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.Trust
|
// Trust is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.Trust
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
|
@ -22,7 +22,7 @@ type Trust struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads Trust from the reputation.Trust message. Returns an
|
// ReadFromV2 reads Trust from the reputation.Trust message. Returns an
|
||||||
// error if the message is malformed according to the NeoFS API V2 protocol.
|
// error if the message is malformed according to the FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *Trust) ReadFromV2(m reputation.Trust) error {
|
func (x *Trust) ReadFromV2(m reputation.Trust) error {
|
||||||
|
@ -55,7 +55,7 @@ func (x Trust) WriteToV2(m *reputation.Trust) {
|
||||||
*m = x.m
|
*m = x.m
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPeer specifies identifier of the participant of the NeoFS reputation system
|
// SetPeer specifies identifier of the participant of the FrostFS reputation system
|
||||||
// to which the Trust relates.
|
// to which the Trust relates.
|
||||||
//
|
//
|
||||||
// See also Peer.
|
// See also Peer.
|
||||||
|
@ -68,7 +68,7 @@ func (x *Trust) SetPeer(id PeerID) {
|
||||||
|
|
||||||
// Peer returns peer identifier set using SetPeer.
|
// Peer returns peer identifier set using SetPeer.
|
||||||
//
|
//
|
||||||
// Zero Trust returns zero PeerID which is incorrect according to the NeoFS API
|
// Zero Trust returns zero PeerID which is incorrect according to the FrostFS API
|
||||||
// protocol.
|
// protocol.
|
||||||
func (x Trust) Peer() (res PeerID) {
|
func (x Trust) Peer() (res PeerID) {
|
||||||
m := x.m.GetPeer()
|
m := x.m.GetPeer()
|
||||||
|
@ -100,7 +100,7 @@ func (x Trust) Value() float64 {
|
||||||
return x.m.GetValue()
|
return x.m.GetValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
// PeerToPeerTrust represents trust of one participant of the NeoFS reputation
|
// PeerToPeerTrust represents trust of one participant of the FrostFS reputation
|
||||||
// system to another one.
|
// system to another one.
|
||||||
//
|
//
|
||||||
// Trust is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.PeerToPeerTrust
|
// Trust is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.PeerToPeerTrust
|
||||||
|
@ -112,7 +112,7 @@ type PeerToPeerTrust struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads PeerToPeerTrust from the reputation.PeerToPeerTrust message.
|
// ReadFromV2 reads PeerToPeerTrust from the reputation.PeerToPeerTrust message.
|
||||||
// Returns an error if the message is malformed according to the NeoFS API V2
|
// Returns an error if the message is malformed according to the FrostFS API V2
|
||||||
// protocol.
|
// protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
|
@ -155,7 +155,7 @@ func (x PeerToPeerTrust) WriteToV2(m *reputation.PeerToPeerTrust) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrustingPeer specifies the peer from which trust comes in terms of the
|
// SetTrustingPeer specifies the peer from which trust comes in terms of the
|
||||||
// NeoFS reputation system.
|
// FrostFS reputation system.
|
||||||
//
|
//
|
||||||
// See also TrustingPeer.
|
// See also TrustingPeer.
|
||||||
func (x *PeerToPeerTrust) SetTrustingPeer(id PeerID) {
|
func (x *PeerToPeerTrust) SetTrustingPeer(id PeerID) {
|
||||||
|
@ -168,7 +168,7 @@ func (x *PeerToPeerTrust) SetTrustingPeer(id PeerID) {
|
||||||
// TrustingPeer returns peer set using SetTrustingPeer.
|
// TrustingPeer returns peer set using SetTrustingPeer.
|
||||||
//
|
//
|
||||||
// Zero PeerToPeerTrust has no trusting peer which is incorrect according
|
// Zero PeerToPeerTrust has no trusting peer which is incorrect according
|
||||||
// to the NeoFS API protocol.
|
// to the FrostFS API protocol.
|
||||||
func (x PeerToPeerTrust) TrustingPeer() (res PeerID) {
|
func (x PeerToPeerTrust) TrustingPeer() (res PeerID) {
|
||||||
m := x.m.GetTrustingPeer()
|
m := x.m.GetTrustingPeer()
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -182,7 +182,7 @@ func (x PeerToPeerTrust) TrustingPeer() (res PeerID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrust sets trust value of the trusting peer to another participant
|
// SetTrust sets trust value of the trusting peer to another participant
|
||||||
// of the NeoFS reputation system.
|
// of the FrostFS reputation system.
|
||||||
//
|
//
|
||||||
// See also Trust.
|
// See also Trust.
|
||||||
func (x *PeerToPeerTrust) SetTrust(t Trust) {
|
func (x *PeerToPeerTrust) SetTrust(t Trust) {
|
||||||
|
@ -195,7 +195,7 @@ func (x *PeerToPeerTrust) SetTrust(t Trust) {
|
||||||
// Trust returns trust set using SetTrust.
|
// Trust returns trust set using SetTrust.
|
||||||
//
|
//
|
||||||
// Zero PeerToPeerTrust returns zero Trust which is incorect according to the
|
// Zero PeerToPeerTrust returns zero Trust which is incorect according to the
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
func (x PeerToPeerTrust) Trust() (res Trust) {
|
func (x PeerToPeerTrust) Trust() (res Trust) {
|
||||||
m := x.m.GetTrust()
|
m := x.m.GetTrust()
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -209,19 +209,19 @@ func (x PeerToPeerTrust) Trust() (res Trust) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GlobalTrust represents the final assessment of trust in the participant of
|
// GlobalTrust represents the final assessment of trust in the participant of
|
||||||
// the NeoFS reputation system obtained taking into account all other participants.
|
// the FrostFS reputation system obtained taking into account all other participants.
|
||||||
//
|
//
|
||||||
// GlobalTrust is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.GlobalTrust
|
// GlobalTrust is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/reputation.GlobalTrust
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
//
|
//
|
||||||
// To submit GlobalTrust value in NeoFS zero instance SHOULD be declared,
|
// To submit GlobalTrust value in FrostFS zero instance SHOULD be declared,
|
||||||
// initialized using Init method and filled using dedicated methods.
|
// initialized using Init method and filled using dedicated methods.
|
||||||
type GlobalTrust struct {
|
type GlobalTrust struct {
|
||||||
m reputation.GlobalTrust
|
m reputation.GlobalTrust
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads GlobalTrust from the reputation.GlobalTrust message.
|
// ReadFromV2 reads GlobalTrust from the reputation.GlobalTrust message.
|
||||||
// Returns an error if the message is malformed according to the NeoFS API V2
|
// Returns an error if the message is malformed according to the FrostFS API V2
|
||||||
// protocol.
|
// protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
|
@ -276,7 +276,7 @@ func (x GlobalTrust) WriteToV2(m *reputation.GlobalTrust) {
|
||||||
*m = x.m
|
*m = x.m
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init initializes all internal data of the GlobalTrust required by NeoFS API
|
// Init initializes all internal data of the GlobalTrust required by FrostFS API
|
||||||
// protocol. Init MUST be called when creating a new global trust instance.
|
// protocol. Init MUST be called when creating a new global trust instance.
|
||||||
// Init SHOULD NOT be called multiple times. Init SHOULD NOT be called if
|
// Init SHOULD NOT be called multiple times. Init SHOULD NOT be called if
|
||||||
// the GlobalTrust instance is used for decoding only.
|
// the GlobalTrust instance is used for decoding only.
|
||||||
|
@ -299,7 +299,7 @@ func (x *GlobalTrust) setBodyField(setter func(*reputation.GlobalTrustBody)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetManager sets identifier of the NeoFS reputation system's participant which
|
// SetManager sets identifier of the FrostFS reputation system's participant which
|
||||||
// performed trust estimation.
|
// performed trust estimation.
|
||||||
//
|
//
|
||||||
// See also Manager.
|
// See also Manager.
|
||||||
|
@ -315,7 +315,7 @@ func (x *GlobalTrust) SetManager(id PeerID) {
|
||||||
// Manager returns peer set using SetManager.
|
// Manager returns peer set using SetManager.
|
||||||
//
|
//
|
||||||
// Zero GlobalTrust has zero manager which is incorrect according to the
|
// Zero GlobalTrust has zero manager which is incorrect according to the
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
func (x GlobalTrust) Manager() (res PeerID) {
|
func (x GlobalTrust) Manager() (res PeerID) {
|
||||||
m := x.m.GetBody().GetManager()
|
m := x.m.GetBody().GetManager()
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -344,7 +344,7 @@ func (x *GlobalTrust) SetTrust(trust Trust) {
|
||||||
// Trust returns trust set using SetTrust.
|
// Trust returns trust set using SetTrust.
|
||||||
//
|
//
|
||||||
// Zero GlobalTrust return zero Trust which is incorrect according to the
|
// Zero GlobalTrust return zero Trust which is incorrect according to the
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
func (x GlobalTrust) Trust() (res Trust) {
|
func (x GlobalTrust) Trust() (res Trust) {
|
||||||
m := x.m.GetBody().GetTrust()
|
m := x.m.GetBody().GetTrust()
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -398,7 +398,7 @@ func (x GlobalTrust) VerifySignature() bool {
|
||||||
return sig.ReadFromV2(*sigV2) == nil && sig.Verify(x.m.GetBody().StableMarshal(nil))
|
return sig.ReadFromV2(*sigV2) == nil && sig.Verify(x.m.GetBody().StableMarshal(nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes GlobalTrust into a binary format of the NeoFS API protocol
|
// Marshal encodes GlobalTrust into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers with direct field order).
|
// (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -406,7 +406,7 @@ func (x GlobalTrust) Marshal() []byte {
|
||||||
return x.m.StableMarshal(nil)
|
return x.m.StableMarshal(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes NeoFS API protocol binary format into the GlobalTrust
|
// Unmarshal decodes FrostFS API protocol binary format into the GlobalTrust
|
||||||
// (Protocol Buffers with direct field order). Returns an error describing
|
// (Protocol Buffers with direct field order). Returns an error describing
|
||||||
// a format violation.
|
// a format violation.
|
||||||
//
|
//
|
||||||
|
|
|
@ -34,7 +34,7 @@ type contextReader func(session.TokenContext, bool) error
|
||||||
|
|
||||||
// reads commonData and custom context from the session.Token message.
|
// reads commonData and custom context from the session.Token message.
|
||||||
// If checkFieldPresence is set, returns an error on absence of any protocol-required
|
// If checkFieldPresence is set, returns an error on absence of any protocol-required
|
||||||
// field. Verifies format of any presented field according to NeoFS API V2 protocol.
|
// field. Verifies format of any presented field according to FrostFS API V2 protocol.
|
||||||
// Calls contextReader if session context is set. Passes checkFieldPresence into contextReader.
|
// Calls contextReader if session context is set. Passes checkFieldPresence into contextReader.
|
||||||
func (x *commonData) readFromV2(m session.Token, checkFieldPresence bool, r contextReader) error {
|
func (x *commonData) readFromV2(m session.Token, checkFieldPresence bool, r contextReader) error {
|
||||||
var err error
|
var err error
|
||||||
|
@ -220,7 +220,7 @@ func (x *commonData) unmarshalJSON(data []byte, r contextReader) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExp sets "exp" (expiration time) claim which identifies the expiration
|
// SetExp sets "exp" (expiration time) claim which identifies the expiration
|
||||||
// time (in NeoFS epochs) after which the session MUST NOT be accepted for
|
// time (in FrostFS epochs) after which the session MUST NOT be accepted for
|
||||||
// processing. The processing of the "exp" claim requires that the current
|
// processing. The processing of the "exp" claim requires that the current
|
||||||
// epoch MUST be before or equal to the expiration epoch listed in the "exp"
|
// epoch MUST be before or equal to the expiration epoch listed in the "exp"
|
||||||
// claim.
|
// claim.
|
||||||
|
@ -233,7 +233,7 @@ func (x *commonData) SetExp(exp uint64) {
|
||||||
x.lifetimeSet = true
|
x.lifetimeSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNbf sets "nbf" (not before) claim which identifies the time (in NeoFS
|
// SetNbf sets "nbf" (not before) claim which identifies the time (in FrostFS
|
||||||
// epochs) before which the session MUST NOT be accepted for processing.
|
// epochs) before which the session MUST NOT be accepted for processing.
|
||||||
// The processing of the "nbf" claim requires that the current date/time MUST be
|
// The processing of the "nbf" claim requires that the current date/time MUST be
|
||||||
// after or equal to the not-before date/time listed in the "nbf" claim.
|
// after or equal to the not-before date/time listed in the "nbf" claim.
|
||||||
|
@ -246,7 +246,7 @@ func (x *commonData) SetNbf(nbf uint64) {
|
||||||
x.lifetimeSet = true
|
x.lifetimeSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIat sets "iat" (issued at) claim which identifies the time (in NeoFS
|
// SetIat sets "iat" (issued at) claim which identifies the time (in FrostFS
|
||||||
// epochs) at which the session was issued. This claim can be used to
|
// epochs) at which the session was issued. This claim can be used to
|
||||||
// determine the age of the session.
|
// determine the age of the session.
|
||||||
//
|
//
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Container represents token of the NeoFS Container session. A session is opened
|
// Container represents token of the FrostFS Container session. A session is opened
|
||||||
// between any two sides of the system, and implements a mechanism for transferring
|
// between any two sides of the system, and implements a mechanism for transferring
|
||||||
// the power of attorney of actions to another network member. The session has a
|
// the power of attorney of actions to another network member. The session has a
|
||||||
// limited validity period, and applies to a strictly defined set of operations.
|
// limited validity period, and applies to a strictly defined set of operations.
|
||||||
|
@ -64,7 +64,7 @@ func (x *Container) readFromV2(m session.Token, checkFieldPresence bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads Container from the session.Token message. Checks if the
|
// ReadFromV2 reads Container from the session.Token message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *Container) ReadFromV2(m session.Token) error {
|
func (x *Container) ReadFromV2(m session.Token) error {
|
||||||
|
@ -94,7 +94,7 @@ func (x Container) WriteToV2(m *session.Token) {
|
||||||
x.writeToV2(m, x.writeContext)
|
x.writeToV2(m, x.writeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes Container into a binary format of the NeoFS API protocol
|
// Marshal encodes Container into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers with direct field order).
|
// (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -102,7 +102,7 @@ func (x Container) Marshal() []byte {
|
||||||
return x.marshal(x.writeContext)
|
return x.marshal(x.writeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes NeoFS API protocol binary format into the Container
|
// Unmarshal decodes FrostFS API protocol binary format into the Container
|
||||||
// (Protocol Buffers with direct field order). Returns an error describing
|
// (Protocol Buffers with direct field order). Returns an error describing
|
||||||
// a format violation.
|
// a format violation.
|
||||||
//
|
//
|
||||||
|
@ -111,7 +111,7 @@ func (x *Container) Unmarshal(data []byte) error {
|
||||||
return x.unmarshal(data, x.readContext)
|
return x.unmarshal(data, x.readContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes Container into a JSON format of the NeoFS API protocol
|
// MarshalJSON encodes Container into a JSON format of the FrostFS API protocol
|
||||||
// (Protocol Buffers JSON).
|
// (Protocol Buffers JSON).
|
||||||
//
|
//
|
||||||
// See also UnmarshalJSON.
|
// See also UnmarshalJSON.
|
||||||
|
@ -119,7 +119,7 @@ func (x Container) MarshalJSON() ([]byte, error) {
|
||||||
return x.marshalJSON(x.writeContext)
|
return x.marshalJSON(x.writeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON decodes NeoFS API protocol JSON format into the Container
|
// UnmarshalJSON decodes FrostFS API protocol JSON format into the Container
|
||||||
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also MarshalJSON.
|
// See also MarshalJSON.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
Package session collects functionality of the NeoFS sessions.
|
Package session collects functionality of the FrostFS sessions.
|
||||||
|
|
||||||
Sessions are used in NeoFS as a mechanism for transferring the power of attorney
|
Sessions are used in FrostFS as a mechanism for transferring the power of attorney
|
||||||
of actions to another network member.
|
of actions to another network member.
|
||||||
|
|
||||||
Session tokens represent proof of trust. Each session has a limited lifetime and
|
Session tokens represent proof of trust. Each session has a limited lifetime and
|
||||||
scope related to some NeoFS service: Object, Container, etc.
|
scope related to some FrostFS service: Object, Container, etc.
|
||||||
|
|
||||||
Both parties agree on a secret (private session key), the possession of which
|
Both parties agree on a secret (private session key), the possession of which
|
||||||
will be authenticated by a trusted person. The principal confirms his trust by
|
will be authenticated by a trusted person. The principal confirms his trust by
|
||||||
|
@ -23,7 +23,7 @@ signing the public part of the secret (public session key).
|
||||||
|
|
||||||
The trusted member can perform operations on behalf of the trustee.
|
The trusted member can perform operations on behalf of the trustee.
|
||||||
|
|
||||||
Instances can be also used to process NeoFS API V2 protocol messages
|
Instances can be also used to process FrostFS API V2 protocol messages
|
||||||
(see neo.fs.v2.accounting package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.accounting package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Object represents token of the NeoFS Object session. A session is opened
|
// Object represents token of the FrostFS Object session. A session is opened
|
||||||
// between any two sides of the system, and implements a mechanism for transferring
|
// between any two sides of the system, and implements a mechanism for transferring
|
||||||
// the power of attorney of actions to another network member. The session has a
|
// the power of attorney of actions to another network member. The session has a
|
||||||
// limited validity period, and applies to a strictly defined set of operations.
|
// limited validity period, and applies to a strictly defined set of operations.
|
||||||
|
@ -74,7 +74,7 @@ func (x *Object) readFromV2(m session.Token, checkFieldPresence bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads Object from the session.Token message. Checks if the
|
// ReadFromV2 reads Object from the session.Token message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *Object) ReadFromV2(m session.Token) error {
|
func (x *Object) ReadFromV2(m session.Token) error {
|
||||||
|
@ -117,7 +117,7 @@ func (x Object) WriteToV2(m *session.Token) {
|
||||||
x.writeToV2(m, x.writeContext)
|
x.writeToV2(m, x.writeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes Object into a binary format of the NeoFS API protocol
|
// Marshal encodes Object into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers with direct field order).
|
// (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -128,7 +128,7 @@ func (x Object) Marshal() []byte {
|
||||||
return x.marshal(x.writeContext)
|
return x.marshal(x.writeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes NeoFS API protocol binary format into the Object
|
// Unmarshal decodes FrostFS API protocol binary format into the Object
|
||||||
// (Protocol Buffers with direct field order). Returns an error describing
|
// (Protocol Buffers with direct field order). Returns an error describing
|
||||||
// a format violation.
|
// a format violation.
|
||||||
//
|
//
|
||||||
|
@ -137,7 +137,7 @@ func (x *Object) Unmarshal(data []byte) error {
|
||||||
return x.unmarshal(data, x.readContext)
|
return x.unmarshal(data, x.readContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON encodes Object into a JSON format of the NeoFS API protocol
|
// MarshalJSON encodes Object into a JSON format of the FrostFS API protocol
|
||||||
// (Protocol Buffers JSON).
|
// (Protocol Buffers JSON).
|
||||||
//
|
//
|
||||||
// See also UnmarshalJSON.
|
// See also UnmarshalJSON.
|
||||||
|
@ -145,7 +145,7 @@ func (x Object) MarshalJSON() ([]byte, error) {
|
||||||
return x.marshalJSON(x.writeContext)
|
return x.marshalJSON(x.writeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON decodes NeoFS API protocol JSON format into the Object
|
// UnmarshalJSON decodes FrostFS API protocol JSON format into the Object
|
||||||
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
// (Protocol Buffers JSON). Returns an error describing a format violation.
|
||||||
//
|
//
|
||||||
// See also MarshalJSON.
|
// See also MarshalJSON.
|
||||||
|
@ -188,7 +188,7 @@ func (x *Object) BindContainer(cnr cid.ID) {
|
||||||
// AssertContainer checks if Object session bound to a given container.
|
// AssertContainer checks if Object session bound to a given container.
|
||||||
//
|
//
|
||||||
// Zero Object isn't bound to any container which is incorrect according to
|
// Zero Object isn't bound to any container which is incorrect according to
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
//
|
//
|
||||||
// See also BindContainer.
|
// See also BindContainer.
|
||||||
func (x Object) AssertContainer(cnr cid.ID) bool {
|
func (x Object) AssertContainer(cnr cid.ID) bool {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Package storagegroup provides features to work with information that is
|
Package storagegroup provides features to work with information that is
|
||||||
used for proof of storage in NeoFS system.
|
used for proof of storage in FrostFS system.
|
||||||
|
|
||||||
StorageGroup type groups verification values for Data Audit sessions:
|
StorageGroup type groups verification values for Data Audit sessions:
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ StorageGroup type groups verification values for Data Audit sessions:
|
||||||
sg.ValidationDataHash() // hash for objects validation
|
sg.ValidationDataHash() // hash for objects validation
|
||||||
sg.ValidationDataSize() // total objects' payload size
|
sg.ValidationDataSize() // total objects' payload size
|
||||||
|
|
||||||
Instances can be also used to process NeoFS API V2 protocol messages
|
Instances can be also used to process FrostFS API V2 protocol messages
|
||||||
(see neo.fs.v2.storagegroup package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.storagegroup package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StorageGroup represents storage group of the NeoFS objects.
|
// StorageGroup represents storage group of the FrostFS objects.
|
||||||
//
|
//
|
||||||
// StorageGroup is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup.StorageGroup
|
// StorageGroup is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/storagegroup.StorageGroup
|
||||||
// message. See ReadFromMessageV2 / WriteToMessageV2 methods.
|
// message. See ReadFromMessageV2 / WriteToMessageV2 methods.
|
||||||
|
@ -69,7 +69,7 @@ func (sg *StorageGroup) readFromV2(m storagegroup.StorageGroup, checkFieldPresen
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads StorageGroup from the storagegroup.StorageGroup message.
|
// ReadFromV2 reads StorageGroup from the storagegroup.StorageGroup message.
|
||||||
// Checks if the message conforms to NeoFS API V2 protocol.
|
// Checks if the message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (sg *StorageGroup) ReadFromV2(m storagegroup.StorageGroup) error {
|
func (sg *StorageGroup) ReadFromV2(m storagegroup.StorageGroup) error {
|
||||||
|
@ -132,7 +132,7 @@ func (sg *StorageGroup) SetValidationDataHash(hash checksum.Checksum) {
|
||||||
(*storagegroup.StorageGroup)(sg).SetValidationHash(&v2)
|
(*storagegroup.StorageGroup)(sg).SetValidationHash(&v2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExpirationEpoch returns last NeoFS epoch number
|
// ExpirationEpoch returns last FrostFS epoch number
|
||||||
// of the storage group lifetime.
|
// of the storage group lifetime.
|
||||||
//
|
//
|
||||||
// Zero StorageGroup has 0 expiration epoch.
|
// Zero StorageGroup has 0 expiration epoch.
|
||||||
|
@ -143,7 +143,7 @@ func (sg StorageGroup) ExpirationEpoch() uint64 {
|
||||||
return v2.GetExpirationEpoch()
|
return v2.GetExpirationEpoch()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExpirationEpoch sets last NeoFS epoch number
|
// SetExpirationEpoch sets last FrostFS epoch number
|
||||||
// of the storage group lifetime.
|
// of the storage group lifetime.
|
||||||
//
|
//
|
||||||
// See also ExpirationEpoch.
|
// See also ExpirationEpoch.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
Package subnet collects functionality related to the NeoFS subnets.
|
Package subnet collects functionality related to the FrostFS subnets.
|
||||||
|
|
||||||
Subnet of a particular NeoFS network consists of a subset of the storage nodes
|
Subnet of a particular FrostFS network consists of a subset of the storage nodes
|
||||||
of that network. Subnet of the whole network is called zero. Info type acts as
|
of that network. Subnet of the whole network is called zero. Info type acts as
|
||||||
a subnet descriptor. Each subnet is owned by the user who created it. Information
|
a subnet descriptor. Each subnet is owned by the user who created it. Information
|
||||||
about all subnets is stored in the Subnet contract of the NeoFS Sidechain.
|
about all subnets is stored in the Subnet contract of the FrostFS Sidechain.
|
||||||
*/
|
*/
|
||||||
package subnet
|
package subnet
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Package subnetid provides primitives to work with subnet identification in NeoFS.
|
Package subnetid provides primitives to work with subnet identification in FrostFS.
|
||||||
|
|
||||||
ID type is used for global subnet identity inside the NeoFS network.
|
ID type is used for global subnet identity inside the FrostFS network.
|
||||||
|
|
||||||
Using package types in an application is recommended to potentially work with
|
Using package types in an application is recommended to potentially work with
|
||||||
different protocol versions with which these types are compatible.
|
different protocol versions with which these types are compatible.
|
||||||
|
|
|
@ -7,19 +7,19 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID represents unique identifier of the subnet in the NeoFS network.
|
// ID represents unique identifier of the subnet in the FrostFS network.
|
||||||
//
|
//
|
||||||
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.SubnetID
|
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.SubnetID
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
//
|
//
|
||||||
// Instances can be created using built-in var declaration. Zero value is
|
// Instances can be created using built-in var declaration. Zero value is
|
||||||
// equivalent to identifier of the zero subnet (whole NeoFS network).
|
// equivalent to identifier of the zero subnet (whole FrostFS network).
|
||||||
type ID struct {
|
type ID struct {
|
||||||
m refs.SubnetID
|
m refs.SubnetID
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads ID from the refs.SubnetID message. Checks if the
|
// ReadFromV2 reads ID from the refs.SubnetID message. Checks if the
|
||||||
// message conforms to NeoFS API V2 protocol.
|
// message conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *ID) ReadFromV2(msg refs.SubnetID) error {
|
func (x *ID) ReadFromV2(msg refs.SubnetID) error {
|
||||||
|
@ -43,7 +43,7 @@ func (x ID) Equals(x2 ID) bool {
|
||||||
return x.m.GetValue() == x2.m.GetValue()
|
return x.m.GetValue() == x2.m.GetValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeToString encodes ID into NeoFS API protocol string (base10 encoding).
|
// EncodeToString encodes ID into FrostFS API protocol string (base10 encoding).
|
||||||
//
|
//
|
||||||
// See also DecodeString.
|
// See also DecodeString.
|
||||||
func (x ID) EncodeToString() string {
|
func (x ID) EncodeToString() string {
|
||||||
|
@ -67,12 +67,12 @@ func (x *ID) DecodeString(s string) error {
|
||||||
//
|
//
|
||||||
// String is designed to be human-readable, and its format MAY differ between
|
// String is designed to be human-readable, and its format MAY differ between
|
||||||
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
||||||
// be used to encode ID into NeoFS protocol string.
|
// be used to encode ID into FrostFS protocol string.
|
||||||
func (x ID) String() string {
|
func (x ID) String() string {
|
||||||
return "#" + strconv.FormatUint(uint64(x.m.GetValue()), 10)
|
return "#" + strconv.FormatUint(uint64(x.m.GetValue()), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes ID into a binary format of the NeoFS API protocol
|
// Marshal encodes ID into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers with direct field order).
|
// (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Info represents information about NeoFS subnet.
|
// Info represents information about FrostFS subnet.
|
||||||
//
|
//
|
||||||
// Instances can be created using built-in var declaration.
|
// Instances can be created using built-in var declaration.
|
||||||
type Info struct {
|
type Info struct {
|
||||||
|
@ -18,7 +18,7 @@ type Info struct {
|
||||||
owner user.ID
|
owner user.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes Info into a binary format of the NeoFS API protocol
|
// Marshal encodes Info into a binary format of the FrostFS API protocol
|
||||||
// (Protocol Buffers with direct field order).
|
// (Protocol Buffers with direct field order).
|
||||||
//
|
//
|
||||||
// See also Unmarshal.
|
// See also Unmarshal.
|
||||||
|
@ -91,7 +91,7 @@ func (x *Info) SetOwner(id user.ID) {
|
||||||
// Owner returns subnet owner set using SetOwner.
|
// Owner returns subnet owner set using SetOwner.
|
||||||
//
|
//
|
||||||
// Zero Info has no owner which is incorrect according to the
|
// Zero Info has no owner which is incorrect according to the
|
||||||
// NeoFS API protocol.
|
// FrostFS API protocol.
|
||||||
func (x Info) Owner() user.ID {
|
func (x Info) Owner() user.ID {
|
||||||
return x.owner
|
return x.owner
|
||||||
}
|
}
|
||||||
|
|
10
user/doc.go
10
user/doc.go
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
Package user provides functionality related to NeoFS users.
|
Package user provides functionality related to FrostFS users.
|
||||||
|
|
||||||
User identity is reflected in ID type. Each user has its own unique identifier
|
User identity is reflected in ID type. Each user has its own unique identifier
|
||||||
within the same network.
|
within the same network.
|
||||||
|
|
||||||
NeoFS user identification is compatible with Neo accounts:
|
FrostFS user identification is compatible with Neo accounts:
|
||||||
|
|
||||||
import "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
import "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
import "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
import "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
||||||
|
|
||||||
var id user.ID
|
var id user.ID
|
||||||
|
|
||||||
var scriptHash util.Uint160 // user account in NeoFS
|
var scriptHash util.Uint160 // user account in FrostFS
|
||||||
id.SetScriptHash(scriptHash)
|
id.SetScriptHash(scriptHash)
|
||||||
|
|
||||||
var key keys.PublicKey // user's public key
|
var key keys.PublicKey // user's public key
|
||||||
user.IDFromKey(&id, k.PrivateKey.PublicKey)
|
user.IDFromKey(&id, k.PrivateKey.PublicKey)
|
||||||
|
|
||||||
ID is compatible with the NeoFS Smart Contract API:
|
ID is compatible with the FrostFS Smart Contract API:
|
||||||
|
|
||||||
var id user.ID
|
var id user.ID
|
||||||
// ...
|
// ...
|
||||||
|
@ -34,7 +34,7 @@ Encoding/decoding mechanisms are used to transfer identifiers:
|
||||||
s := id.EncodeToString() // on transmitter
|
s := id.EncodeToString() // on transmitter
|
||||||
err = id.DecodeString(s) // on receiver
|
err = id.DecodeString(s) // on receiver
|
||||||
|
|
||||||
Instances can be also used to process NeoFS API protocol messages
|
Instances can be also used to process FrostFS API protocol messages
|
||||||
(see neo.fs.v2.refs package in https://github.com/TrueCloudLab/frostfs-api).
|
(see neo.fs.v2.refs package in https://github.com/TrueCloudLab/frostfs-api).
|
||||||
|
|
||||||
On client side:
|
On client side:
|
||||||
|
|
12
user/id.go
12
user/id.go
|
@ -12,7 +12,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID identifies users of the NeoFS system.
|
// ID identifies users of the FrostFS system.
|
||||||
//
|
//
|
||||||
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.OwnerID
|
// ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.OwnerID
|
||||||
// message. See ReadFromV2 / WriteToV2 methods.
|
// message. See ReadFromV2 / WriteToV2 methods.
|
||||||
|
@ -25,7 +25,7 @@ type ID struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads ID from the refs.OwnerID message. Returns an error if
|
// ReadFromV2 reads ID from the refs.OwnerID message. Returns an error if
|
||||||
// the message is malformed according to the NeoFS API V2 protocol.
|
// the message is malformed according to the FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (x *ID) ReadFromV2(m refs.OwnerID) error {
|
func (x *ID) ReadFromV2(m refs.OwnerID) error {
|
||||||
|
@ -68,7 +68,7 @@ func (x *ID) SetScriptHash(scriptHash util.Uint160) {
|
||||||
copy(x.w[21:], hash.Checksum(x.w[:21]))
|
copy(x.w[21:], hash.Checksum(x.w[:21]))
|
||||||
}
|
}
|
||||||
|
|
||||||
// WalletBytes returns NeoFS user ID as Neo3 wallet address in a binary format.
|
// WalletBytes returns FrostFS user ID as Neo3 wallet address in a binary format.
|
||||||
//
|
//
|
||||||
// Return value MUST NOT be mutated: to do this, first make a copy.
|
// Return value MUST NOT be mutated: to do this, first make a copy.
|
||||||
//
|
//
|
||||||
|
@ -77,14 +77,14 @@ func (x ID) WalletBytes() []byte {
|
||||||
return x.w
|
return x.w
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeToString encodes ID into NeoFS API V2 protocol string.
|
// EncodeToString encodes ID into FrostFS API V2 protocol string.
|
||||||
//
|
//
|
||||||
// See also DecodeString.
|
// See also DecodeString.
|
||||||
func (x ID) EncodeToString() string {
|
func (x ID) EncodeToString() string {
|
||||||
return base58.Encode(x.w)
|
return base58.Encode(x.w)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeString decodes NeoFS API V2 protocol string. Returns an error
|
// DecodeString decodes FrostFS API V2 protocol string. Returns an error
|
||||||
// if s is malformed.
|
// if s is malformed.
|
||||||
//
|
//
|
||||||
// DecodeString always changes the ID.
|
// DecodeString always changes the ID.
|
||||||
|
@ -105,7 +105,7 @@ func (x *ID) DecodeString(s string) error {
|
||||||
//
|
//
|
||||||
// String is designed to be human-readable, and its format MAY differ between
|
// String is designed to be human-readable, and its format MAY differ between
|
||||||
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
// SDK versions. String MAY return same result as EncodeToString. String MUST NOT
|
||||||
// be used to encode ID into NeoFS protocol string.
|
// be used to encode ID into FrostFS protocol string.
|
||||||
func (x ID) String() string {
|
func (x ID) String() string {
|
||||||
return x.EncodeToString()
|
return x.EncodeToString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
Package version provides functionality for NeoFS versioning.
|
Package version provides functionality for FrostFS versioning.
|
||||||
|
|
||||||
NeoFS uses NeoFS API versioning scheme. It uses major and minor version of
|
FrostFS uses FrostFS API versioning scheme. It uses major and minor version of
|
||||||
the API.
|
the API.
|
||||||
|
|
||||||
In most of the cases it will be enough to use the latest supported NeoFS API
|
In most of the cases it will be enough to use the latest supported FrostFS API
|
||||||
version in SDK:
|
version in SDK:
|
||||||
|
|
||||||
ver := version.Current()
|
ver := version.Current()
|
||||||
|
|
|
@ -21,7 +21,7 @@ type Version refs.Version
|
||||||
const sdkMjr, sdkMnr = 2, 13
|
const sdkMjr, sdkMnr = 2, 13
|
||||||
|
|
||||||
// Current returns Version instance that initialized to the
|
// Current returns Version instance that initialized to the
|
||||||
// latest supported NeoFS API revision number in SDK.
|
// latest supported FrostFS API revision number in SDK.
|
||||||
func Current() (v Version) {
|
func Current() (v Version) {
|
||||||
v.SetMajor(sdkMjr)
|
v.SetMajor(sdkMjr)
|
||||||
v.SetMinor(sdkMnr)
|
v.SetMinor(sdkMnr)
|
||||||
|
@ -57,7 +57,7 @@ func (v Version) WriteToV2(m *refs.Version) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromV2 reads Version from the refs.Version message. Checks if the message
|
// ReadFromV2 reads Version from the refs.Version message. Checks if the message
|
||||||
// conforms to NeoFS API V2 protocol.
|
// conforms to FrostFS API V2 protocol.
|
||||||
//
|
//
|
||||||
// See also WriteToV2.
|
// See also WriteToV2.
|
||||||
func (v *Version) ReadFromV2(m refs.Version) error {
|
func (v *Version) ReadFromV2(m refs.Version) error {
|
||||||
|
|
Loading…
Reference in a new issue