From 6f2187a420e9c9c7bd2e1fa978a24720224efbd2 Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Tue, 14 May 2024 14:44:55 +0300 Subject: [PATCH] [#1121] node: Refactor mods of shard Signed-off-by: Alexander Chuprov --- pkg/local_object_storage/shard/mode/mode.go | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pkg/local_object_storage/shard/mode/mode.go b/pkg/local_object_storage/shard/mode/mode.go index 49c888d63..461611465 100644 --- a/pkg/local_object_storage/shard/mode/mode.go +++ b/pkg/local_object_storage/shard/mode/mode.go @@ -8,27 +8,25 @@ type Mode uint32 const ( // ReadWrite is a Mode value for shard that is available // for read and write operations. Default shard mode. - ReadWrite Mode = 0 + ReadWrite Mode = 0b000 - // DegradedReadOnly is a Mode value for shard that is set automatically - // after a certain number of errors is encountered. It is the same as - // `mode.Degraded` but also is read-only. - DegradedReadOnly = Degraded | ReadOnly + // ReadOnly is a Mode value for shard that does not + // accept write operation but is readable. + ReadOnly Mode = 0b001 + + // Degraded is a Mode value for shard when the metabase is unavailable. + // It is hard to perform some modifying operations in this mode, thus it can only be set by an administrator. + Degraded Mode = 0b010 // Disabled mode is a mode where a shard is disabled. // An existing shard can't have this mode, but it can be used in // the configuration or control service commands. - Disabled = math.MaxUint32 -) + Disabled Mode = math.MaxUint32 -const ( - // ReadOnly is a Mode value for shard that does not - // accept write operation but is readable. - ReadOnly Mode = 1 << iota - - // Degraded is a Mode value for shard when the metabase is unavailable. - // It is hard to perform some modifying operations in this mode, thus it can only be set by an administrator. - Degraded + // DegradedReadOnly is a Mode value for shard that is set automatically + // after a certain number of errors is encountered. It is the same as + // `mode.Degraded` but also is read-only. + DegradedReadOnly Mode = Degraded | ReadOnly ) func (m Mode) String() string {