[#188] shard: Implement SetMode method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
2fb379b7dd
commit
3fa3661cad
2 changed files with 16 additions and 0 deletions
|
@ -40,3 +40,15 @@ func (m Mode) String() string {
|
|||
return "EVACUATE"
|
||||
}
|
||||
}
|
||||
|
||||
// SetMode sets mode of the shard.
|
||||
//
|
||||
// Returns any error encountered that did not allow
|
||||
// to set shard mode.
|
||||
func (s *Shard) SetMode(m Mode) error {
|
||||
s.mode.Store(uint32(m))
|
||||
}
|
||||
|
||||
func (s *Shard) getMode() Mode {
|
||||
return Mode(s.mode.Load())
|
||||
}
|
||||
|
|
|
@ -4,12 +4,15 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
|
||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
"go.uber.org/atomic"
|
||||
)
|
||||
|
||||
// Shard represents single shard of NeoFS Local Storage Engine.
|
||||
type Shard struct {
|
||||
*cfg
|
||||
|
||||
mode *atomic.Uint32
|
||||
|
||||
weight WeightValues
|
||||
|
||||
blobStor *blobstor.BlobStor
|
||||
|
@ -44,6 +47,7 @@ func New(opts ...Option) *Shard {
|
|||
|
||||
return &Shard{
|
||||
cfg: c,
|
||||
mode: atomic.NewUint32(0), // TODO: init with particular mode
|
||||
blobStor: blobstor.New(c.blobOpts...),
|
||||
metaBase: meta.NewDB(c.metaOpts...),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue