2022-05-20 15:02:00 +00:00
|
|
|
package data
|
|
|
|
|
|
|
|
import (
|
2022-06-02 15:26:26 +00:00
|
|
|
"strconv"
|
2022-05-20 15:02:00 +00:00
|
|
|
"time"
|
|
|
|
|
2022-05-24 06:58:33 +00:00
|
|
|
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
2022-05-20 15:02:00 +00:00
|
|
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
|
|
|
"github.com/nspcc-dev/neofs-sdk-go/user"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NodeVersion represent node from tree service.
|
|
|
|
type NodeVersion struct {
|
|
|
|
BaseNodeVersion
|
|
|
|
DeleteMarker *DeleteMarkerInfo
|
|
|
|
IsUnversioned bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteMarkerInfo is used to save object info if node in the tree service is delete marker.
|
|
|
|
// We need this information because the "delete marker" object is no longer stored in NeoFS.
|
|
|
|
type DeleteMarkerInfo struct {
|
2022-06-10 11:57:41 +00:00
|
|
|
Created time.Time
|
|
|
|
Owner user.ID
|
2022-05-20 15:02:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExtendedObjectInfo contains additional node info to be able to sort versions by timestamp.
|
|
|
|
type ExtendedObjectInfo struct {
|
|
|
|
ObjectInfo *ObjectInfo
|
|
|
|
NodeVersion *NodeVersion
|
2022-05-31 15:03:58 +00:00
|
|
|
IsLatest bool
|
2022-05-20 15:02:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// BaseNodeVersion is minimal node info from tree service.
|
|
|
|
// Basically used for "system" object.
|
|
|
|
type BaseNodeVersion struct {
|
|
|
|
ID uint64
|
|
|
|
OID oid.ID
|
|
|
|
Timestamp uint64
|
2022-06-10 11:57:41 +00:00
|
|
|
FilePath string
|
2022-05-20 15:02:00 +00:00
|
|
|
}
|
2022-05-24 06:58:33 +00:00
|
|
|
|
|
|
|
type ObjectTaggingInfo struct {
|
|
|
|
CnrID *cid.ID
|
|
|
|
ObjName string
|
|
|
|
VersionID string
|
|
|
|
}
|
2022-05-23 14:34:13 +00:00
|
|
|
|
|
|
|
// MultipartInfo is multipart upload information.
|
|
|
|
type MultipartInfo struct {
|
2022-05-24 11:30:37 +00:00
|
|
|
// ID is node id in tree service.
|
|
|
|
// It's ignored when creating a new multipart upload.
|
|
|
|
ID uint64
|
2022-05-24 08:41:10 +00:00
|
|
|
Key string
|
2022-05-23 14:34:13 +00:00
|
|
|
UploadID string
|
|
|
|
Owner user.ID
|
|
|
|
Created time.Time
|
|
|
|
Meta map[string]string
|
|
|
|
}
|
2022-05-24 11:30:37 +00:00
|
|
|
|
|
|
|
// PartInfo is upload information about part.
|
|
|
|
type PartInfo struct {
|
|
|
|
Key string
|
|
|
|
UploadID string
|
|
|
|
Number int
|
|
|
|
OID oid.ID
|
2022-05-31 12:38:06 +00:00
|
|
|
Size int64
|
|
|
|
ETag string
|
|
|
|
Created time.Time
|
2022-05-24 11:30:37 +00:00
|
|
|
}
|
2022-05-26 13:11:14 +00:00
|
|
|
|
2022-06-02 15:26:26 +00:00
|
|
|
// ToHeaderString form short part representation to use in S3-Completed-Parts header.
|
|
|
|
func (p *PartInfo) ToHeaderString() string {
|
|
|
|
return strconv.Itoa(p.Number) + "-" + strconv.FormatInt(p.Size, 10) + "-" + p.ETag
|
|
|
|
}
|
|
|
|
|
2022-05-26 13:11:14 +00:00
|
|
|
// LockInfo is lock information to create appropriate tree node.
|
|
|
|
type LockInfo struct {
|
|
|
|
ID uint64
|
|
|
|
LegalHoldOID *oid.ID
|
|
|
|
RetentionOID *oid.ID
|
|
|
|
UntilDate string
|
|
|
|
IsCompliance bool
|
|
|
|
}
|