forked from TrueCloudLab/frostfs-node
[#11] Trim the old functionality
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
783ec72d56
commit
a87fdab324
235 changed files with 39 additions and 36211 deletions
0
pkg/network/bootstrap/.gitkeep
Normal file
0
pkg/network/bootstrap/.gitkeep
Normal file
|
@ -1,60 +0,0 @@
|
|||
package bootstrap
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper"
|
||||
)
|
||||
|
||||
// ContractClient represents the Netmap
|
||||
// contract client.
|
||||
//
|
||||
// It is a type alias of
|
||||
// github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper.Wrapper.
|
||||
type ContractClient = *wrapper.Wrapper
|
||||
|
||||
// NodeInfo represents the
|
||||
// information about storage node.
|
||||
//
|
||||
// It is a type alias of
|
||||
// github.com/nspcc-dev/neofs-node/pkg/core/netmap.Info.
|
||||
type NodeInfo = netmap.Info
|
||||
|
||||
// Registerer represents the tool that
|
||||
// registers storage node in NeoFS system.
|
||||
//
|
||||
// Working Registerer must be created via constructor New.
|
||||
// Using the Registerer that has been created with new(Registerer)
|
||||
// expression (or just declaring a Registerer variable) is unsafe
|
||||
// and can lead to panic.
|
||||
type Registerer struct {
|
||||
client ContractClient
|
||||
|
||||
info NodeInfo
|
||||
}
|
||||
|
||||
// New creates, initializes and returns the Registerer instance.
|
||||
//
|
||||
// If passed contract client is nil, wrapper.ErrNilWrapper is returned.
|
||||
func New(client ContractClient, info NodeInfo) (*Registerer, error) {
|
||||
if client == nil {
|
||||
return nil, wrapper.ErrNilWrapper
|
||||
}
|
||||
|
||||
return &Registerer{
|
||||
client: client,
|
||||
info: info,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Bootstrap registers storage node in NeoFS system
|
||||
// through Netmap contract client.
|
||||
//
|
||||
// If contract client returns error, panic arises without retry.
|
||||
func (r *Registerer) Bootstrap(context.Context) {
|
||||
// register peer in NeoFS network
|
||||
if err := r.client.AddPeer(r.info); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue