satellite/metabase: use constant for pending version
Currently it wasn't quite clear what was a stub version and an actual version. Use a PendingVersion constant to make this distinction clear. Also use PendingVersion = NextVersion = 0, that way it's clearer that the version hasn't been yet determined. DefaultVersion = 1 might imply that the object will get that version once commited, however that will entirely depend on whether use-pending-objects is used or versioning is enabled or not. Change-Id: I21398141f97035c48c778f23b542266b834c44f1
This commit is contained in:
parent
4f8697568d
commit
d91ee440ba
@ -99,7 +99,7 @@ func (db *DB) BeginObjectNextVersion(ctx context.Context, opts BeginObjectNextVe
|
|||||||
|
|
||||||
if opts.UsePendingObjectsTable {
|
if opts.UsePendingObjectsTable {
|
||||||
object.Status = Pending
|
object.Status = Pending
|
||||||
object.Version = DefaultVersion
|
object.Version = PendingVersion
|
||||||
|
|
||||||
if err := db.db.QueryRowContext(ctx, `
|
if err := db.db.QueryRowContext(ctx, `
|
||||||
INSERT INTO pending_objects (
|
INSERT INTO pending_objects (
|
||||||
@ -683,6 +683,7 @@ func (db *DB) CommitObject(ctx context.Context, opts CommitObject) (object Objec
|
|||||||
totalEncryptedSize += int64(seg.EncryptedSize)
|
totalEncryptedSize += int64(seg.EncryptedSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const versionArgIndex = 3
|
||||||
args := []interface{}{
|
args := []interface{}{
|
||||||
opts.ProjectID, []byte(opts.BucketName), opts.ObjectKey, opts.Version, opts.StreamID,
|
opts.ProjectID, []byte(opts.BucketName), opts.ObjectKey, opts.Version, opts.StreamID,
|
||||||
len(segments),
|
len(segments),
|
||||||
@ -746,7 +747,8 @@ func (db *DB) CommitObject(ctx context.Context, opts CommitObject) (object Objec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.Version = 1
|
opts.Version = DefaultVersion
|
||||||
|
args[versionArgIndex] = opts.Version
|
||||||
|
|
||||||
args = append(args,
|
args = append(args,
|
||||||
opts.EncryptedMetadataNonce,
|
opts.EncryptedMetadataNonce,
|
||||||
|
@ -365,7 +365,7 @@ func TestBeginObjectNextVersion_PendingObjects(t *testing.T) {
|
|||||||
|
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: metabase.DefaultVersion,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.BeginObjectNextVersion{
|
metabasetest.BeginObjectNextVersion{
|
||||||
@ -376,7 +376,7 @@ func TestBeginObjectNextVersion_PendingObjects(t *testing.T) {
|
|||||||
|
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: metabase.DefaultVersion,
|
Version: metabase.PendingVersion,
|
||||||
ErrClass: &metabase.ErrObjectAlreadyExists,
|
ErrClass: &metabase.ErrObjectAlreadyExists,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ func TestBeginObjectNextVersion_PendingObjects(t *testing.T) {
|
|||||||
|
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: metabase.DefaultVersion,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
now2 := time.Now()
|
now2 := time.Now()
|
||||||
@ -430,7 +430,7 @@ func TestBeginObjectNextVersion_PendingObjects(t *testing.T) {
|
|||||||
|
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: metabase.DefaultVersion,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.Verify{
|
metabasetest.Verify{
|
||||||
@ -487,7 +487,7 @@ func TestBeginObjectNextVersion_PendingObjects(t *testing.T) {
|
|||||||
|
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: metabase.DefaultVersion,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.Verify{
|
metabasetest.Verify{
|
||||||
@ -1214,7 +1214,7 @@ func TestBeginSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.BeginSegment{
|
metabasetest.BeginSegment{
|
||||||
@ -1256,7 +1256,7 @@ func TestBeginSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
@ -1968,7 +1968,7 @@ func TestCommitSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
rootPieceID := testrand.PieceID()
|
rootPieceID := testrand.PieceID()
|
||||||
@ -2065,7 +2065,7 @@ func TestCommitSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
rootPieceID1 := testrand.PieceID()
|
rootPieceID1 := testrand.PieceID()
|
||||||
@ -2171,7 +2171,7 @@ func TestCommitSegment(t *testing.T) {
|
|||||||
ExpiresAt: &expectedExpiresAt,
|
ExpiresAt: &expectedExpiresAt,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.CommitSegment{
|
metabasetest.CommitSegment{
|
||||||
@ -2242,7 +2242,7 @@ func TestCommitSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.CommitSegment{
|
metabasetest.CommitSegment{
|
||||||
@ -2799,7 +2799,7 @@ func TestCommitInlineSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
encryptedKey := testrand.Bytes(32)
|
encryptedKey := testrand.Bytes(32)
|
||||||
@ -2878,7 +2878,7 @@ func TestCommitInlineSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
encryptedKey := testrand.Bytes(32)
|
encryptedKey := testrand.Bytes(32)
|
||||||
@ -2961,7 +2961,7 @@ func TestCommitInlineSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.CommitInlineSegment{
|
metabasetest.CommitInlineSegment{
|
||||||
@ -3023,7 +3023,7 @@ func TestCommitInlineSegment(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.CommitInlineSegment{
|
metabasetest.CommitInlineSegment{
|
||||||
@ -3087,7 +3087,7 @@ func TestCommitInlineSegment(t *testing.T) {
|
|||||||
ExpiresAt: &expectedExpiresAt,
|
ExpiresAt: &expectedExpiresAt,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.CommitInlineSegment{
|
metabasetest.CommitInlineSegment{
|
||||||
@ -3776,7 +3776,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
@ -3849,7 +3849,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
@ -3968,7 +3968,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
@ -4082,7 +4082,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
@ -4133,7 +4133,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
EncryptedMetadataNonce: expectedMetadataNonce,
|
EncryptedMetadataNonce: expectedMetadataNonce,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: metabase.DefaultVersion,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
|
|
||||||
@ -4182,7 +4182,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
EncryptedMetadataNonce: testrand.Nonce().Bytes(),
|
EncryptedMetadataNonce: testrand.Nonce().Bytes(),
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
|
|
||||||
@ -4232,7 +4232,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
EncryptedMetadataNonce: testrand.Nonce().Bytes(),
|
EncryptedMetadataNonce: testrand.Nonce().Bytes(),
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
|
|
||||||
@ -4281,7 +4281,7 @@ func TestCommitObject(t *testing.T) {
|
|||||||
EncryptedMetadataNonce: testrand.Nonce().Bytes(),
|
EncryptedMetadataNonce: testrand.Nonce().Bytes(),
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
|
|
||||||
|
@ -342,6 +342,9 @@ const NextVersion = Version(0)
|
|||||||
// DefaultVersion represents default version 1.
|
// DefaultVersion represents default version 1.
|
||||||
const DefaultVersion = Version(1)
|
const DefaultVersion = Version(1)
|
||||||
|
|
||||||
|
// PendingVersion represents version that is used for pending objects (with UsePendingObjects).
|
||||||
|
const PendingVersion = Version(0)
|
||||||
|
|
||||||
// MaxVersion represents maximum version.
|
// MaxVersion represents maximum version.
|
||||||
// Version in DB is represented as INT4.
|
// Version in DB is represented as INT4.
|
||||||
const MaxVersion = Version(math.MaxInt32)
|
const MaxVersion = Version(math.MaxInt32)
|
||||||
|
@ -252,7 +252,7 @@ func TestDeleteBucketObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.DeleteBucketObjects{
|
metabasetest.DeleteBucketObjects{
|
||||||
@ -272,7 +272,7 @@ func TestDeleteBucketObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.DeleteBucketObjects{
|
metabasetest.DeleteBucketObjects{
|
||||||
|
@ -526,7 +526,7 @@ func TestDeleteInactivePendingObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
// zombie object with deadline time in the past
|
// zombie object with deadline time in the past
|
||||||
@ -537,7 +537,7 @@ func TestDeleteInactivePendingObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
// pending object with expiration time in the future
|
// pending object with expiration time in the future
|
||||||
@ -548,7 +548,7 @@ func TestDeleteInactivePendingObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.DeleteInactivePendingObjects{
|
metabasetest.DeleteInactivePendingObjects{
|
||||||
@ -588,7 +588,7 @@ func TestDeleteInactivePendingObjects(t *testing.T) {
|
|||||||
ZombieDeletionDeadline: &now,
|
ZombieDeletionDeadline: &now,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
metabasetest.BeginSegment{
|
metabasetest.BeginSegment{
|
||||||
Opts: metabase.BeginSegment{
|
Opts: metabase.BeginSegment{
|
||||||
@ -680,7 +680,7 @@ func TestDeleteInactivePendingObjects(t *testing.T) {
|
|||||||
// use default 24h zombie deletion deadline
|
// use default 24h zombie deletion deadline
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
for i := byte(0); i < 3; i++ {
|
for i := byte(0); i < 3; i++ {
|
||||||
|
@ -412,7 +412,7 @@ func TestDeletePendingObjectNew(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
object := metabase.RawObject{
|
object := metabase.RawObject{
|
||||||
@ -444,7 +444,7 @@ func TestDeletePendingObjectNew(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.CommitSegment{
|
metabasetest.CommitSegment{
|
||||||
@ -498,7 +498,7 @@ func TestDeletePendingObjectNew(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
metabasetest.CommitInlineSegment{
|
metabasetest.CommitInlineSegment{
|
||||||
|
@ -94,9 +94,8 @@ func CreatePendingObjectNew(ctx *testcontext.Context, t *testing.T, db *metabase
|
|||||||
Encryption: DefaultEncryption,
|
Encryption: DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version = 1
|
|
||||||
|
|
||||||
for i := byte(0); i < numberOfSegments; i++ {
|
for i := byte(0); i < numberOfSegments; i++ {
|
||||||
BeginSegment{
|
BeginSegment{
|
||||||
|
@ -94,7 +94,7 @@ func TestIteratePendingObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
encryptedMetadata := testrand.Bytes(1024)
|
encryptedMetadata := testrand.Bytes(1024)
|
||||||
@ -107,7 +107,7 @@ func TestIteratePendingObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
committed.Version++
|
committed.Version++
|
||||||
|
|
||||||
@ -644,7 +644,7 @@ func TestIteratePendingObjects(t *testing.T) {
|
|||||||
EncryptedMetadataNonce: []byte{5},
|
EncryptedMetadataNonce: []byte{5},
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
// include custom metadata
|
// include custom metadata
|
||||||
@ -700,7 +700,7 @@ func TestIteratePendingObjects(t *testing.T) {
|
|||||||
EncryptedMetadataNonce: []byte{5},
|
EncryptedMetadataNonce: []byte{5},
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
var collector metabasetest.PendingObjectsCollector
|
var collector metabasetest.PendingObjectsCollector
|
||||||
@ -816,7 +816,7 @@ func TestIteratePendingObjects(t *testing.T) {
|
|||||||
|
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
}
|
}
|
||||||
for _, batchSize := range []int{1, 2, 3} {
|
for _, batchSize := range []int{1, 2, 3} {
|
||||||
@ -897,7 +897,7 @@ func TestIteratePendingObjects(t *testing.T) {
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
|
|
||||||
objs = append(objs, metabase.PendingObjectEntry{
|
objs = append(objs, metabase.PendingObjectEntry{
|
||||||
@ -937,7 +937,7 @@ func createPendingObjects(ctx *testcontext.Context, t *testing.T, db *metabase.D
|
|||||||
Encryption: metabasetest.DefaultEncryption,
|
Encryption: metabasetest.DefaultEncryption,
|
||||||
UsePendingObjectsTable: true,
|
UsePendingObjectsTable: true,
|
||||||
},
|
},
|
||||||
Version: 1,
|
Version: metabase.PendingVersion,
|
||||||
}.Check(ctx, t, db)
|
}.Check(ctx, t, db)
|
||||||
obj.Version++
|
obj.Version++
|
||||||
|
|
||||||
|
@ -1717,7 +1717,7 @@ func (endpoint *Endpoint) pendingObjectEntryToProtoListItem(ctx context.Context,
|
|||||||
satStreamID, err := endpoint.packStreamID(ctx, &internalpb.StreamID{
|
satStreamID, err := endpoint.packStreamID(ctx, &internalpb.StreamID{
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
EncryptedObjectKey: append([]byte(prefixToPrependInSatStreamID), []byte(entry.ObjectKey)...),
|
EncryptedObjectKey: append([]byte(prefixToPrependInSatStreamID), []byte(entry.ObjectKey)...),
|
||||||
Version: 1,
|
Version: int64(metabase.PendingVersion),
|
||||||
CreationDate: entry.CreatedAt,
|
CreationDate: entry.CreatedAt,
|
||||||
ExpirationDate: expiresAt,
|
ExpirationDate: expiresAt,
|
||||||
StreamId: entry.StreamID[:],
|
StreamId: entry.StreamID[:],
|
||||||
|
Loading…
Reference in New Issue
Block a user