[#478] Don't fetch epoch at object upload

Creation epoch was used for versioning. With
tree service, versioning is done on the NeoFS
side in the tree.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-06-03 17:33:47 +03:00 committed by Alex Vanin
parent 9dfc7e043f
commit 4f3d206422
3 changed files with 24 additions and 36 deletions

View file

@ -38,7 +38,6 @@ type (
Size int64 Size int64
ContentType string ContentType string
Created time.Time Created time.Time
CreationEpoch uint64
HashSum string HashSum string
Owner user.ID Owner user.ID
Headers map[string]string Headers map[string]string

View file

@ -17,7 +17,6 @@ import (
"github.com/nspcc-dev/neofs-s3-gw/api/cache" "github.com/nspcc-dev/neofs-s3-gw/api/cache"
"github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/data"
apiErrors "github.com/nspcc-dev/neofs-s3-gw/api/errors" apiErrors "github.com/nspcc-dev/neofs-s3-gw/api/errors"
"github.com/nspcc-dev/neofs-s3-gw/internal/misc"
"github.com/nspcc-dev/neofs-sdk-go/client" "github.com/nspcc-dev/neofs-sdk-go/client"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
@ -183,14 +182,6 @@ func (n *layer) PutObject(ctx context.Context, p *PutObjectParams) (*data.Object
return nil, fmt.Errorf("couldn't add new verion to tree service: %w", err) return nil, fmt.Errorf("couldn't add new verion to tree service: %w", err)
} }
currentEpoch, _, err := n.neoFS.TimeToEpoch(ctx, time.Now().Add(time.Minute))
if err != nil {
n.log.Warn("couldn't get creation epoch",
zap.String("bucket", p.BktInfo.Name),
zap.String("object", misc.SanitizeString(p.Object)),
zap.Error(err))
}
if p.Lock != nil && (p.Lock.Retention != nil || p.Lock.LegalHold != nil) { if p.Lock != nil && (p.Lock.Retention != nil || p.Lock.LegalHold != nil) {
objVersion := &ObjectVersion{ objVersion := &ObjectVersion{
BktInfo: p.BktInfo, BktInfo: p.BktInfo,
@ -214,7 +205,6 @@ func (n *layer) PutObject(ctx context.Context, p *PutObjectParams) (*data.Object
Name: p.Object, Name: p.Object,
Size: p.Size, Size: p.Size,
Created: time.Now(), Created: time.Now(),
CreationEpoch: currentEpoch,
Headers: p.Header, Headers: p.Header,
ContentType: p.Header[api.ContentType], ContentType: p.Header[api.ContentType],
HashSum: hex.EncodeToString(hash), HashSum: hex.EncodeToString(hash),

View file

@ -123,7 +123,6 @@ func objectInfoFromMeta(bkt *data.BucketInfo, meta *object.Object, prefix, delim
Bucket: bkt.Name, Bucket: bkt.Name,
Name: filename, Name: filename,
Created: creation, Created: creation,
CreationEpoch: meta.CreationEpoch(),
ContentType: mimeType, ContentType: mimeType,
Headers: userHeaders, Headers: userHeaders,
Owner: *meta.OwnerID(), Owner: *meta.OwnerID(),