forked from TrueCloudLab/frostfs-node
[#1312] Drop handling of system attributes with NeoFS prefix
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
c290d079fd
commit
c34b8acedd
5 changed files with 5 additions and 18 deletions
|
@ -1,9 +1,6 @@
|
||||||
package container
|
package container
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
||||||
|
@ -67,14 +64,8 @@ var listContainerObjectsCmd = &cobra.Command{
|
||||||
|
|
||||||
resHead, err := internalclient.HeadObject(cmd.Context(), prmHead)
|
resHead, err := internalclient.HeadObject(cmd.Context(), prmHead)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
attrs := resHead.Header().Attributes()
|
for _, attr := range resHead.Header().UserAttributes() {
|
||||||
for i := range attrs {
|
cmd.Printf(" %s: %s\n", attr.Key(), attr.Value())
|
||||||
attrKey := attrs[i].Key()
|
|
||||||
if !strings.HasPrefix(attrKey, v2object.SysAttributePrefix) && !strings.HasPrefix(attrKey, v2object.SysAttributePrefixNeoFS) {
|
|
||||||
// FIXME(@cthulhu-rider): https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/issues/97
|
|
||||||
// Use dedicated method to skip system attributes.
|
|
||||||
cmd.Printf(" %s: %s\n", attrKey, attrs[i].Value())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cmd.Printf(" failed to read attributes: %v\n", err)
|
cmd.Printf(" failed to read attributes: %v\n", err)
|
||||||
|
|
|
@ -361,7 +361,7 @@ func (v *FormatValidator) checkIfExpired(ctx context.Context, obj *objectSDK.Obj
|
||||||
|
|
||||||
func expirationEpochAttribute(obj *objectSDK.Object) (uint64, error) {
|
func expirationEpochAttribute(obj *objectSDK.Object) (uint64, error) {
|
||||||
for _, a := range obj.Attributes() {
|
for _, a := range obj.Attributes() {
|
||||||
if a.Key() != objectV2.SysAttributeExpEpoch && a.Key() != objectV2.SysAttributeExpEpochNeoFS {
|
if a.Key() != objectV2.SysAttributeExpEpoch {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,10 +387,6 @@ func hasExpirationEpoch(obj *objectSDK.Object) (uint64, bool) {
|
||||||
attributes = ech.ParentAttributes()
|
attributes = ech.ParentAttributes()
|
||||||
}
|
}
|
||||||
for _, attr := range attributes {
|
for _, attr := range attributes {
|
||||||
if attr.Key() == objectV2.SysAttributeExpEpochNeoFS {
|
|
||||||
expEpoch, err := strconv.ParseUint(attr.Value(), 10, 64)
|
|
||||||
return expEpoch, err == nil
|
|
||||||
}
|
|
||||||
if attr.Key() == objectV2.SysAttributeExpEpoch {
|
if attr.Key() == objectV2.SysAttributeExpEpoch {
|
||||||
expEpoch, err := strconv.ParseUint(attr.Value(), 10, 64)
|
expEpoch, err := strconv.ParseUint(attr.Value(), 10, 64)
|
||||||
return expEpoch, err == nil
|
return expEpoch, err == nil
|
||||||
|
|
|
@ -252,7 +252,7 @@ func getNextObjectsWithExpirationEpochBatch(ctx context.Context, db *bbolt.DB, i
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
attributeKey := string(attrKey[1+cidSize:])
|
attributeKey := string(attrKey[1+cidSize:])
|
||||||
if attributeKey != objectV2.SysAttributeExpEpochNeoFS && attributeKey != objectV2.SysAttributeExpEpoch {
|
if attributeKey != objectV2.SysAttributeExpEpoch {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var containerID cid.ID
|
var containerID cid.ID
|
||||||
|
|
|
@ -74,7 +74,7 @@ func (g *ExpirationChecker) IsTombstoneAvailable(ctx context.Context, a oid.Addr
|
||||||
|
|
||||||
func (g *ExpirationChecker) handleTS(addr string, ts *objectSDK.Object, reqEpoch uint64) bool {
|
func (g *ExpirationChecker) handleTS(addr string, ts *objectSDK.Object, reqEpoch uint64) bool {
|
||||||
for _, atr := range ts.Attributes() {
|
for _, atr := range ts.Attributes() {
|
||||||
if atr.Key() == objectV2.SysAttributeExpEpoch || atr.Key() == objectV2.SysAttributeExpEpochNeoFS {
|
if atr.Key() == objectV2.SysAttributeExpEpoch {
|
||||||
epoch, err := strconv.ParseUint(atr.Value(), 10, 64)
|
epoch, err := strconv.ParseUint(atr.Value(), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
g.log.Warn(
|
g.log.Warn(
|
||||||
|
|
Loading…
Reference in a new issue