github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/container/status.go (about)

     1  package container
     2  
     3  import (
     4  	"github.com/TrueCloudLab/frostfs-api-go/v2/status"
     5  	statusgrpc "github.com/TrueCloudLab/frostfs-api-go/v2/status/grpc"
     6  )
     7  
     8  // LocalizeFailStatus checks if passed global status.Code is related to container failure and:
     9  //
    10  //	then localizes the code and returns true,
    11  //	else leaves the code unchanged and returns false.
    12  //
    13  // Arg must not be nil.
    14  func LocalizeFailStatus(c *status.Code) bool {
    15  	return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_CONTAINER))
    16  }
    17  
    18  // GlobalizeFail globalizes local code of container failure.
    19  //
    20  // Arg must not be nil.
    21  func GlobalizeFail(c *status.Code) {
    22  	c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_CONTAINER))
    23  }
    24  
    25  const (
    26  	// StatusNotFound is a local status.Code value for
    27  	// CONTAINER_NOT_FOUND container failure.
    28  	StatusNotFound status.Code = iota
    29  
    30  	// StatusEACLNotFound is a local status.Code value for
    31  	// EACL_NOT_FOUND failure.
    32  	StatusEACLNotFound
    33  )