forked from TrueCloudLab/frostfs-node
[#1] Fix comments and error messages
Signed-off-by: Stanislav Bogatyrev <s.bogatyrev@yadro.com>
This commit is contained in:
parent
c761a95eef
commit
cb016d53a6
96 changed files with 167 additions and 167 deletions
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/client"
|
"github.com/TrueCloudLab/frostfs-sdk-go/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client is an interface of NeoFS storage
|
// Client is an interface of FrostFS storage
|
||||||
// node's client.
|
// node's client.
|
||||||
type Client interface {
|
type Client interface {
|
||||||
ContainerAnnounceUsedSpace(context.Context, client.PrmAnnounceSpace) (*client.ResAnnounceSpace, error)
|
ContainerAnnounceUsedSpace(context.Context, client.PrmAnnounceSpace) (*client.ResAnnounceSpace, error)
|
||||||
|
@ -35,7 +35,7 @@ type MultiAddressClient interface {
|
||||||
RawForAddress(network.Address, func(cli *rawclient.Client) error) error
|
RawForAddress(network.Address, func(cli *rawclient.Client) error) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInfo groups information about a NeoFS storage node needed for Client construction.
|
// NodeInfo groups information about a FrostFS storage node needed for Client construction.
|
||||||
type NodeInfo struct {
|
type NodeInfo struct {
|
||||||
addrGroup network.AddressGroup
|
addrGroup network.AddressGroup
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/session"
|
"github.com/TrueCloudLab/frostfs-sdk-go/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Container groups information about the NeoFS container stored in the NeoFS network.
|
// Container groups information about the FrostFS container stored in the FrostFS network.
|
||||||
type Container struct {
|
type Container struct {
|
||||||
// Container structure.
|
// Container structure.
|
||||||
Value container.Container
|
Value container.Container
|
||||||
|
@ -43,8 +43,8 @@ func IsErrNotFound(err error) bool {
|
||||||
return errors.As(err, new(apistatus.ContainerNotFound))
|
return errors.As(err, new(apistatus.ContainerNotFound))
|
||||||
}
|
}
|
||||||
|
|
||||||
// EACL groups information about the NeoFS container's extended ACL stored in
|
// EACL groups information about the FrostFS container's extended ACL stored in
|
||||||
// the NeoFS network.
|
// the FrostFS network.
|
||||||
type EACL struct {
|
type EACL struct {
|
||||||
// Extended ACL structure.
|
// Extended ACL structure.
|
||||||
Value *eacl.Table
|
Value *eacl.Table
|
||||||
|
|
|
@ -2,6 +2,6 @@ package netmap
|
||||||
|
|
||||||
// State groups the current system state parameters.
|
// State groups the current system state parameters.
|
||||||
type State interface {
|
type State interface {
|
||||||
// CurrentEpoch returns the number of the current NeoFS epoch.
|
// CurrentEpoch returns the number of the current FrostFS epoch.
|
||||||
CurrentEpoch() uint64
|
CurrentEpoch() uint64
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AddressWithType groups object address with its NeoFS
|
// AddressWithType groups object address with its FrostFS
|
||||||
// object type.
|
// object type.
|
||||||
type AddressWithType struct {
|
type AddressWithType struct {
|
||||||
Address oid.Address
|
Address oid.Address
|
||||||
|
|
|
@ -169,7 +169,7 @@ func (v *FormatValidator) checkOwnerKey(id user.ID, key frostfsecdsa.PublicKey)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContentMeta describes NeoFS meta information that brings object's payload if the object
|
// ContentMeta describes FrostFS meta information that brings object's payload if the object
|
||||||
// is one of:
|
// is one of:
|
||||||
// - object.TypeTombstone;
|
// - object.TypeTombstone;
|
||||||
// - object.TypeStorageGroup;
|
// - object.TypeStorageGroup;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/version"
|
"github.com/TrueCloudLab/frostfs-sdk-go/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsValid checks if Version is not earlier than the genesis version of the NeoFS.
|
// IsValid checks if Version is not earlier than the genesis version of the FrostFS.
|
||||||
func IsValid(v version.Version) bool {
|
func IsValid(v version.Version) bool {
|
||||||
const (
|
const (
|
||||||
startMajor = 2
|
startMajor = 2
|
||||||
|
|
|
@ -32,7 +32,7 @@ func (f FeeConfig) SideChainFee() fixedn.Fixed8 {
|
||||||
return f.sidechain
|
return f.sidechain
|
||||||
}
|
}
|
||||||
|
|
||||||
// NamedContainerRegistrationFee returns additional GAS fee for named container registration in NeoFS network.
|
// NamedContainerRegistrationFee returns additional GAS fee for named container registration in FrostFS network.
|
||||||
func (f FeeConfig) NamedContainerRegistrationFee() fixedn.Fixed8 {
|
func (f FeeConfig) NamedContainerRegistrationFee() fixedn.Fixed8 {
|
||||||
return f.registerNamedCnr
|
return f.registerNamedCnr
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,14 @@ import (
|
||||||
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client represents NeoFS API client cut down to the needs of a purely IR application.
|
// Client represents FrostFS API client cut down to the needs of a purely IR application.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
key *ecdsa.PrivateKey
|
key *ecdsa.PrivateKey
|
||||||
|
|
||||||
c clientcore.Client
|
c clientcore.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// WrapBasicClient wraps a client.Client instance to use it for NeoFS API RPC.
|
// WrapBasicClient wraps a client.Client instance to use it for FrostFS API RPC.
|
||||||
func (x *Client) WrapBasicClient(c clientcore.Client) {
|
func (x *Client) WrapBasicClient(c clientcore.Client) {
|
||||||
x.c = c
|
x.c = c
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ func (x Client) HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("read object header from NeoFS: %w", err)
|
return nil, fmt.Errorf("read object header from FrostFS: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hdr object.Object
|
var hdr object.Object
|
||||||
|
@ -225,7 +225,7 @@ func (x Client) HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetObjectPayload reads an object by address from NeoFS via Client and returns its payload.
|
// GetObjectPayload reads an object by address from FrostFS via Client and returns its payload.
|
||||||
//
|
//
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
func GetObjectPayload(ctx context.Context, c Client, addr oid.Address) ([]byte, error) {
|
func GetObjectPayload(ctx context.Context, c Client, addr oid.Address) ([]byte, error) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Package frostfsapiclient provides functionality for IR application communication with NeoFS network.
|
// Package frostfsapiclient provides functionality for IR application communication with FrostFS network.
|
||||||
//
|
//
|
||||||
// The basic client for accessing remote nodes via NeoFS API is a NeoFS SDK Go API client.
|
// The basic client for accessing remote nodes via FrostFS API is a FrostFS SDK Go API client.
|
||||||
// However, although it encapsulates a useful piece of business logic (e.g. the signature mechanism),
|
// However, although it encapsulates a useful piece of business logic (e.g. the signature mechanism),
|
||||||
// the IR application does not fully use the client's flexible interface.
|
// the IR application does not fully use the client's flexible interface.
|
||||||
//
|
//
|
||||||
|
@ -8,5 +8,5 @@
|
||||||
// The type provides the minimum interface necessary for the application and also allows you to concentrate
|
// The type provides the minimum interface necessary for the application and also allows you to concentrate
|
||||||
// the entire spectrum of the client's use in one place (this will be convenient both when updating the base client
|
// the entire spectrum of the client's use in one place (this will be convenient both when updating the base client
|
||||||
// and for evaluating the UX of SDK library). So, it is expected that all application packages will be limited
|
// and for evaluating the UX of SDK library). So, it is expected that all application packages will be limited
|
||||||
// to this package for the development of functionality requiring NeoFS API communication.
|
// to this package for the development of functionality requiring FrostFS API communication.
|
||||||
package frostfsapiclient
|
package frostfsapiclient
|
||||||
|
|
|
@ -81,7 +81,7 @@ func New(p *Params) (*Processor, error) {
|
||||||
case p.ContainerClient == nil:
|
case p.ContainerClient == nil:
|
||||||
return nil, errors.New("ir/container: Container client is not set")
|
return nil, errors.New("ir/container: Container client is not set")
|
||||||
case p.FrostFSIDClient == nil:
|
case p.FrostFSIDClient == nil:
|
||||||
return nil, errors.New("ir/container: NeoFS ID client is not set")
|
return nil, errors.New("ir/container: FrostFS ID client is not set")
|
||||||
case p.NetworkState == nil:
|
case p.NetworkState == nil:
|
||||||
return nil, errors.New("ir/container: network state is not set")
|
return nil, errors.New("ir/container: network state is not set")
|
||||||
case p.SubnetClient == nil:
|
case p.SubnetClient == nil:
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Update NeoFS contract in the mainnet.
|
// 4. Update FrostFS contract in the mainnet.
|
||||||
epoch := gp.epochState.EpochCounter()
|
epoch := gp.epochState.EpochCounter()
|
||||||
|
|
||||||
buf := make([]byte, 8)
|
buf := make([]byte, 8)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Record is an interface of read-only
|
// Record is an interface of read-only
|
||||||
// NeoFS LOCODE database single entry.
|
// FrostFS LOCODE database single entry.
|
||||||
type Record interface {
|
type Record interface {
|
||||||
// Must return ISO 3166-1 alpha-2
|
// Must return ISO 3166-1 alpha-2
|
||||||
// country code.
|
// country code.
|
||||||
|
@ -47,7 +47,7 @@ type Record interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB is an interface of read-only
|
// DB is an interface of read-only
|
||||||
// NeoFS LOCODE database.
|
// FrostFS LOCODE database.
|
||||||
type DB interface {
|
type DB interface {
|
||||||
// Must find the record that corresponds to
|
// Must find the record that corresponds to
|
||||||
// LOCODE and provides the Record interface.
|
// LOCODE and provides the Record interface.
|
||||||
|
|
|
@ -6,7 +6,7 @@ package locode
|
||||||
// Passing incorrect parameter values will result in constructor
|
// Passing incorrect parameter values will result in constructor
|
||||||
// failure (error or panic depending on the implementation).
|
// failure (error or panic depending on the implementation).
|
||||||
type Prm struct {
|
type Prm struct {
|
||||||
// NeoFS LOCODE database interface.
|
// FrostFS LOCODE database interface.
|
||||||
//
|
//
|
||||||
// Must not be nil.
|
// Must not be nil.
|
||||||
DB DB
|
DB DB
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// ErrMaintenanceModeDisallowed is returned when maintenance mode is disallowed.
|
// ErrMaintenanceModeDisallowed is returned when maintenance mode is disallowed.
|
||||||
var ErrMaintenanceModeDisallowed = errors.New("maintenance mode is disallowed")
|
var ErrMaintenanceModeDisallowed = errors.New("maintenance mode is disallowed")
|
||||||
|
|
||||||
// NetworkSettings encapsulates current settings of the NeoFS network and
|
// NetworkSettings encapsulates current settings of the FrostFS network and
|
||||||
// provides interface used for processing the network map candidates.
|
// provides interface used for processing the network map candidates.
|
||||||
type NetworkSettings interface {
|
type NetworkSettings interface {
|
||||||
// MaintenanceModeAllowed checks if maintenance state of the storage nodes
|
// MaintenanceModeAllowed checks if maintenance state of the storage nodes
|
||||||
|
@ -27,7 +27,7 @@ type NetworkSettings interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetMapCandidateValidator represents tool which checks state of nodes which
|
// NetMapCandidateValidator represents tool which checks state of nodes which
|
||||||
// are going to register in the NeoFS network (enter the network map).
|
// are going to register in the FrostFS network (enter the network map).
|
||||||
//
|
//
|
||||||
// NetMapCandidateValidator can be instantiated using built-in var declaration
|
// NetMapCandidateValidator can be instantiated using built-in var declaration
|
||||||
// and currently doesn't require any additional initialization.
|
// and currently doesn't require any additional initialization.
|
||||||
|
|
|
@ -29,7 +29,7 @@ type ResultStorage interface {
|
||||||
AuditResultsForEpoch(epoch uint64) ([]*audit.Result, error)
|
AuditResultsForEpoch(epoch uint64) ([]*audit.Result, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SGInfo groups the data about NeoFS storage group
|
// SGInfo groups the data about FrostFS storage group
|
||||||
// necessary for calculating audit fee.
|
// necessary for calculating audit fee.
|
||||||
type SGInfo interface {
|
type SGInfo interface {
|
||||||
// Must return sum size of the all group members.
|
// Must return sum size of the all group members.
|
||||||
|
|
|
@ -17,7 +17,7 @@ type NodeInfo interface {
|
||||||
PublicKey() []byte
|
PublicKey() []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerInfo groups the data about NeoFS container
|
// ContainerInfo groups the data about FrostFS container
|
||||||
// necessary for calculating audit fee.
|
// necessary for calculating audit fee.
|
||||||
type ContainerInfo interface {
|
type ContainerInfo interface {
|
||||||
// Must return identifier of the container owner.
|
// Must return identifier of the container owner.
|
||||||
|
@ -25,7 +25,7 @@ type ContainerInfo interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerStorage is an interface of
|
// ContainerStorage is an interface of
|
||||||
// storage of the NeoFS containers.
|
// storage of the FrostFS containers.
|
||||||
type ContainerStorage interface {
|
type ContainerStorage interface {
|
||||||
// Must return information about the container by ID.
|
// Must return information about the container by ID.
|
||||||
ContainerInfo(cid.ID) (ContainerInfo, error)
|
ContainerInfo(cid.ID) (ContainerInfo, error)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Put represents a notification about NeoFS subnet creation.
|
// Put represents a notification about FrostFS subnet creation.
|
||||||
// Generated by a contract when intending to create a subnet.
|
// Generated by a contract when intending to create a subnet.
|
||||||
type Put interface {
|
type Put interface {
|
||||||
// Contains the ID of the subnet to be created.
|
// Contains the ID of the subnet to be created.
|
||||||
|
@ -56,7 +56,7 @@ func (x PutValidator) Assert(event Put) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// read creator's user ID in NeoFS system
|
// read creator's user ID in FrostFS system
|
||||||
var creator user.ID
|
var creator user.ID
|
||||||
if err = event.ReadCreator(&creator); err != nil {
|
if err = event.ReadCreator(&creator); err != nil {
|
||||||
return fmt.Errorf("read creator: %w", err)
|
return fmt.Errorf("read creator: %w", err)
|
||||||
|
|
|
@ -184,14 +184,14 @@ type putSubnetEvent struct {
|
||||||
ev subnetevents.Put
|
ev subnetevents.Put
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadID unmarshals the subnet ID from a binary NeoFS API protocol's format.
|
// ReadID unmarshals the subnet ID from a binary FrostFS API protocol's format.
|
||||||
func (x putSubnetEvent) ReadID(id *subnetid.ID) error {
|
func (x putSubnetEvent) ReadID(id *subnetid.ID) error {
|
||||||
return id.Unmarshal(x.ev.ID())
|
return id.Unmarshal(x.ev.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
var errMissingSubnetOwner = errors.New("missing subnet owner")
|
var errMissingSubnetOwner = errors.New("missing subnet owner")
|
||||||
|
|
||||||
// ReadCreator unmarshals the subnet creator from a binary NeoFS API protocol's format.
|
// ReadCreator unmarshals the subnet creator from a binary FrostFS API protocol's format.
|
||||||
// Returns an error if the byte array is empty.
|
// Returns an error if the byte array is empty.
|
||||||
func (x putSubnetEvent) ReadCreator(id *user.ID) error {
|
func (x putSubnetEvent) ReadCreator(id *user.ID) error {
|
||||||
data := x.ev.Owner()
|
data := x.ev.Owner()
|
||||||
|
@ -210,7 +210,7 @@ func (x putSubnetEvent) ReadCreator(id *user.ID) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadInfo unmarshal the subnet info from a binary NeoFS API protocol's format.
|
// ReadInfo unmarshal the subnet info from a binary FrostFS API protocol's format.
|
||||||
func (x putSubnetEvent) ReadInfo(info *subnet.Info) error {
|
func (x putSubnetEvent) ReadInfo(info *subnet.Info) error {
|
||||||
return info.Unmarshal(x.ev.Info())
|
return info.Unmarshal(x.ev.Info())
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Blobovnicza represents the implementation of NeoFS Blobovnicza.
|
// Blobovnicza represents the implementation of FrostFS Blobovnicza.
|
||||||
type Blobovnicza struct {
|
type Blobovnicza struct {
|
||||||
cfg
|
cfg
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ type SubStorage struct {
|
||||||
Policy func(*objectSDK.Object, []byte) bool
|
Policy func(*objectSDK.Object, []byte) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlobStor represents NeoFS local BLOB storage.
|
// BlobStor represents FrostFS local BLOB storage.
|
||||||
type BlobStor struct {
|
type BlobStor struct {
|
||||||
cfg
|
cfg
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StorageEngine represents NeoFS local storage engine.
|
// StorageEngine represents FrostFS local storage engine.
|
||||||
type StorageEngine struct {
|
type StorageEngine struct {
|
||||||
*cfg
|
*cfg
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (db *DB) Inhume(prm InhumePrm) (res InhumeRes, err error) {
|
||||||
bkt = graveyardBKT
|
bkt = graveyardBKT
|
||||||
tombKey := addressKey(*prm.tomb, make([]byte, addressKeySize))
|
tombKey := addressKey(*prm.tomb, make([]byte, addressKeySize))
|
||||||
|
|
||||||
// it is forbidden to have a tomb-on-tomb in NeoFS,
|
// it is forbidden to have a tomb-on-tomb in FrostFS,
|
||||||
// so graveyard keys must not be addresses of tombstones
|
// so graveyard keys must not be addresses of tombstones
|
||||||
data := bkt.Get(tombKey)
|
data := bkt.Get(tombKey)
|
||||||
if data != nil {
|
if data != nil {
|
||||||
|
|
|
@ -15,10 +15,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// TombstoneSource is an interface that checks
|
// TombstoneSource is an interface that checks
|
||||||
// tombstone status in the NeoFS network.
|
// tombstone status in the FrostFS network.
|
||||||
type TombstoneSource interface {
|
type TombstoneSource interface {
|
||||||
// IsTombstoneAvailable must return boolean value that means
|
// IsTombstoneAvailable must return boolean value that means
|
||||||
// provided tombstone's presence in the NeoFS network at the
|
// provided tombstone's presence in the FrostFS network at the
|
||||||
// time of the passed epoch.
|
// time of the passed epoch.
|
||||||
IsTombstoneAvailable(ctx context.Context, addr oid.Address, epoch uint64) bool
|
IsTombstoneAvailable(ctx context.Context, addr oid.Address, epoch uint64) bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Shard represents single shard of NeoFS Local Storage Engine.
|
// Shard represents single shard of FrostFS Local Storage Engine.
|
||||||
type Shard struct {
|
type Shard struct {
|
||||||
*cfg
|
*cfg
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
// Client is a wrapper over StaticClient
|
// Client is a wrapper over StaticClient
|
||||||
// which makes calls with the names and arguments
|
// which makes calls with the names and arguments
|
||||||
// of the NeoFS Audit contract.
|
// of the FrostFS Audit contract.
|
||||||
//
|
//
|
||||||
// Working client must be created via constructor New.
|
// Working client must be created via constructor New.
|
||||||
// Using the Client that has been created with new(Client)
|
// Using the Client that has been created with new(Client)
|
||||||
|
|
|
@ -22,7 +22,7 @@ func (p *PutPrm) SetResult(result *auditAPI.Result) {
|
||||||
p.result = result
|
p.result = result
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutAuditResult saves passed audit result structure in NeoFS system
|
// PutAuditResult saves passed audit result structure in FrostFS system
|
||||||
// through Audit contract call.
|
// through Audit contract call.
|
||||||
//
|
//
|
||||||
// Returns encountered error that caused the saving to interrupt.
|
// Returns encountered error that caused the saving to interrupt.
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
// Client is a wrapper over StaticClient
|
// Client is a wrapper over StaticClient
|
||||||
// which makes calls with the names and arguments
|
// which makes calls with the names and arguments
|
||||||
// of the NeoFS Balance contract.
|
// of the FrostFS Balance contract.
|
||||||
//
|
//
|
||||||
// Working client must be created via constructor New.
|
// Working client must be created via constructor New.
|
||||||
// Using the Client that has been created with new(Client)
|
// Using the Client that has been created with new(Client)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
// Client is a wrapper over StaticClient
|
// Client is a wrapper over StaticClient
|
||||||
// which makes calls with the names and arguments
|
// which makes calls with the names and arguments
|
||||||
// of the NeoFS Container contract.
|
// of the FrostFS Container contract.
|
||||||
//
|
//
|
||||||
// Working client must be created via constructor New.
|
// Working client must be created via constructor New.
|
||||||
// Using the Client that has been created with new(Client)
|
// Using the Client that has been created with new(Client)
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (d *DeletePrm) SetToken(token []byte) {
|
||||||
d.token = token
|
d.token = token
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete removes the container from NeoFS system
|
// Delete removes the container from FrostFS system
|
||||||
// through Container contract call.
|
// through Container contract call.
|
||||||
//
|
//
|
||||||
// Returns any error encountered that caused
|
// Returns any error encountered that caused
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/session"
|
"github.com/TrueCloudLab/frostfs-sdk-go/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetEACL reads the extended ACL table from NeoFS system
|
// GetEACL reads the extended ACL table from FrostFS system
|
||||||
// through Container contract call.
|
// through Container contract call.
|
||||||
//
|
//
|
||||||
// Returns apistatus.EACLNotFound if eACL table is missing in the contract.
|
// Returns apistatus.EACLNotFound if eACL table is missing in the contract.
|
||||||
|
|
|
@ -72,7 +72,7 @@ func (p *PutEACLPrm) SetToken(token []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutEACL saves binary eACL table with its session token, key and signature
|
// PutEACL saves binary eACL table with its session token, key and signature
|
||||||
// in NeoFS system through Container contract call.
|
// in FrostFS system through Container contract call.
|
||||||
//
|
//
|
||||||
// Returns any error encountered that caused the saving to interrupt.
|
// Returns any error encountered that caused the saving to interrupt.
|
||||||
func (c *Client) PutEACL(p PutEACLPrm) error {
|
func (c *Client) PutEACL(p PutEACLPrm) error {
|
||||||
|
|
|
@ -35,7 +35,7 @@ func Get(c *Client, cnr cid.ID) (*containercore.Container, error) {
|
||||||
return c.Get(binCnr)
|
return c.Get(binCnr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get reads the container from NeoFS system by binary identifier
|
// Get reads the container from FrostFS system by binary identifier
|
||||||
// through Container contract call.
|
// through Container contract call.
|
||||||
//
|
//
|
||||||
// If an empty slice is returned for the requested identifier,
|
// If an empty slice is returned for the requested identifier,
|
||||||
|
|
|
@ -9,10 +9,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// List returns a list of container identifiers belonging
|
// List returns a list of container identifiers belonging
|
||||||
// to the specified user of NeoFS system. The list is composed
|
// to the specified user of FrostFS system. The list is composed
|
||||||
// through Container contract call.
|
// through Container contract call.
|
||||||
//
|
//
|
||||||
// Returns the identifiers of all NeoFS containers if pointer
|
// Returns the identifiers of all FrostFS containers if pointer
|
||||||
// to user identifier is nil.
|
// to user identifier is nil.
|
||||||
func (c *Client) List(idUser *user.ID) ([]cid.ID, error) {
|
func (c *Client) List(idUser *user.ID) ([]cid.ID, error) {
|
||||||
var rawID []byte
|
var rawID []byte
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (a2 *AnnounceLoadPrm) SetReporter(key []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnnounceLoad saves container size estimation calculated by storage node
|
// AnnounceLoad saves container size estimation calculated by storage node
|
||||||
// with key in NeoFS system through Container contract call.
|
// with key in FrostFS system through Container contract call.
|
||||||
//
|
//
|
||||||
// Returns any error encountered that caused the saving to interrupt.
|
// Returns any error encountered that caused the saving to interrupt.
|
||||||
func (c *Client) AnnounceLoad(p AnnounceLoadPrm) error {
|
func (c *Client) AnnounceLoad(p AnnounceLoadPrm) error {
|
||||||
|
|
|
@ -89,7 +89,7 @@ func (p *PutPrm) SetZone(zone string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put saves binary container with its session token, key and signature
|
// Put saves binary container with its session token, key and signature
|
||||||
// in NeoFS system through Container contract call.
|
// in FrostFS system through Container contract call.
|
||||||
//
|
//
|
||||||
// Returns calculated container identifier and any error
|
// Returns calculated container identifier and any error
|
||||||
// encountered that caused the saving to interrupt.
|
// encountered that caused the saving to interrupt.
|
||||||
|
|
|
@ -19,7 +19,7 @@ func (x *commonBindArgs) SetOptionalPrm(op client.InvokePrmOptional) {
|
||||||
x.InvokePrmOptional = op
|
x.InvokePrmOptional = op
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetScriptHash sets script hash of the NeoFS account identifier.
|
// SetScriptHash sets script hash of the FrostFS account identifier.
|
||||||
func (x *commonBindArgs) SetScriptHash(v []byte) {
|
func (x *commonBindArgs) SetScriptHash(v []byte) {
|
||||||
x.scriptHash = v
|
x.scriptHash = v
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ type BindKeysPrm struct {
|
||||||
commonBindArgs
|
commonBindArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindKeys binds list of public keys from NeoFS account by script hash.
|
// BindKeys binds list of public keys from FrostFS account by script hash.
|
||||||
func (x *Client) BindKeys(p BindKeysPrm) error {
|
func (x *Client) BindKeys(p BindKeysPrm) error {
|
||||||
prm := client.InvokePrm{}
|
prm := client.InvokePrm{}
|
||||||
prm.SetMethod(bindKeysMethod)
|
prm.SetMethod(bindKeysMethod)
|
||||||
|
@ -55,7 +55,7 @@ type UnbindKeysPrm struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnbindKeys invokes the call of key unbinding method
|
// UnbindKeys invokes the call of key unbinding method
|
||||||
// of NeoFS contract.
|
// of FrostFS contract.
|
||||||
func (x *Client) UnbindKeys(args UnbindKeysPrm) error {
|
func (x *Client) UnbindKeys(args UnbindKeysPrm) error {
|
||||||
prm := client.InvokePrm{}
|
prm := client.InvokePrm{}
|
||||||
prm.SetMethod(unbindKeysMethod)
|
prm.SetMethod(unbindKeysMethod)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (c *ChequePrm) SetLock(lock util.Uint160) {
|
||||||
c.lock = lock
|
c.lock = lock
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cheque invokes `cheque` method of NeoFS contract.
|
// Cheque invokes `cheque` method of FrostFS contract.
|
||||||
func (x *Client) Cheque(p ChequePrm) error {
|
func (x *Client) Cheque(p ChequePrm) error {
|
||||||
prm := client.InvokePrm{}
|
prm := client.InvokePrm{}
|
||||||
prm.SetMethod(chequeMethod)
|
prm.SetMethod(chequeMethod)
|
||||||
|
|
|
@ -27,7 +27,7 @@ const (
|
||||||
chequeMethod = "cheque"
|
chequeMethod = "cheque"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewFromMorph wraps client to work with NeoFS contract.
|
// NewFromMorph wraps client to work with FrostFS contract.
|
||||||
func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*Client, error) {
|
func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*Client, error) {
|
||||||
o := defaultOpts()
|
o := defaultOpts()
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8,
|
||||||
|
|
||||||
sc, err := client.NewStatic(cli, contract, fee, ([]client.StaticClientOption)(*o)...)
|
sc, err := client.NewStatic(cli, contract, fee, ([]client.StaticClientOption)(*o)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not create client of NeoFS contract: %w", err)
|
return nil, fmt.Errorf("could not create client of FrostFS contract: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Client{client: sc}, nil
|
return &Client{client: sc}, nil
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommonBindPrm struct {
|
type CommonBindPrm struct {
|
||||||
ownerID []byte // NeoFS account identifier
|
ownerID []byte // FrostFS account identifier
|
||||||
|
|
||||||
keys [][]byte // list of serialized public keys
|
keys [][]byte // list of serialized public keys
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ func (x *CommonBindPrm) SetOptionalPrm(prm client.InvokePrmOptional) {
|
||||||
x.InvokePrmOptional = prm
|
x.InvokePrmOptional = prm
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOwnerID sets NeoFS account identifier.
|
// SetOwnerID sets FrostFS account identifier.
|
||||||
func (x *CommonBindPrm) SetOwnerID(v []byte) {
|
func (x *CommonBindPrm) SetOwnerID(v []byte) {
|
||||||
x.ownerID = v
|
x.ownerID = v
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func (x *CommonBindPrm) SetKeys(v [][]byte) {
|
||||||
x.keys = v
|
x.keys = v
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddKeys adds a list of public keys to/from NeoFS account.
|
// AddKeys adds a list of public keys to/from FrostFS account.
|
||||||
func (x *Client) AddKeys(p CommonBindPrm) error {
|
func (x *Client) AddKeys(p CommonBindPrm) error {
|
||||||
prm := client.InvokePrm{}
|
prm := client.InvokePrm{}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ func (x *Client) AddKeys(p CommonBindPrm) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveKeys removes a list of public keys to/from NeoFS account.
|
// RemoveKeys removes a list of public keys to/from FrostFS account.
|
||||||
func (x *Client) RemoveKeys(args CommonBindPrm) error {
|
func (x *Client) RemoveKeys(args CommonBindPrm) error {
|
||||||
prm := client.InvokePrm{}
|
prm := client.InvokePrm{}
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@ import (
|
||||||
|
|
||||||
// Client is a wrapper over StaticClient
|
// Client is a wrapper over StaticClient
|
||||||
// which makes calls with the names and arguments
|
// which makes calls with the names and arguments
|
||||||
// of the NeoFS ID contract.
|
// of the FrostFS ID contract.
|
||||||
//
|
//
|
||||||
// Working client must be created via constructor New.
|
// Working client must be created via constructor New.
|
||||||
// Using the Client that has been created with new(Client)
|
// Using the Client that has been created with new(Client)
|
||||||
// expression (or just declaring a Client variable) is unsafe
|
// expression (or just declaring a Client variable) is unsafe
|
||||||
// and can lead to panic.
|
// and can lead to panic.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
client *client.StaticClient // static NeoFS ID contract client
|
client *client.StaticClient // static FrostFS ID contract client
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -26,7 +26,7 @@ const (
|
||||||
removeKeysMethod = "removeKey"
|
removeKeysMethod = "removeKey"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewFromMorph wraps client to work with NeoFS ID contract.
|
// NewFromMorph wraps client to work with FrostFS ID contract.
|
||||||
func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*Client, error) {
|
func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*Client, error) {
|
||||||
o := defaultOpts()
|
o := defaultOpts()
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8,
|
||||||
|
|
||||||
sc, err := client.NewStatic(cli, contract, fee, ([]client.StaticClientOption)(*o)...)
|
sc, err := client.NewStatic(cli, contract, fee, ([]client.StaticClientOption)(*o)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not create client of NeoFS ID contract: %w", err)
|
return nil, fmt.Errorf("could not create client of FrostFS ID contract: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Client{client: sc}, nil
|
return &Client{client: sc}, nil
|
||||||
|
|
|
@ -19,7 +19,7 @@ func (a *AccountKeysPrm) SetID(id user.ID) {
|
||||||
a.id = id
|
a.id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccountKeys requests public keys of NeoFS account from NeoFS ID contract.
|
// AccountKeys requests public keys of FrostFS account from FrostFS ID contract.
|
||||||
func (x *Client) AccountKeys(p AccountKeysPrm) (keys.PublicKeys, error) {
|
func (x *Client) AccountKeys(p AccountKeysPrm) (keys.PublicKeys, error) {
|
||||||
prm := client.TestInvokePrm{}
|
prm := client.TestInvokePrm{}
|
||||||
prm.SetMethod(keyListingMethod)
|
prm.SetMethod(keyListingMethod)
|
||||||
|
|
|
@ -19,7 +19,7 @@ func (a *AddPeerPrm) SetNodeInfo(nodeInfo netmap.NodeInfo) {
|
||||||
a.nodeInfo = nodeInfo
|
a.nodeInfo = nodeInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddPeer registers peer in NeoFS network through
|
// AddPeer registers peer in FrostFS network through
|
||||||
// Netmap contract call.
|
// Netmap contract call.
|
||||||
func (c *Client) AddPeer(p AddPeerPrm) error {
|
func (c *Client) AddPeer(p AddPeerPrm) error {
|
||||||
var method = addPeerMethod
|
var method = addPeerMethod
|
||||||
|
|
|
@ -13,7 +13,7 @@ type NodeInfo = netmap.NodeInfo
|
||||||
|
|
||||||
// Client is a wrapper over StaticClient
|
// Client is a wrapper over StaticClient
|
||||||
// which makes calls with the names and arguments
|
// which makes calls with the names and arguments
|
||||||
// of the NeoFS Netmap contract.
|
// of the FrostFS Netmap contract.
|
||||||
//
|
//
|
||||||
// Working client must be created via constructor New.
|
// Working client must be created via constructor New.
|
||||||
// Using the Client that has been created with new(Client)
|
// Using the Client that has been created with new(Client)
|
||||||
|
|
|
@ -58,7 +58,7 @@ func (c *Client) AuditFee() (uint64, error) {
|
||||||
return fee, nil
|
return fee, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpochDuration returns number of sidechain blocks per one NeoFS epoch.
|
// EpochDuration returns number of sidechain blocks per one FrostFS epoch.
|
||||||
func (c *Client) EpochDuration() (uint64, error) {
|
func (c *Client) EpochDuration() (uint64, error) {
|
||||||
epochDuration, err := c.readUInt64Config(epochDurationConfig)
|
epochDuration, err := c.readUInt64Config(epochDurationConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -132,7 +132,7 @@ func (c *Client) InnerRingCandidateFee() (uint64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithdrawFee returns global configuration value of fee paid by user to
|
// WithdrawFee returns global configuration value of fee paid by user to
|
||||||
// withdraw assets from NeoFS contract.
|
// withdraw assets from FrostFS contract.
|
||||||
func (c *Client) WithdrawFee() (uint64, error) {
|
func (c *Client) WithdrawFee() (uint64, error) {
|
||||||
fee, err := c.readUInt64Config(withdrawFeeConfig)
|
fee, err := c.readUInt64Config(withdrawFeeConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -143,7 +143,7 @@ func (c *Client) WithdrawFee() (uint64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaintenanceModeAllowed reads admission of "maintenance" state from the
|
// MaintenanceModeAllowed reads admission of "maintenance" state from the
|
||||||
// NeoFS network configuration stored in the Sidechain. The admission means
|
// FrostFS network configuration stored in the Sidechain. The admission means
|
||||||
// that storage nodes are allowed to switch their state to "maintenance".
|
// that storage nodes are allowed to switch their state to "maintenance".
|
||||||
//
|
//
|
||||||
// By default, maintenance state is disallowed.
|
// By default, maintenance state is disallowed.
|
||||||
|
@ -171,7 +171,7 @@ func (c *Client) readStringConfig(key string) (string, error) {
|
||||||
return v.(string), nil
|
return v.(string), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// reads boolean value by the given key from the NeoFS network configuration
|
// reads boolean value by the given key from the FrostFS network configuration
|
||||||
// stored in the Sidechain. Returns false if key is not presented.
|
// stored in the Sidechain. Returns false if key is not presented.
|
||||||
func (c *Client) readBoolConfig(key string) (bool, error) {
|
func (c *Client) readBoolConfig(key string) (bool, error) {
|
||||||
v, err := c.config([]byte(key), BoolAssert)
|
v, err := c.config([]byte(key), BoolAssert)
|
||||||
|
@ -221,8 +221,8 @@ func (c *Client) SetConfig(p SetConfigPrm) error {
|
||||||
return c.client.Invoke(prm)
|
return c.client.Invoke(prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RawNetworkParameter is a NeoFS network parameter which is transmitted but
|
// RawNetworkParameter is a FrostFS network parameter which is transmitted but
|
||||||
// not interpreted by the NeoFS API protocol.
|
// not interpreted by the FrostFS API protocol.
|
||||||
type RawNetworkParameter struct {
|
type RawNetworkParameter struct {
|
||||||
// Name of the parameter.
|
// Name of the parameter.
|
||||||
Name string
|
Name string
|
||||||
|
@ -231,8 +231,8 @@ type RawNetworkParameter struct {
|
||||||
Value []byte
|
Value []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkConfiguration represents NeoFS network configuration stored
|
// NetworkConfiguration represents FrostFS network configuration stored
|
||||||
// in the NeoFS Sidechain.
|
// in the FrostFS Sidechain.
|
||||||
type NetworkConfiguration struct {
|
type NetworkConfiguration struct {
|
||||||
MaxObjectSize uint64
|
MaxObjectSize uint64
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ type NetworkConfiguration struct {
|
||||||
Raw []RawNetworkParameter
|
Raw []RawNetworkParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadNetworkConfiguration reads NetworkConfiguration from the NeoFS Sidechain.
|
// ReadNetworkConfiguration reads NetworkConfiguration from the FrostFS Sidechain.
|
||||||
func (c *Client) ReadNetworkConfiguration() (NetworkConfiguration, error) {
|
func (c *Client) ReadNetworkConfiguration() (NetworkConfiguration, error) {
|
||||||
var res NetworkConfiguration
|
var res NetworkConfiguration
|
||||||
prm := client.TestInvokePrm{}
|
prm := client.TestInvokePrm{}
|
||||||
|
@ -356,7 +356,7 @@ func bytesToBool(val []byte) bool {
|
||||||
var ErrConfigNotFound = errors.New("config value not found")
|
var ErrConfigNotFound = errors.New("config value not found")
|
||||||
|
|
||||||
// config performs the test invoke of get config value
|
// config performs the test invoke of get config value
|
||||||
// method of NeoFS Netmap contract.
|
// method of FrostFS Netmap contract.
|
||||||
//
|
//
|
||||||
// Returns ErrConfigNotFound if config key is not found in the contract.
|
// Returns ErrConfigNotFound if config key is not found in the contract.
|
||||||
func (c *Client) config(key []byte, assert func(stackitem.Item) (interface{}, error)) (interface{}, error) {
|
func (c *Client) config(key []byte, assert func(stackitem.Item) (interface{}, error)) (interface{}, error) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"github.com/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Epoch receives number of current NeoFS epoch
|
// Epoch receives number of current FrostFS epoch
|
||||||
// through the Netmap contract call.
|
// through the Netmap contract call.
|
||||||
func (c *Client) Epoch() (uint64, error) {
|
func (c *Client) Epoch() (uint64, error) {
|
||||||
prm := client.TestInvokePrm{}
|
prm := client.TestInvokePrm{}
|
||||||
|
@ -30,7 +30,7 @@ func (c *Client) Epoch() (uint64, error) {
|
||||||
return uint64(num), nil
|
return uint64(num), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LastEpochBlock receives block number of current NeoFS epoch
|
// LastEpochBlock receives block number of current FrostFS epoch
|
||||||
// through the Netmap contract call.
|
// through the Netmap contract call.
|
||||||
func (c *Client) LastEpochBlock() (uint32, error) {
|
func (c *Client) LastEpochBlock() (uint32, error) {
|
||||||
prm := client.TestInvokePrm{}
|
prm := client.TestInvokePrm{}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"github.com/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewEpoch updates NeoFS epoch number through
|
// NewEpoch updates FrostFS epoch number through
|
||||||
// Netmap contract call.
|
// Netmap contract call.
|
||||||
func (c *Client) NewEpoch(epoch uint64) error {
|
func (c *Client) NewEpoch(epoch uint64) error {
|
||||||
prm := client.InvokePrm{}
|
prm := client.InvokePrm{}
|
||||||
|
|
|
@ -36,7 +36,7 @@ const (
|
||||||
NNSReputationContractName = "reputation.frostfs"
|
NNSReputationContractName = "reputation.frostfs"
|
||||||
// NNSSubnetworkContractName is a name of the subnet contract in NNS.
|
// NNSSubnetworkContractName is a name of the subnet contract in NNS.
|
||||||
NNSSubnetworkContractName = "subnet.frostfs"
|
NNSSubnetworkContractName = "subnet.frostfs"
|
||||||
// NNSGroupKeyName is a name for the NeoFS group key record in NNS.
|
// NNSGroupKeyName is a name for the FrostFS group key record in NNS.
|
||||||
NNSGroupKeyName = "group.frostfs"
|
NNSGroupKeyName = "group.frostfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ func exists(c *rpcclient.WSClient, nnsHash util.Uint160, domain string) (bool, e
|
||||||
return !available, nil
|
return !available, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetGroupSignerScope makes the default signer scope include all NeoFS contracts.
|
// SetGroupSignerScope makes the default signer scope include all FrostFS contracts.
|
||||||
// Should be called for side-chain client only.
|
// Should be called for side-chain client only.
|
||||||
func (c *Client) SetGroupSignerScope() error {
|
func (c *Client) SetGroupSignerScope() error {
|
||||||
c.switchLock.RLock()
|
c.switchLock.RLock()
|
||||||
|
@ -213,7 +213,7 @@ func (c *Client) SetGroupSignerScope() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// contractGroupKey returns public key designating NeoFS contract group.
|
// contractGroupKey returns public key designating FrostFS contract group.
|
||||||
func (c *Client) contractGroupKey() (*keys.PublicKey, error) {
|
func (c *Client) contractGroupKey() (*keys.PublicKey, error) {
|
||||||
if gKey := c.cache.groupKey(); gKey != nil {
|
if gKey := c.cache.groupKey(); gKey != nil {
|
||||||
return gKey, nil
|
return gKey, nil
|
||||||
|
|
|
@ -569,7 +569,7 @@ func (c *Client) notaryCosigners(invokedByAlpha bool, ir []*keys.PublicKey, comm
|
||||||
|
|
||||||
multisigScript, err := sc.CreateMultiSigRedeemScript(m, ir)
|
multisigScript, err := sc.CreateMultiSigRedeemScript(m, ir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// wrap error as NeoFS-specific since the call is not related to any client
|
// wrap error as FrostFS-specific since the call is not related to any client
|
||||||
return nil, wrapFrostFSError(fmt.Errorf("can't create ir multisig redeem script: %w", err))
|
return nil, wrapFrostFSError(fmt.Errorf("can't create ir multisig redeem script: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
|
||||||
multisigAccount = wallet.NewAccountFromPrivateKey(c.acc.PrivateKey())
|
multisigAccount = wallet.NewAccountFromPrivateKey(c.acc.PrivateKey())
|
||||||
err := multisigAccount.ConvertMultisig(m, ir)
|
err := multisigAccount.ConvertMultisig(m, ir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// wrap error as NeoFS-specific since the call is not related to any client
|
// wrap error as FrostFS-specific since the call is not related to any client
|
||||||
return nil, wrapFrostFSError(fmt.Errorf("can't convert account to inner ring multisig wallet: %w", err))
|
return nil, wrapFrostFSError(fmt.Errorf("can't convert account to inner ring multisig wallet: %w", err))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -712,7 +712,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
|
||||||
// inner ring multiaddress witness
|
// inner ring multiaddress witness
|
||||||
multisigAccount, err = notary.FakeMultisigAccount(m, ir)
|
multisigAccount, err = notary.FakeMultisigAccount(m, ir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// wrap error as NeoFS-specific since the call is not related to any client
|
// wrap error as FrostFS-specific since the call is not related to any client
|
||||||
return nil, wrapFrostFSError(fmt.Errorf("can't make inner ring multisig wallet: %w", err))
|
return nil, wrapFrostFSError(fmt.Errorf("can't make inner ring multisig wallet: %w", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -766,7 +766,7 @@ func invocationParams(args ...interface{}) ([]sc.Parameter, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sigCount returns the number of required signature.
|
// sigCount returns the number of required signature.
|
||||||
// For NeoFS Alphabet M is a 2/3+1 of it (like in dBFT).
|
// For FrostFS Alphabet M is a 2/3+1 of it (like in dBFT).
|
||||||
// If committee is true, returns M as N/2+1.
|
// If committee is true, returns M as N/2+1.
|
||||||
func sigCount(ir []*keys.PublicKey, committee bool) int {
|
func sigCount(ir []*keys.PublicKey, committee bool) int {
|
||||||
if committee {
|
if committee {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
// Client is a wrapper over StaticClient
|
// Client is a wrapper over StaticClient
|
||||||
// which makes calls with the names and arguments
|
// which makes calls with the names and arguments
|
||||||
// of the NeoFS reputation contract.
|
// of the FrostFS reputation contract.
|
||||||
//
|
//
|
||||||
// Working client must be created via constructor New.
|
// Working client must be created via constructor New.
|
||||||
// Using the Client that has been created with new(Client)
|
// Using the Client that has been created with new(Client)
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (x *ManageAdminsPrm) SetClient() {
|
||||||
x.client = true
|
x.client = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSubnet sets identifier of the subnet in a binary NeoFS API protocol format.
|
// SetSubnet sets identifier of the subnet in a binary FrostFS API protocol format.
|
||||||
func (x *ManageAdminsPrm) SetSubnet(id []byte) {
|
func (x *ManageAdminsPrm) SetSubnet(id []byte) {
|
||||||
x.subnet = id
|
x.subnet = id
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ func (x *ManageAdminsPrm) SetAdmin(key []byte) {
|
||||||
x.admin = key
|
x.admin = key
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetGroup sets identifier of the client group in a binary NeoFS API protocol format.
|
// SetGroup sets identifier of the client group in a binary FrostFS API protocol format.
|
||||||
// Makes sense only for client admins (see ManageAdminsPrm.SetClient).
|
// Makes sense only for client admins (see ManageAdminsPrm.SetClient).
|
||||||
func (x *ManageAdminsPrm) SetGroup(id []byte) {
|
func (x *ManageAdminsPrm) SetGroup(id []byte) {
|
||||||
x.group = id
|
x.group = id
|
||||||
|
@ -48,7 +48,7 @@ func (x *ManageAdminsPrm) SetGroup(id []byte) {
|
||||||
// ManageAdminsRes groups the resulting values of node administer methods of Subnet contract.
|
// ManageAdminsRes groups the resulting values of node administer methods of Subnet contract.
|
||||||
type ManageAdminsRes struct{}
|
type ManageAdminsRes struct{}
|
||||||
|
|
||||||
// ManageAdmins manages admin list of the NeoFS subnet through Subnet contract calls.
|
// ManageAdmins manages admin list of the FrostFS subnet through Subnet contract calls.
|
||||||
func (x Client) ManageAdmins(prm ManageAdminsPrm) (*ManageAdminsPrm, error) {
|
func (x Client) ManageAdmins(prm ManageAdminsPrm) (*ManageAdminsPrm, error) {
|
||||||
var method string
|
var method string
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (x *InitPrm) SetBaseClient(base *client.Client) {
|
||||||
x.base = base
|
x.base = base
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetContractAddress sets address of Subnet contract in NeoFS sidechain.
|
// SetContractAddress sets address of Subnet contract in FrostFS sidechain.
|
||||||
func (x *InitPrm) SetContractAddress(addr util.Uint160) {
|
func (x *InitPrm) SetContractAddress(addr util.Uint160) {
|
||||||
x.addr = addr
|
x.addr = addr
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,12 @@ type UserAllowedPrm struct {
|
||||||
args [2]interface{}
|
args [2]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the subnet in a binary NeoFS API protocol format.
|
// SetID sets identifier of the subnet in a binary FrostFS API protocol format.
|
||||||
func (x *UserAllowedPrm) SetID(id []byte) {
|
func (x *UserAllowedPrm) SetID(id []byte) {
|
||||||
x.args[0] = id
|
x.args[0] = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetClient sets owner ID of the client that is being checked in a binary NeoFS API protocol format.
|
// SetClient sets owner ID of the client that is being checked in a binary FrostFS API protocol format.
|
||||||
func (x *UserAllowedPrm) SetClient(id []byte) {
|
func (x *UserAllowedPrm) SetClient(id []byte) {
|
||||||
x.args[1] = id
|
x.args[1] = id
|
||||||
}
|
}
|
||||||
|
@ -72,17 +72,17 @@ func (x *ManageClientsPrm) SetRemove() {
|
||||||
x.rm = true
|
x.rm = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSubnet sets identifier of the subnet in a binary NeoFS API protocol format.
|
// SetSubnet sets identifier of the subnet in a binary FrostFS API protocol format.
|
||||||
func (x *ManageClientsPrm) SetSubnet(id []byte) {
|
func (x *ManageClientsPrm) SetSubnet(id []byte) {
|
||||||
x.args[0] = id
|
x.args[0] = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetGroup sets identifier of the client group in a binary NeoFS API protocol format.
|
// SetGroup sets identifier of the client group in a binary FrostFS API protocol format.
|
||||||
func (x *ManageClientsPrm) SetGroup(id []byte) {
|
func (x *ManageClientsPrm) SetGroup(id []byte) {
|
||||||
x.args[1] = id
|
x.args[1] = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetClient sets client's user ID in a binary NeoFS API protocol format.
|
// SetClient sets client's user ID in a binary FrostFS API protocol format.
|
||||||
func (x *ManageClientsPrm) SetClient(id []byte) {
|
func (x *ManageClientsPrm) SetClient(id []byte) {
|
||||||
x.args[2] = id
|
x.args[2] = id
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ func (x *ManageClientsPrm) SetClient(id []byte) {
|
||||||
// ManageClientsRes groups the resulting values of client management methods of Subnet contract.
|
// ManageClientsRes groups the resulting values of client management methods of Subnet contract.
|
||||||
type ManageClientsRes struct{}
|
type ManageClientsRes struct{}
|
||||||
|
|
||||||
// ManageClients manages client list of the NeoFS subnet through Subnet contract calls.
|
// ManageClients manages client list of the FrostFS subnet through Subnet contract calls.
|
||||||
func (x Client) ManageClients(prm ManageClientsPrm) (*ManageClientsRes, error) {
|
func (x Client) ManageClients(prm ManageClientsPrm) (*ManageClientsRes, error) {
|
||||||
var method string
|
var method string
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (x *DeletePrm) SetTxHash(hash util.Uint256) {
|
||||||
x.cliPrm.SetHash(hash)
|
x.cliPrm.SetHash(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the subnet to be removed in a binary NeoFS API protocol format.
|
// SetID sets identifier of the subnet to be removed in a binary FrostFS API protocol format.
|
||||||
func (x *DeletePrm) SetID(id []byte) {
|
func (x *DeletePrm) SetID(id []byte) {
|
||||||
x.args[0] = id
|
x.args[0] = id
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ type GetPrm struct {
|
||||||
args [1]interface{}
|
args [1]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the subnet to be read in a binary NeoFS API protocol format.
|
// SetID sets identifier of the subnet to be read in a binary FrostFS API protocol format.
|
||||||
func (x *GetPrm) SetID(id []byte) {
|
func (x *GetPrm) SetID(id []byte) {
|
||||||
x.args[0] = id
|
x.args[0] = id
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ type GetRes struct {
|
||||||
info []byte
|
info []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info returns information about the subnet in a binary format of NeoFS API protocol.
|
// Info returns information about the subnet in a binary format of FrostFS API protocol.
|
||||||
func (x GetRes) Info() []byte {
|
func (x GetRes) Info() []byte {
|
||||||
return x.info
|
return x.info
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ type NodeAllowedPrm struct {
|
||||||
args [2]interface{}
|
args [2]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the subnet of the node in a binary NeoFS API protocol format.
|
// SetID sets identifier of the subnet of the node in a binary FrostFS API protocol format.
|
||||||
func (x *NodeAllowedPrm) SetID(id []byte) {
|
func (x *NodeAllowedPrm) SetID(id []byte) {
|
||||||
x.args[0] = id
|
x.args[0] = id
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,17 +18,17 @@ func (x *PutPrm) SetTxHash(hash util.Uint256) {
|
||||||
x.cliPrm.SetHash(hash)
|
x.cliPrm.SetHash(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the created subnet in a binary NeoFS API protocol format.
|
// SetID sets identifier of the created subnet in a binary FrostFS API protocol format.
|
||||||
func (x *PutPrm) SetID(id []byte) {
|
func (x *PutPrm) SetID(id []byte) {
|
||||||
x.args[0] = id
|
x.args[0] = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOwner sets identifier of the subnet owner in a binary NeoFS API protocol format.
|
// SetOwner sets identifier of the subnet owner in a binary FrostFS API protocol format.
|
||||||
func (x *PutPrm) SetOwner(id []byte) {
|
func (x *PutPrm) SetOwner(id []byte) {
|
||||||
x.args[1] = id
|
x.args[1] = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetInfo sets information about the created subnet in a binary NeoFS API protocol format.
|
// SetInfo sets information about the created subnet in a binary FrostFS API protocol format.
|
||||||
func (x *PutPrm) SetInfo(id []byte) {
|
func (x *PutPrm) SetInfo(id []byte) {
|
||||||
x.args[2] = id
|
x.args[2] = id
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetEACL represents structure of notification about
|
// SetEACL represents structure of notification about
|
||||||
// modified eACL table coming from NeoFS Container contract.
|
// modified eACL table coming from FrostFS Container contract.
|
||||||
type SetEACL struct {
|
type SetEACL struct {
|
||||||
table []byte
|
table []byte
|
||||||
signature []byte
|
signature []byte
|
||||||
|
@ -25,7 +25,7 @@ type SetEACL struct {
|
||||||
// MorphEvent implements Neo:Morph Event interface.
|
// MorphEvent implements Neo:Morph Event interface.
|
||||||
func (SetEACL) MorphEvent() {}
|
func (SetEACL) MorphEvent() {}
|
||||||
|
|
||||||
// Table returns returns eACL table in a binary NeoFS API format.
|
// Table returns returns eACL table in a binary FrostFS API format.
|
||||||
func (x SetEACL) Table() []byte {
|
func (x SetEACL) Table() []byte {
|
||||||
return x.table
|
return x.table
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (p Put) NotaryRequest() *payload.P2PNotaryRequest {
|
||||||
return p.notaryRequest
|
return p.notaryRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutNamed represents notification event spawned by PutNamed method from Container contract of NeoFS Morph chain.
|
// PutNamed represents notification event spawned by PutNamed method from Container contract of FrostFS Morph chain.
|
||||||
type PutNamed struct {
|
type PutNamed struct {
|
||||||
Put
|
Put
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ type Put struct {
|
||||||
// MorphEvent implements Neo:Morph Event interface.
|
// MorphEvent implements Neo:Morph Event interface.
|
||||||
func (Put) MorphEvent() {}
|
func (Put) MorphEvent() {}
|
||||||
|
|
||||||
// ID returns identifier of the creating subnet in a binary format of NeoFS API protocol.
|
// ID returns identifier of the creating subnet in a binary format of FrostFS API protocol.
|
||||||
func (x Put) ID() []byte {
|
func (x Put) ID() []byte {
|
||||||
return x.id
|
return x.id
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ func (x Put) Owner() []byte {
|
||||||
return x.owner
|
return x.owner
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info returns information about the subnet in a binary format of NeoFS API protocol.
|
// Info returns information about the subnet in a binary format of FrostFS API protocol.
|
||||||
func (x Put) Info() []byte {
|
func (x Put) Info() []byte {
|
||||||
return x.info
|
return x.info
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ func New(ctx context.Context, p *Params) (Subscriber, error) {
|
||||||
// returns error if it is not reached that height after timeout duration.
|
// returns error if it is not reached that height after timeout duration.
|
||||||
// This function is required to avoid connections to unsynced RPC nodes, because
|
// This function is required to avoid connections to unsynced RPC nodes, because
|
||||||
// they can produce events from the past that should not be processed by
|
// they can produce events from the past that should not be processed by
|
||||||
// NeoFS nodes.
|
// FrostFS nodes.
|
||||||
func awaitHeight(cli *client.Client, startFrom uint32) error {
|
func awaitHeight(cli *client.Client, startFrom uint32) error {
|
||||||
if startFrom == 0 {
|
if startFrom == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
URIAddr strings: "<scheme://>127.0.0.1:8080"
|
URIAddr strings: "<scheme://>127.0.0.1:8080"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Address represents the NeoFS node
|
// Address represents the FrostFS node
|
||||||
// network address.
|
// network address.
|
||||||
type Address struct {
|
type Address struct {
|
||||||
ma multiaddr.Multiaddr
|
ma multiaddr.Multiaddr
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
accountingsvc "github.com/TrueCloudLab/frostfs-node/pkg/services/accounting"
|
accountingsvc "github.com/TrueCloudLab/frostfs-node/pkg/services/accounting"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps NeoFS API Accounting service and
|
// Server wraps FrostFS API Accounting service and
|
||||||
// provides gRPC Accounting service server interface.
|
// provides gRPC Accounting service server interface.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
srv accountingsvc.Server
|
srv accountingsvc.Server
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
containersvc "github.com/TrueCloudLab/frostfs-node/pkg/services/container"
|
containersvc "github.com/TrueCloudLab/frostfs-node/pkg/services/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps NeoFS API Container service and
|
// Server wraps FrostFS API Container service and
|
||||||
// provides gRPC Container service server interface.
|
// provides gRPC Container service server interface.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
srv containersvc.Server
|
srv containersvc.Server
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
netmapsvc "github.com/TrueCloudLab/frostfs-node/pkg/services/netmap"
|
netmapsvc "github.com/TrueCloudLab/frostfs-node/pkg/services/netmap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps NeoFS API Netmap service and
|
// Server wraps FrostFS API Netmap service and
|
||||||
// provides gRPC Netmap service server interface.
|
// provides gRPC Netmap service server interface.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
srv netmapsvc.Server
|
srv netmapsvc.Server
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-node/pkg/services/util"
|
"github.com/TrueCloudLab/frostfs-node/pkg/services/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps NeoFS API Object service and
|
// Server wraps FrostFS API Object service and
|
||||||
// provides gRPC Object service server interface.
|
// provides gRPC Object service server interface.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
srv objectSvc.ServiceServer
|
srv objectSvc.ServiceServer
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
reputationrpc "github.com/TrueCloudLab/frostfs-node/pkg/services/reputation/rpc"
|
reputationrpc "github.com/TrueCloudLab/frostfs-node/pkg/services/reputation/rpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps NeoFS API v2 Reputation service server
|
// Server wraps FrostFS API v2 Reputation service server
|
||||||
// and provides gRPC Reputation service server interface.
|
// and provides gRPC Reputation service server interface.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
srv reputationrpc.Server
|
srv reputationrpc.Server
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
sessionsvc "github.com/TrueCloudLab/frostfs-node/pkg/services/session"
|
sessionsvc "github.com/TrueCloudLab/frostfs-node/pkg/services/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps NeoFS API Session service and
|
// Server wraps FrostFS API Session service and
|
||||||
// provides gRPC Session service server interface.
|
// provides gRPC Session service server interface.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
srv sessionsvc.Server
|
srv sessionsvc.Server
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/accounting"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/accounting"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is an interface of the NeoFS API Accounting service server.
|
// Server is an interface of the FrostFS API Accounting service server.
|
||||||
type Server interface {
|
type Server interface {
|
||||||
Balance(context.Context, *accounting.BalanceRequest) (*accounting.BalanceResponse, error)
|
Balance(context.Context, *accounting.BalanceRequest) (*accounting.BalanceResponse, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/netmap"
|
"github.com/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PlacementBuilder describes interface of NeoFS placement calculator.
|
// PlacementBuilder describes interface of FrostFS placement calculator.
|
||||||
type PlacementBuilder interface {
|
type PlacementBuilder interface {
|
||||||
// BuildPlacement must compose and sort (according to a specific algorithm)
|
// BuildPlacement must compose and sort (according to a specific algorithm)
|
||||||
// storage nodes from the container by its identifier using network map
|
// storage nodes from the container by its identifier using network map
|
||||||
|
|
|
@ -27,8 +27,8 @@ type Reader interface {
|
||||||
containercore.EACLSource
|
containercore.EACLSource
|
||||||
|
|
||||||
// List returns a list of container identifiers belonging
|
// List returns a list of container identifiers belonging
|
||||||
// to the specified user of NeoFS system. Returns the identifiers
|
// to the specified user of FrostFS system. Returns the identifiers
|
||||||
// of all NeoFS containers if pointer to owner identifier is nil.
|
// of all FrostFS containers if pointer to owner identifier is nil.
|
||||||
List(*user.ID) ([]cid.ID, error)
|
List(*user.ID) ([]cid.ID, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/container"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is an interface of the NeoFS API Container service server.
|
// Server is an interface of the FrostFS API Container service server.
|
||||||
type Server interface {
|
type Server interface {
|
||||||
Put(context.Context, *container.PutRequest) (*container.PutResponse, error)
|
Put(context.Context, *container.PutRequest) (*container.PutResponse, error)
|
||||||
Get(context.Context, *container.GetRequest) (*container.GetResponse, error)
|
Get(context.Context, *container.GetRequest) (*container.GetResponse, error)
|
||||||
|
|
|
@ -24,7 +24,7 @@ type executorSvc struct {
|
||||||
// about current node state.
|
// about current node state.
|
||||||
type NodeState interface {
|
type NodeState interface {
|
||||||
// Must return current node state
|
// Must return current node state
|
||||||
// in NeoFS API v2 NodeInfo structure.
|
// in FrostFS API v2 NodeInfo structure.
|
||||||
LocalNodeInfo() (*netmap.NodeInfo, error)
|
LocalNodeInfo() (*netmap.NodeInfo, error)
|
||||||
|
|
||||||
// ReadCurrentNetMap reads current local network map of the storage node
|
// ReadCurrentNetMap reads current local network map of the storage node
|
||||||
|
@ -34,9 +34,9 @@ type NodeState interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfo encapsulates source of the
|
// NetworkInfo encapsulates source of the
|
||||||
// recent information about the NeoFS network.
|
// recent information about the FrostFS network.
|
||||||
type NetworkInfo interface {
|
type NetworkInfo interface {
|
||||||
// Must return recent network information in NeoFS API v2 NetworkInfo structure.
|
// Must return recent network information in FrostFS API v2 NetworkInfo structure.
|
||||||
//
|
//
|
||||||
// If protocol version is <=2.9, MillisecondsPerBlock and network config should be unset.
|
// If protocol version is <=2.9, MillisecondsPerBlock and network config should be unset.
|
||||||
Dump(versionsdk.Version) (*netmapSDK.NetworkInfo, error)
|
Dump(versionsdk.Version) (*netmapSDK.NetworkInfo, error)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/netmap"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/netmap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is an interface of the NeoFS API Netmap service server.
|
// Server is an interface of the FrostFS API Netmap service server.
|
||||||
type Server interface {
|
type Server interface {
|
||||||
LocalNodeInfo(context.Context, *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error)
|
LocalNodeInfo(context.Context, *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error)
|
||||||
NetworkInfo(context.Context, *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error)
|
NetworkInfo(context.Context, *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error)
|
||||||
|
|
|
@ -98,7 +98,7 @@ func (c *Checker) CheckBasicACL(info v2.RequestInfo) bool {
|
||||||
|
|
||||||
// StickyBitCheck validates owner field in the request if sticky bit is enabled.
|
// StickyBitCheck validates owner field in the request if sticky bit is enabled.
|
||||||
func (c *Checker) StickyBitCheck(info v2.RequestInfo, owner user.ID) bool {
|
func (c *Checker) StickyBitCheck(info v2.RequestInfo, owner user.ID) bool {
|
||||||
// According to NeoFS specification sticky bit has no effect on system nodes
|
// According to FrostFS specification sticky bit has no effect on system nodes
|
||||||
// for correct intra-container work with objects (in particular, replication).
|
// for correct intra-container work with objects (in particular, replication).
|
||||||
if info.RequestRole() == acl.RoleContainer {
|
if info.RequestRole() == acl.RoleContainer {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -192,9 +192,9 @@ func assertVerb(tok sessionSDK.Object, op acl.Op) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// assertSessionRelation checks if given token describing the NeoFS session
|
// assertSessionRelation checks if given token describing the FrostFS session
|
||||||
// relates to the given container and optional object. Missing object
|
// relates to the given container and optional object. Missing object
|
||||||
// means that the context isn't bound to any NeoFS object in the container.
|
// means that the context isn't bound to any FrostFS object in the container.
|
||||||
// Returns no error iff relation is correct. Criteria:
|
// Returns no error iff relation is correct. Criteria:
|
||||||
//
|
//
|
||||||
// session is bound to the given container
|
// session is bound to the given container
|
||||||
|
|
|
@ -26,7 +26,7 @@ type NetworkInfo interface {
|
||||||
netmap.State
|
netmap.State
|
||||||
|
|
||||||
// Must return the lifespan of the tombstones
|
// Must return the lifespan of the tombstones
|
||||||
// in the NeoFS epochs.
|
// in the FrostFS epochs.
|
||||||
TombstoneLifetime() (uint64, error)
|
TombstoneLifetime() (uint64, error)
|
||||||
|
|
||||||
// Returns user ID of the local storage node. Result must not be nil.
|
// Returns user ID of the local storage node. Result must not be nil.
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (s *Service) GetRangeHash(ctx context.Context, req *objectV2.GetRangeHashRe
|
||||||
return toHashResponse(req.GetBody().GetType(), res), nil
|
return toHashResponse(req.GetBody().GetType(), res), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Head serves NeoFS API v2 compatible HEAD requests.
|
// Head serves ForstFS API v2 compatible HEAD requests.
|
||||||
func (s *Service) Head(ctx context.Context, req *objectV2.HeadRequest) (*objectV2.HeadResponse, error) {
|
func (s *Service) Head(ctx context.Context, req *objectV2.HeadRequest) (*objectV2.HeadResponse, error) {
|
||||||
resp := new(objectV2.HeadResponse)
|
resp := new(objectV2.HeadResponse)
|
||||||
resp.SetBody(new(objectV2.HeadResponseBody))
|
resp.SetBody(new(objectV2.HeadResponseBody))
|
||||||
|
|
|
@ -34,7 +34,7 @@ type commonPrm struct {
|
||||||
xHeaders []string
|
xHeaders []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetClient sets base client for NeoFS API communication.
|
// SetClient sets base client for ForstFS API communication.
|
||||||
//
|
//
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
func (x *commonPrm) SetClient(cli coreclient.Client) {
|
func (x *commonPrm) SetClient(cli coreclient.Client) {
|
||||||
|
@ -260,7 +260,7 @@ func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("read object header from NeoFS: %w", err)
|
return nil, fmt.Errorf("read object header from FrostFS: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hdr object.Object
|
var hdr object.Object
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Package internal provides functionality for NeoFS Node Object service communication with NeoFS network.
|
// Package internal provides functionality for FrostFS Node Object service communication with FrostFS network.
|
||||||
// The base client for accessing remote nodes via NeoFS API is a NeoFS SDK Go API client.
|
// The base client for accessing remote nodes via FrostFS API is a FrostFS SDK Go API client.
|
||||||
// However, although it encapsulates a useful piece of business logic (e.g. the signature mechanism),
|
// However, although it encapsulates a useful piece of business logic (e.g. the signature mechanism),
|
||||||
// the Object service does not fully use the client's flexible interface.
|
// the Object service does not fully use the client's flexible interface.
|
||||||
//
|
//
|
||||||
|
@ -7,5 +7,5 @@
|
||||||
// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient
|
// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient
|
||||||
// both when updating the base client and for evaluating the UX of SDK library). So it is expected that all
|
// both when updating the base client and for evaluating the UX of SDK library). So it is expected that all
|
||||||
// Object service packages will be limited to this package for the development of functionality requiring
|
// Object service packages will be limited to this package for the development of functionality requiring
|
||||||
// NeoFS API communication.
|
// FrostFS API communication.
|
||||||
package internal
|
package internal
|
||||||
|
|
|
@ -7,25 +7,25 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-node/pkg/services/util"
|
"github.com/TrueCloudLab/frostfs-node/pkg/services/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetObjectStream is an interface of NeoFS API v2 compatible object streamer.
|
// GetObjectStream is an interface of FrostFS API v2 compatible object streamer.
|
||||||
type GetObjectStream interface {
|
type GetObjectStream interface {
|
||||||
util.ServerStream
|
util.ServerStream
|
||||||
Send(*object.GetResponse) error
|
Send(*object.GetResponse) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetObjectRangeStream is an interface of NeoFS API v2 compatible payload range streamer.
|
// GetObjectRangeStream is an interface of FrostFS API v2 compatible payload range streamer.
|
||||||
type GetObjectRangeStream interface {
|
type GetObjectRangeStream interface {
|
||||||
util.ServerStream
|
util.ServerStream
|
||||||
Send(*object.GetRangeResponse) error
|
Send(*object.GetRangeResponse) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// SearchStream is an interface of NeoFS API v2 compatible search streamer.
|
// SearchStream is an interface of FrostFS API v2 compatible search streamer.
|
||||||
type SearchStream interface {
|
type SearchStream interface {
|
||||||
util.ServerStream
|
util.ServerStream
|
||||||
Send(*object.SearchResponse) error
|
Send(*object.SearchResponse) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutObjectStream is an interface of NeoFS API v2 compatible client's object streamer.
|
// PutObjectStream is an interface of FrostFS API v2 compatible client's object streamer.
|
||||||
type PutObjectStream interface {
|
type PutObjectStream interface {
|
||||||
Send(*object.PutRequest) error
|
Send(*object.PutRequest) error
|
||||||
CloseAndRecv() (*object.PutResponse, error)
|
CloseAndRecv() (*object.PutResponse, error)
|
||||||
|
|
|
@ -41,7 +41,7 @@ func NewKeyStorage(localKey *ecdsa.PrivateKey, tokenStore SessionSource, net net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionInfo groups information about NeoFS Object session
|
// SessionInfo groups information about FrostFS Object session
|
||||||
// which is reflected in KeyStorage.
|
// which is reflected in KeyStorage.
|
||||||
type SessionInfo struct {
|
type SessionInfo struct {
|
||||||
// Session unique identifier.
|
// Session unique identifier.
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (g *ExpirationChecker) IsTombstoneAvailable(ctx context.Context, a oid.Addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// requested tombstone not
|
// requested tombstone not
|
||||||
// found in the NeoFS network
|
// found in the FrostFS network
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Source represents wrapper over the object service that
|
// Source represents wrapper over the object service that
|
||||||
// allows checking if a tombstone is available in NeoFS
|
// allows checking if a tombstone is available in FrostFS
|
||||||
// network.
|
// network.
|
||||||
//
|
//
|
||||||
// Must be created via NewSource function. `var` and `Source{}`
|
// Must be created via NewSource function. `var` and `Source{}`
|
||||||
|
|
|
@ -248,11 +248,11 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// isClientErrMaintenance checks if err corresponds to NeoFS status return
|
// isClientErrMaintenance checks if err corresponds to FrostFS status return
|
||||||
// which tells that node is currently under maintenance. Supports wrapped
|
// which tells that node is currently under maintenance. Supports wrapped
|
||||||
// errors.
|
// errors.
|
||||||
//
|
//
|
||||||
// Similar to client.IsErr___ errors, consider replacing to NeoFS SDK.
|
// Similar to client.IsErr___ errors, consider replacing to FrostFS SDK.
|
||||||
func isClientErrMaintenance(err error) bool {
|
func isClientErrMaintenance(err error) bool {
|
||||||
switch unwrapErr(err).(type) {
|
switch unwrapErr(err).(type) {
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -210,7 +210,7 @@ func WithPool(p *ants.Pool) Option {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithNodeLoader returns option to set NeoFS node load source.
|
// WithNodeLoader returns option to set FrostFS node load source.
|
||||||
func WithNodeLoader(l nodeLoader) Option {
|
func WithNodeLoader(l nodeLoader) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.loader = l
|
c.loader = l
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/reputation"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/reputation"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is an interface of the NeoFS API v2 Reputation service server.
|
// Server is an interface of the FrostFS API v2 Reputation service server.
|
||||||
type Server interface {
|
type Server interface {
|
||||||
AnnounceLocalTrust(context.Context, *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error)
|
AnnounceLocalTrust(context.Context, *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error)
|
||||||
AnnounceIntermediateResult(context.Context, *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error)
|
AnnounceIntermediateResult(context.Context, *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-api-go/v2/session"
|
"github.com/TrueCloudLab/frostfs-api-go/v2/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is an interface of the NeoFS API Session service server.
|
// Server is an interface of the FrostFS API Session service server.
|
||||||
type Server interface {
|
type Server interface {
|
||||||
Create(context.Context, *session.CreateRequest) (*session.CreateResponse, error)
|
Create(context.Context, *session.CreateRequest) (*session.CreateResponse, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
type ContainerSource interface {
|
type ContainerSource interface {
|
||||||
container.Source
|
container.Source
|
||||||
// List must return list of all the containers in the NeoFS network
|
// List must return list of all the containers in the FrostFS network
|
||||||
// at the moment of a call and any error that does not allow fetching
|
// at the moment of a call and any error that does not allow fetching
|
||||||
// container information.
|
// container information.
|
||||||
List() ([]cid.ID, error)
|
List() ([]cid.ID, error)
|
||||||
|
|
|
@ -213,7 +213,7 @@ var errDENY = errors.New("DENY eACL rule")
|
||||||
var errNoAllowRules = errors.New("not found allowing rules for the request")
|
var errNoAllowRules = errors.New("not found allowing rules for the request")
|
||||||
|
|
||||||
// checkEACL searches for the eACL rules that could be applied to the request
|
// checkEACL searches for the eACL rules that could be applied to the request
|
||||||
// (a tuple of a signer key, his NeoFS role and a request operation).
|
// (a tuple of a signer key, his FrostFS role and a request operation).
|
||||||
// It does not filter the request by the filters of the eACL table since tree
|
// It does not filter the request by the filters of the eACL table since tree
|
||||||
// requests do not contain any "object" information that could be filtered and,
|
// requests do not contain any "object" information that could be filtered and,
|
||||||
// therefore, filtering leads to unexpected results.
|
// therefore, filtering leads to unexpected results.
|
||||||
|
|
|
@ -27,7 +27,7 @@ message LogMove {
|
||||||
|
|
||||||
// Signature of a message.
|
// Signature of a message.
|
||||||
message Signature {
|
message Signature {
|
||||||
// Serialized public key as defined in NeoFS API.
|
// Serialized public key as defined in FrostFS API.
|
||||||
bytes key = 1 [json_name = "key"];
|
bytes key = 1 [json_name = "key"];
|
||||||
// Signature of a message body.
|
// Signature of a message body.
|
||||||
bytes sign = 2 [json_name = "signature"];
|
bytes sign = 2 [json_name = "signature"];
|
||||||
|
|
|
@ -15,7 +15,7 @@ type RequestMessage interface {
|
||||||
GetMetaHeader() *session.RequestMetaHeader
|
GetMetaHeader() *session.RequestMetaHeader
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResponseMessage is an interface of NeoFS response message.
|
// ResponseMessage is an interface of FrostFS response message.
|
||||||
type ResponseMessage interface {
|
type ResponseMessage interface {
|
||||||
GetMetaHeader() *session.ResponseMetaHeader
|
GetMetaHeader() *session.ResponseMetaHeader
|
||||||
SetMetaHeader(*session.ResponseMetaHeader)
|
SetMetaHeader(*session.ResponseMetaHeader)
|
||||||
|
|
|
@ -13,13 +13,13 @@ import (
|
||||||
// Passing incorrect parameter values will result in constructor
|
// Passing incorrect parameter values will result in constructor
|
||||||
// failure (error or panic depending on the implementation).
|
// failure (error or panic depending on the implementation).
|
||||||
type Prm struct {
|
type Prm struct {
|
||||||
// Path to BoltDB file with NeoFS location database.
|
// Path to BoltDB file with FrostFS location database.
|
||||||
//
|
//
|
||||||
// Must not be empty.
|
// Must not be empty.
|
||||||
Path string
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB is a descriptor of the NeoFS BoltDB location database.
|
// DB is a descriptor of the FrostFS BoltDB location database.
|
||||||
//
|
//
|
||||||
// For correct operation, DB must be created
|
// For correct operation, DB must be created
|
||||||
// using the constructor (New) based on the required parameters
|
// using the constructor (New) based on the required parameters
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// CountryCode represents a country code for
|
// CountryCode represents a country code for
|
||||||
// the storage in the NeoFS location database.
|
// the storage in the FrostFS location database.
|
||||||
type CountryCode locodecolumn.CountryCode
|
type CountryCode locodecolumn.CountryCode
|
||||||
|
|
||||||
// CountryCodeFromString parses a string UN/LOCODE country code
|
// CountryCodeFromString parses a string UN/LOCODE country code
|
||||||
|
|
|
@ -16,7 +16,7 @@ type SourceTable interface {
|
||||||
IterateAll(func(locode.Record) error) error
|
IterateAll(func(locode.Record) error) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB is an interface of NeoFS location database.
|
// DB is an interface of FrostFS location database.
|
||||||
type DB interface {
|
type DB interface {
|
||||||
// Must save the record by key in the database.
|
// Must save the record by key in the database.
|
||||||
Put(Key, Record) error
|
Put(Key, Record) error
|
||||||
|
@ -25,7 +25,7 @@ type DB interface {
|
||||||
Get(Key) (*Record, error)
|
Get(Key) (*Record, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AirportRecord represents the entry in NeoFS airport database.
|
// AirportRecord represents the entry in FrostFS airport database.
|
||||||
type AirportRecord struct {
|
type AirportRecord struct {
|
||||||
// Name of the country where airport is located.
|
// Name of the country where airport is located.
|
||||||
CountryName string
|
CountryName string
|
||||||
|
@ -38,7 +38,7 @@ type AirportRecord struct {
|
||||||
// when the required airport is not found.
|
// when the required airport is not found.
|
||||||
var ErrAirportNotFound = errors.New("airport not found")
|
var ErrAirportNotFound = errors.New("airport not found")
|
||||||
|
|
||||||
// AirportDB is an interface of NeoFS airport database.
|
// AirportDB is an interface of FrostFS airport database.
|
||||||
type AirportDB interface {
|
type AirportDB interface {
|
||||||
// Must return the record by UN/LOCODE table record.
|
// Must return the record by UN/LOCODE table record.
|
||||||
//
|
//
|
||||||
|
@ -47,7 +47,7 @@ type AirportDB interface {
|
||||||
Get(locode.Record) (*AirportRecord, error)
|
Get(locode.Record) (*AirportRecord, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContinentsDB is an interface of NeoFS continent database.
|
// ContinentsDB is an interface of FrostFS continent database.
|
||||||
type ContinentsDB interface {
|
type ContinentsDB interface {
|
||||||
// Must return continent of the geo point.
|
// Must return continent of the geo point.
|
||||||
PointContinent(*Point) (*Continent, error)
|
PointContinent(*Point) (*Continent, error)
|
||||||
|
@ -57,7 +57,7 @@ var ErrSubDivNotFound = errors.New("subdivision not found")
|
||||||
|
|
||||||
var ErrCountryNotFound = errors.New("country not found")
|
var ErrCountryNotFound = errors.New("country not found")
|
||||||
|
|
||||||
// NamesDB is an interface of the NeoFS location namespace.
|
// NamesDB is an interface of the FrostFS location namespace.
|
||||||
type NamesDB interface {
|
type NamesDB interface {
|
||||||
// Must resolve a country code to a country name.
|
// Must resolve a country code to a country name.
|
||||||
//
|
//
|
||||||
|
@ -73,7 +73,7 @@ type NamesDB interface {
|
||||||
SubDivName(*CountryCode, string) (string, error)
|
SubDivName(*CountryCode, string) (string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillDatabase generates the NeoFS location database based on the UN/LOCODE table.
|
// FillDatabase generates the FrostFS location database based on the UN/LOCODE table.
|
||||||
func FillDatabase(table SourceTable, airports AirportDB, continents ContinentsDB, names NamesDB, db DB) error {
|
func FillDatabase(table SourceTable, airports AirportDB, continents ContinentsDB, names NamesDB, db DB) error {
|
||||||
return table.IterateAll(func(tableRecord locode.Record) error {
|
return table.IterateAll(func(tableRecord locode.Record) error {
|
||||||
if tableRecord.LOCODE.LocationCode() == "" {
|
if tableRecord.LOCODE.LocationCode() == "" {
|
||||||
|
@ -152,7 +152,7 @@ func FillDatabase(table SourceTable, airports AirportDB, continents ContinentsDB
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocodeRecord returns the record from the NeoFS location database
|
// LocodeRecord returns the record from the FrostFS location database
|
||||||
// corresponding to the string representation of UN/LOCODE.
|
// corresponding to the string representation of UN/LOCODE.
|
||||||
func LocodeRecord(db DB, sLocode string) (*Record, error) {
|
func LocodeRecord(db DB, sLocode string) (*Record, error) {
|
||||||
lc, err := locode.FromString(sLocode)
|
lc, err := locode.FromString(sLocode)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// LocationCode represents a location code for
|
// LocationCode represents a location code for
|
||||||
// the storage in the NeoFS location database.
|
// the storage in the FrostFS location database.
|
||||||
type LocationCode locodecolumn.LocationCode
|
type LocationCode locodecolumn.LocationCode
|
||||||
|
|
||||||
// LocationCodeFromString parses a string UN/LOCODE location code
|
// LocationCodeFromString parses a string UN/LOCODE location code
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
locodecolumn "github.com/TrueCloudLab/frostfs-node/pkg/util/locode/column"
|
locodecolumn "github.com/TrueCloudLab/frostfs-node/pkg/util/locode/column"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Key represents the key in NeoFS location database.
|
// Key represents the key in FrostFS location database.
|
||||||
type Key struct {
|
type Key struct {
|
||||||
cc *CountryCode
|
cc *CountryCode
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ func (k *Key) LocationCode() *LocationCode {
|
||||||
return k.lc
|
return k.lc
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record represents the entry in NeoFS location database.
|
// Record represents the entry in FrostFS location database.
|
||||||
type Record struct {
|
type Record struct {
|
||||||
countryName string
|
countryName string
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue