From 2fb379b7dd0e0440680b3559e6aca8b42fd9ede1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 19 Nov 2020 15:41:10 +0300 Subject: [PATCH] [#188] shard: Define the enumeration of shard modes Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/shard/mode.go | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 pkg/local_object_storage/shard/mode.go diff --git a/pkg/local_object_storage/shard/mode.go b/pkg/local_object_storage/shard/mode.go new file mode 100644 index 000000000..75377248e --- /dev/null +++ b/pkg/local_object_storage/shard/mode.go @@ -0,0 +1,42 @@ +package shard + +// Mode represents enumeration of Shard work modes. +type Mode uint32 + +// TODO: more detailed description of shard modes. + +const ( + _ Mode = iota + + // ModeActive is a Mode value for active shard. + ModeActive + + // ModeInactive is a Mode value for inactive shard. + ModeInactive + + // ModeReadOnly is a Mode value for read-only shard. + ModeReadOnly + + // ModeFault is a Mode value for faulty shard. + ModeFault + + // ModeEvacuate is a Mode value for evacuating shard. + ModeEvacuate +) + +func (m Mode) String() string { + switch m { + default: + return "UNDEFINED" + case ModeActive: + return "ACTIVE" + case ModeInactive: + return "INACTIVE" + case ModeReadOnly: + return "READ_ONLY" + case ModeFault: + return "FAULT" + case ModeEvacuate: + return "EVACUATE" + } +}