forked from TrueCloudLab/frostfs-node
[#1121] node: Change mode of shard components
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
6f2187a420
commit
806236da78
47 changed files with 194 additions and 100 deletions
|
@ -1,13 +1,14 @@
|
|||
package fstree
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
|
||||
)
|
||||
|
||||
// Open implements common.Storage.
|
||||
func (t *FSTree) Open(ro bool) error {
|
||||
t.readOnly = ro
|
||||
t.metrics.SetMode(ro)
|
||||
func (t *FSTree) Open(mode mode.ComponentMode) error {
|
||||
t.readOnly = mode.ReadOnly()
|
||||
t.metrics.SetMode(mode)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
|
||||
|
@ -43,7 +44,7 @@ func TestObjectCounter(t *testing.T) {
|
|||
WithDepth(2),
|
||||
WithDirNameLen(2),
|
||||
WithFileCounter(counter))
|
||||
require.NoError(t, fst.Open(false))
|
||||
require.NoError(t, fst.Open(mode.ComponentReadWrite))
|
||||
require.NoError(t, fst.Init())
|
||||
|
||||
counterValue := counter.Value()
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package fstree
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
||||
)
|
||||
|
||||
type Metrics interface {
|
||||
SetParentID(parentID string)
|
||||
|
||||
SetMode(readOnly bool)
|
||||
SetMode(mode mode.ComponentMode)
|
||||
Close()
|
||||
|
||||
Iterate(d time.Duration, success bool)
|
||||
|
@ -20,7 +24,7 @@ type Metrics interface {
|
|||
type noopMetrics struct{}
|
||||
|
||||
func (m *noopMetrics) SetParentID(string) {}
|
||||
func (m *noopMetrics) SetMode(bool) {}
|
||||
func (m *noopMetrics) SetMode(mode.ComponentMode) {}
|
||||
func (m *noopMetrics) Close() {}
|
||||
func (m *noopMetrics) Iterate(time.Duration, bool) {}
|
||||
func (m *noopMetrics) Delete(time.Duration, bool) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue