forked from TrueCloudLab/frostfs-api-go
[#155] sdk/object: Define object types
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
b991e014a9
commit
2fb1547cd8
2 changed files with 71 additions and 0 deletions
35
pkg/object/type.go
Normal file
35
pkg/object/type.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package object
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
)
|
||||
|
||||
type Type uint8
|
||||
|
||||
const (
|
||||
TypeRegular Type = iota
|
||||
TypeTombstone
|
||||
TypeStorageGroup
|
||||
)
|
||||
|
||||
func (t Type) ToV2() object.Type {
|
||||
switch t {
|
||||
case TypeTombstone:
|
||||
return object.TypeTombstone
|
||||
case TypeStorageGroup:
|
||||
return object.TypeStorageGroup
|
||||
default:
|
||||
return object.TypeRegular
|
||||
}
|
||||
}
|
||||
|
||||
func TypeFromV2(t object.Type) Type {
|
||||
switch t {
|
||||
case object.TypeTombstone:
|
||||
return TypeTombstone
|
||||
case object.TypeStorageGroup:
|
||||
return TypeStorageGroup
|
||||
default:
|
||||
return TypeRegular
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue