forked from TrueCloudLab/frostfs-api-go
[#231] object: Implement string encode/decode methods on Type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
0f04087543
commit
53e2756762
3 changed files with 50 additions and 0 deletions
29
v2/object/string.go
Normal file
29
v2/object/string.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package object
|
||||
|
||||
const (
|
||||
typeRegularString = "Regular"
|
||||
typeTombstoneString = "Tombstone"
|
||||
typeStorageGroupString = "StorageGroup"
|
||||
)
|
||||
|
||||
func (t Type) String() string {
|
||||
switch t {
|
||||
default:
|
||||
return typeRegularString
|
||||
case TypeTombstone:
|
||||
return typeTombstoneString
|
||||
case TypeStorageGroup:
|
||||
return typeStorageGroupString
|
||||
}
|
||||
}
|
||||
|
||||
func TypeFromString(s string) Type {
|
||||
switch s {
|
||||
default:
|
||||
return TypeRegular
|
||||
case typeTombstoneString:
|
||||
return TypeTombstone
|
||||
case typeStorageGroupString:
|
||||
return TypeStorageGroup
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue