forked from TrueCloudLab/frostfs-api-go
[#10] Add __FROSTFS__ system attributes
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
c46cd37f71
commit
cd2e46a17c
5 changed files with 71 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
|||
package container
|
||||
|
||||
// SysAttributePrefix is a prefix of key to system attribute.
|
||||
const SysAttributePrefix = "__NEOFS__"
|
||||
const SysAttributePrefix = "__FROSTFS__"
|
||||
|
||||
const (
|
||||
// SysAttributeSubnet is a string ID of container's storage subnet.
|
||||
|
@ -17,6 +17,23 @@ const (
|
|||
SysAttributeHomomorphicHashing = SysAttributePrefix + "DISABLE_HOMOMORPHIC_HASHING"
|
||||
)
|
||||
|
||||
// SysAttributePrefixNeoFS is a prefix of key to system attribute.
|
||||
const SysAttributePrefixNeoFS = "__NEOFS__"
|
||||
|
||||
const (
|
||||
// SysAttributeSubnetNeoFS is a string ID of container's storage subnet.
|
||||
SysAttributeSubnetNeoFS = SysAttributePrefixNeoFS + "SUBNET"
|
||||
|
||||
// SysAttributeNameNeoFS is a string of human-friendly container name registered as the domain in NNS contract.
|
||||
SysAttributeNameNeoFS = SysAttributePrefixNeoFS + "NAME"
|
||||
|
||||
// SysAttributeZoneNeoFS is a string of zone for container name.
|
||||
SysAttributeZoneNeoFS = SysAttributePrefixNeoFS + "ZONE"
|
||||
|
||||
// SysAttributeHomomorphicHashingNeoFS is a container's homomorphic hashing state.
|
||||
SysAttributeHomomorphicHashingNeoFS = SysAttributePrefixNeoFS + "DISABLE_HOMOMORPHIC_HASHING"
|
||||
)
|
||||
|
||||
// SysAttributeZoneDefault is a default value for SysAttributeZone attribute.
|
||||
const SysAttributeZoneDefault = "container"
|
||||
|
||||
|
@ -33,7 +50,7 @@ const disabledHomomorphicHashingValue = "true"
|
|||
// See also SetHomomorphicHashingState.
|
||||
func (c Container) HomomorphicHashingState() bool {
|
||||
for i := range c.attr {
|
||||
if c.attr[i].GetKey() == SysAttributeHomomorphicHashing {
|
||||
if c.attr[i].GetKey() == SysAttributeHomomorphicHashing || c.attr[i].GetKey() == SysAttributeHomomorphicHashingNeoFS {
|
||||
return c.attr[i].GetValue() != disabledHomomorphicHashingValue
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +67,7 @@ func (c Container) HomomorphicHashingState() bool {
|
|||
// See also HomomorphicHashingState.
|
||||
func (c *Container) SetHomomorphicHashingState(enable bool) {
|
||||
for i := range c.attr {
|
||||
if c.attr[i].GetKey() == SysAttributeHomomorphicHashing {
|
||||
if c.attr[i].GetKey() == SysAttributeHomomorphicHashing || c.attr[i].GetKey() == SysAttributeHomomorphicHashingNeoFS {
|
||||
if enable {
|
||||
// approach without allocation/waste
|
||||
// coping works since the attributes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue