forked from TrueCloudLab/frostfs-node
Initial commit
Initial public review release v0.10.0
This commit is contained in:
commit
dadfd90dcd
276 changed files with 46331 additions and 0 deletions
46
lib/boot/storage.go
Normal file
46
lib/boot/storage.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
package boot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// StorageBootParams is a group of parameters
|
||||
// for storage node bootstrap operation.
|
||||
type StorageBootParams struct {
|
||||
BootstrapPeerParams
|
||||
}
|
||||
|
||||
// StorageBootController is an entity that performs
|
||||
// registration of a storage node in NeoFS network.
|
||||
type StorageBootController struct {
|
||||
peerBoot PeerBootstrapper
|
||||
|
||||
bootPrm StorageBootParams
|
||||
|
||||
log *zap.Logger
|
||||
}
|
||||
|
||||
// SetPeerBootstrapper is a PeerBootstrapper setter.
|
||||
func (s *StorageBootController) SetPeerBootstrapper(v PeerBootstrapper) {
|
||||
s.peerBoot = v
|
||||
}
|
||||
|
||||
// SetBootParams is a storage node bootstrap parameters setter.
|
||||
func (s *StorageBootController) SetBootParams(v StorageBootParams) {
|
||||
s.bootPrm = v
|
||||
}
|
||||
|
||||
// SetLogger is a logging component setter.
|
||||
func (s *StorageBootController) SetLogger(v *zap.Logger) {
|
||||
s.log = v
|
||||
}
|
||||
|
||||
// Bootstrap registers storage node in NeoFS system.
|
||||
func (s StorageBootController) Bootstrap(context.Context) {
|
||||
// register peer in NeoFS network
|
||||
if err := s.peerBoot.AddPeer(s.bootPrm.BootstrapPeerParams); err != nil && s.log != nil {
|
||||
s.log.Error("could not register storage node in network")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue