[#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
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
// SysAttributePrefix is a prefix of key to system attribute.
|
||||
const SysAttributePrefix = "__NEOFS__"
|
||||
const SysAttributePrefix = "__FROSTFS__"
|
||||
|
||||
const (
|
||||
// SysAttributeUploadID marks smaller parts of a split bigger object.
|
||||
|
@ -25,6 +25,25 @@ const (
|
|||
SysAttributeTickTopic = SysAttributePrefix + "TICK_TOPIC"
|
||||
)
|
||||
|
||||
// SysAttributePrefixNeoFS is a prefix of key to system attribute.
|
||||
const SysAttributePrefixNeoFS = "__NEOFS__"
|
||||
|
||||
const (
|
||||
// SysAttributeUploadIDNeoFS marks smaller parts of a split bigger object.
|
||||
SysAttributeUploadIDNeoFS = SysAttributePrefixNeoFS + "UPLOAD_ID"
|
||||
|
||||
// SysAttributeExpEpochNeoFS tells GC to delete object after that epoch.
|
||||
SysAttributeExpEpochNeoFS = SysAttributePrefixNeoFS + "EXPIRATION_EPOCH"
|
||||
|
||||
// SysAttributeTickEpochNeoFS defines what epoch must produce object
|
||||
// notification.
|
||||
SysAttributeTickEpochNeoFS = SysAttributePrefixNeoFS + "TICK_EPOCH"
|
||||
|
||||
// SysAttributeTickTopicNeoFS defines what topic object notification
|
||||
// must be sent to.
|
||||
SysAttributeTickTopicNeoFS = SysAttributePrefixNeoFS + "TICK_TOPIC"
|
||||
)
|
||||
|
||||
// NotificationInfo groups information about object notification
|
||||
// that can be written to object.
|
||||
//
|
||||
|
@ -81,10 +100,10 @@ func WriteNotificationInfo(o *Object, ni NotificationInfo) {
|
|||
|
||||
for i := range attrs {
|
||||
switch attrs[i].GetKey() {
|
||||
case SysAttributeTickEpoch:
|
||||
case SysAttributeTickEpoch, SysAttributeTickEpochNeoFS:
|
||||
attrs[i].SetValue(epoch)
|
||||
changedEpoch = true
|
||||
case SysAttributeTickTopic:
|
||||
case SysAttributeTickTopic, SysAttributeTickTopicNeoFS:
|
||||
changedTopic = true
|
||||
|
||||
if topic == "" {
|
||||
|
@ -141,7 +160,7 @@ func GetNotificationInfo(o *Object) (*NotificationInfo, error) {
|
|||
|
||||
for _, attr := range o.GetHeader().GetAttributes() {
|
||||
switch key := attr.GetKey(); key {
|
||||
case SysAttributeTickEpoch:
|
||||
case SysAttributeTickEpoch, SysAttributeTickEpochNeoFS:
|
||||
epoch, err := strconv.ParseUint(attr.GetValue(), 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not parse epoch: %w", err)
|
||||
|
@ -150,7 +169,7 @@ func GetNotificationInfo(o *Object) (*NotificationInfo, error) {
|
|||
ni.SetEpoch(epoch)
|
||||
|
||||
foundEpoch = true
|
||||
case SysAttributeTickTopic:
|
||||
case SysAttributeTickTopic, SysAttributeTickTopicNeoFS:
|
||||
ni.SetTopic(attr.GetValue())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue