forked from TrueCloudLab/frostfs-api-go
[#371] Support recent changes in NeoFS API protocol
Support: * new status codes (object, container, session); * object `Lock` message; * different signature schemes. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
a4349f6692
commit
99370889d1
41 changed files with 1139 additions and 129 deletions
28
container/status.go
Normal file
28
container/status.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package container
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/status"
|
||||
statusgrpc "github.com/nspcc-dev/neofs-api-go/v2/status/grpc"
|
||||
)
|
||||
|
||||
// LocalizeFailStatus checks if passed global status.Code is related to container failure and:
|
||||
// then localizes the code and returns true,
|
||||
// else leaves the code unchanged and returns false.
|
||||
//
|
||||
// Arg must not be nil.
|
||||
func LocalizeFailStatus(c *status.Code) bool {
|
||||
return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_CONTAINER))
|
||||
}
|
||||
|
||||
// GlobalizeFail globalizes local code of container failure.
|
||||
//
|
||||
// Arg must not be nil.
|
||||
func GlobalizeFail(c *status.Code) {
|
||||
c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_CONTAINER))
|
||||
}
|
||||
|
||||
const (
|
||||
// StatusNotFound is a local status.Code value for
|
||||
// CONTAINER_NOT_FOUND container failure.
|
||||
StatusNotFound status.Code = iota
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue