satellite/metainfo/metabase: add EncryptedMetainfoEncryptedKey parameter

to metabase

* EncryptedMetainfoEncryptedKey added to CommitSegment and
UpdateMetadata request
* EncryptedMetainfoEncryptedKey returned with GetObject response and all
delete responses
* EncryptedMetainfoEncryptedKey returned with object iterator results

Change-Id: I917541ab5f3e1863bc8f238d17a15fbf72a23025
This commit is contained in:
Michal Niewrzal 2020-11-16 17:46:47 +01:00 committed by Fadila
parent 402cfcb7c6
commit b7df41a0a1
10 changed files with 119 additions and 53 deletions

View File

@ -391,8 +391,9 @@ func (db *DB) CommitInlineSegment(ctx context.Context, opts CommitInlineSegment)
type CommitObject struct { type CommitObject struct {
ObjectStream ObjectStream
EncryptedMetadata []byte EncryptedMetadata []byte
EncryptedMetadataNonce []byte EncryptedMetadataNonce []byte
EncryptedMetadataEncryptedKey []byte
// TODO: proof // TODO: proof
Proofs []SegmentProof Proofs []SegmentProof
@ -491,11 +492,12 @@ func (db *DB) commitObjectWithoutProofs(ctx context.Context, opts CommitObject)
status = 1, -- committed status = 1, -- committed
segment_count = $6, segment_count = $6,
encrypted_metadata_nonce = $7, encrypted_metadata_nonce = $7,
encrypted_metadata = $8, encrypted_metadata = $8,
encrypted_metadata_encrypted_key = $9,
total_encrypted_size = $9, total_encrypted_size = $10,
fixed_segment_size = $10, fixed_segment_size = $11,
zombie_deletion_deadline = NULL zombie_deletion_deadline = NULL
WHERE WHERE
project_id = $1 AND project_id = $1 AND
@ -509,7 +511,7 @@ func (db *DB) commitObjectWithoutProofs(ctx context.Context, opts CommitObject)
encryption; encryption;
`, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey), opts.Version, opts.StreamID, `, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey), opts.Version, opts.StreamID,
len(segments), len(segments),
opts.EncryptedMetadataNonce, opts.EncryptedMetadata, opts.EncryptedMetadataNonce, opts.EncryptedMetadata, opts.EncryptedMetadataEncryptedKey,
totalEncryptedSize, totalEncryptedSize,
fixedSegmentSize, fixedSegmentSize,
). ).
@ -533,6 +535,7 @@ func (db *DB) commitObjectWithoutProofs(ctx context.Context, opts CommitObject)
object.SegmentCount = int32(len(segments)) object.SegmentCount = int32(len(segments))
object.EncryptedMetadataNonce = opts.EncryptedMetadataNonce object.EncryptedMetadataNonce = opts.EncryptedMetadataNonce
object.EncryptedMetadata = opts.EncryptedMetadata object.EncryptedMetadata = opts.EncryptedMetadata
object.EncryptedMetadataEncryptedKey = opts.EncryptedMetadataEncryptedKey
object.TotalEncryptedSize = totalEncryptedSize object.TotalEncryptedSize = totalEncryptedSize
object.FixedSegmentSize = fixedSegmentSize object.FixedSegmentSize = fixedSegmentSize
return nil return nil
@ -552,8 +555,9 @@ func (db *DB) commitObjectWithProofs(ctx context.Context, opts CommitObject) (ob
type UpdateObjectMetadata struct { type UpdateObjectMetadata struct {
ObjectStream ObjectStream
EncryptedMetadata []byte EncryptedMetadata []byte
EncryptedMetadataNonce []byte EncryptedMetadataNonce []byte
EncryptedMetadataEncryptedKey []byte
} }
// UpdateObjectMetadata updates an object metadata. // UpdateObjectMetadata updates an object metadata.
@ -575,8 +579,9 @@ func (db *DB) UpdateObjectMetadata(ctx context.Context, opts UpdateObjectMetadat
// during commit object. // during commit object.
result, err := db.db.ExecContext(ctx, ` result, err := db.db.ExecContext(ctx, `
UPDATE objects SET UPDATE objects SET
encrypted_metadata_nonce = $6, encrypted_metadata_nonce = $6,
encrypted_metadata = $7 encrypted_metadata = $7,
encrypted_metadata_encrypted_key = $8
WHERE WHERE
project_id = $1 AND project_id = $1 AND
bucket_name = $2 AND bucket_name = $2 AND
@ -585,7 +590,7 @@ func (db *DB) UpdateObjectMetadata(ctx context.Context, opts UpdateObjectMetadat
stream_id = $5 AND stream_id = $5 AND
status = 1 status = 1
`, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey), opts.Version, opts.StreamID, `, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey), opts.Version, opts.StreamID,
opts.EncryptedMetadataNonce, opts.EncryptedMetadata) opts.EncryptedMetadataNonce, opts.EncryptedMetadata, opts.EncryptedMetadataEncryptedKey)
if err != nil { if err != nil {
return Error.New("unable to update object metadata: %w", err) return Error.New("unable to update object metadata: %w", err)
} }

View File

@ -1467,6 +1467,7 @@ func TestCommitObject(t *testing.T) {
encryptedMetadata := testrand.Bytes(1024) encryptedMetadata := testrand.Bytes(1024)
encryptedMetadataNonce := testrand.Nonce() encryptedMetadataNonce := testrand.Nonce()
encryptedMetadataKey := testrand.Bytes(265)
CommitObject{ CommitObject{
Opts: metabase.CommitObject{ Opts: metabase.CommitObject{
@ -1477,8 +1478,9 @@ func TestCommitObject(t *testing.T) {
Version: 5, Version: 5,
StreamID: obj.StreamID, StreamID: obj.StreamID,
}, },
EncryptedMetadataNonce: encryptedMetadataNonce[:], EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: encryptedMetadata, EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}, },
}.Check(ctx, t, db) }.Check(ctx, t, db)
@ -1510,8 +1512,9 @@ func TestCommitObject(t *testing.T) {
CreatedAt: now, CreatedAt: now,
Status: metabase.Committed, Status: metabase.Committed,
EncryptedMetadataNonce: encryptedMetadataNonce[:], EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: encryptedMetadata, EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
Encryption: defaultTestEncryption, Encryption: defaultTestEncryption,
}, },
@ -1580,6 +1583,7 @@ func TestUpdateObjectMetadata(t *testing.T) {
encryptedMetadata := testrand.Bytes(1024) encryptedMetadata := testrand.Bytes(1024)
encryptedMetadataNonce := testrand.Nonce() encryptedMetadataNonce := testrand.Nonce()
encryptedMetadataKey := testrand.Bytes(265)
Verify{ Verify{
Objects: []metabase.RawObject{ Objects: []metabase.RawObject{
@ -1594,9 +1598,10 @@ func TestUpdateObjectMetadata(t *testing.T) {
UpdateObjectMetadata{ UpdateObjectMetadata{
Opts: metabase.UpdateObjectMetadata{ Opts: metabase.UpdateObjectMetadata{
ObjectStream: obj, ObjectStream: obj,
EncryptedMetadata: encryptedMetadata, EncryptedMetadata: encryptedMetadata,
EncryptedMetadataNonce: encryptedMetadataNonce[:], EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}, },
}.Check(ctx, t, db) }.Check(ctx, t, db)
@ -1608,8 +1613,9 @@ func TestUpdateObjectMetadata(t *testing.T) {
Status: metabase.Committed, Status: metabase.Committed,
Encryption: defaultTestEncryption, Encryption: defaultTestEncryption,
EncryptedMetadata: encryptedMetadata, EncryptedMetadata: encryptedMetadata,
EncryptedMetadataNonce: encryptedMetadataNonce[:], EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}, },
}, },
}.Check(ctx, t, db) }.Check(ctx, t, db)

View File

@ -96,8 +96,9 @@ func (db *DB) PostgresMigration() *migrate.Migration {
status INT2 NOT NULL default 0, status INT2 NOT NULL default 0,
segment_count INT4 NOT NULL default 0, segment_count INT4 NOT NULL default 0,
encrypted_metadata_nonce BYTEA default NULL, encrypted_metadata_nonce BYTEA default NULL,
encrypted_metadata BYTEA default NULL, encrypted_metadata BYTEA default NULL,
encrypted_metadata_encrypted_key BYTEA default NULL,
total_encrypted_size INT4 NOT NULL default 0, total_encrypted_size INT4 NOT NULL default 0,
fixed_segment_size INT4 NOT NULL default 0, fixed_segment_size INT4 NOT NULL default 0,

View File

@ -115,7 +115,7 @@ func (db *DB) DeleteObjectExactVersion(ctx context.Context, opts DeleteObjectExa
version, stream_id, version, stream_id,
created_at, expires_at, created_at, expires_at,
status, segment_count, status, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption; encryption;
`, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey), opts.Version) `, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey), opts.Version)
@ -194,7 +194,7 @@ func (db *DB) DeleteObjectLatestVersion(ctx context.Context, opts DeleteObjectLa
version, stream_id, version, stream_id,
created_at, expires_at, created_at, expires_at,
status, segment_count, status, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption; encryption;
`, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey)) `, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey))
@ -250,7 +250,7 @@ func (db *DB) DeleteObjectAllVersions(ctx context.Context, opts DeleteObjectAllV
version, stream_id, version, stream_id,
created_at, expires_at, created_at, expires_at,
status, segment_count, status, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption; encryption;
`, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey)) `, opts.ProjectID, opts.BucketName, []byte(opts.ObjectKey))
@ -328,7 +328,7 @@ func (db *DB) DeleteObjectsAllVersions(ctx context.Context, opts DeleteObjectsAl
object_key, version, stream_id, object_key, version, stream_id,
created_at, expires_at, created_at, expires_at,
status, segment_count, status, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption; encryption;
`, projectID, bucketName, pgutil.ByteaArray(objectKeys)) `, projectID, bucketName, pgutil.ByteaArray(objectKeys))
@ -378,7 +378,7 @@ func scanObjectDeletion(location ObjectLocation, rows tagsql.Rows) (objects []Ob
err = rows.Scan(&object.Version, &object.StreamID, err = rows.Scan(&object.Version, &object.StreamID,
&object.CreatedAt, &object.ExpiresAt, &object.CreatedAt, &object.ExpiresAt,
&object.Status, &object.SegmentCount, &object.Status, &object.SegmentCount,
&object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataEncryptedKey,
&object.TotalEncryptedSize, &object.FixedSegmentSize, &object.TotalEncryptedSize, &object.FixedSegmentSize,
encryptionParameters{&object.Encryption}) encryptionParameters{&object.Encryption})
if err != nil { if err != nil {
@ -405,7 +405,7 @@ func scanMultipleObjectsDeletion(rows tagsql.Rows) (objects []Object, err error)
&object.ObjectKey, &object.Version, &object.StreamID, &object.ObjectKey, &object.Version, &object.StreamID,
&object.CreatedAt, &object.ExpiresAt, &object.CreatedAt, &object.ExpiresAt,
&object.Status, &object.SegmentCount, &object.Status, &object.SegmentCount,
&object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataEncryptedKey,
&object.TotalEncryptedSize, &object.FixedSegmentSize, &object.TotalEncryptedSize, &object.FixedSegmentSize,
encryptionParameters{&object.Encryption}) encryptionParameters{&object.Encryption})
if err != nil { if err != nil {

View File

@ -160,7 +160,18 @@ func TestDeleteObjectExactVersion(t *testing.T) {
t.Run("Delete object without segments", func(t *testing.T) { t.Run("Delete object without segments", func(t *testing.T) {
defer DeleteAll{}.Check(ctx, t, db) defer DeleteAll{}.Check(ctx, t, db)
object := createObject(ctx, t, db, obj, 0) encryptedMetadata := testrand.Bytes(1024)
encryptedMetadataNonce := testrand.Nonce()
encryptedMetadataKey := testrand.Bytes(265)
object := CreateTestObject{
CommitObject: &metabase.CommitObject{
ObjectStream: obj,
EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
},
}.Run(ctx, t, db, obj, 0)
DeleteObjectExactVersion{ DeleteObjectExactVersion{
Opts: metabase.DeleteObjectExactVersion{ Opts: metabase.DeleteObjectExactVersion{
@ -324,7 +335,18 @@ func TestDeleteObjectLatestVersion(t *testing.T) {
t.Run("Delete object without segments", func(t *testing.T) { t.Run("Delete object without segments", func(t *testing.T) {
defer DeleteAll{}.Check(ctx, t, db) defer DeleteAll{}.Check(ctx, t, db)
object := createObject(ctx, t, db, obj, 0) encryptedMetadata := testrand.Bytes(1024)
encryptedMetadataNonce := testrand.Nonce()
encryptedMetadataKey := testrand.Bytes(265)
object := CreateTestObject{
CommitObject: &metabase.CommitObject{
ObjectStream: obj,
EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
},
}.Run(ctx, t, db, obj, 0)
DeleteObjectLatestVersion{ DeleteObjectLatestVersion{
Opts: metabase.DeleteObjectLatestVersion{ Opts: metabase.DeleteObjectLatestVersion{
@ -552,7 +574,18 @@ func TestDeleteObjectAllVersions(t *testing.T) {
t.Run("Delete object without segments", func(t *testing.T) { t.Run("Delete object without segments", func(t *testing.T) {
defer DeleteAll{}.Check(ctx, t, db) defer DeleteAll{}.Check(ctx, t, db)
object := createObject(ctx, t, db, obj, 0) encryptedMetadata := testrand.Bytes(1024)
encryptedMetadataNonce := testrand.Nonce()
encryptedMetadataKey := testrand.Bytes(265)
object := CreateTestObject{
CommitObject: &metabase.CommitObject{
ObjectStream: obj,
EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
},
}.Run(ctx, t, db, obj, 0)
DeleteObjectAllVersions{ DeleteObjectAllVersions{
Opts: metabase.DeleteObjectAllVersions{ObjectLocation: obj.Location()}, Opts: metabase.DeleteObjectAllVersions{ObjectLocation: obj.Location()},

View File

@ -53,7 +53,7 @@ func (db *DB) GetObjectExactVersion(ctx context.Context, opts GetObjectExactVers
stream_id, stream_id,
created_at, expires_at, created_at, expires_at,
segment_count, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption encryption
FROM objects FROM objects
@ -68,7 +68,7 @@ func (db *DB) GetObjectExactVersion(ctx context.Context, opts GetObjectExactVers
&object.StreamID, &object.StreamID,
&object.CreatedAt, &object.ExpiresAt, &object.CreatedAt, &object.ExpiresAt,
&object.SegmentCount, &object.SegmentCount,
&object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataEncryptedKey,
&object.TotalEncryptedSize, &object.FixedSegmentSize, &object.TotalEncryptedSize, &object.FixedSegmentSize,
encryptionParameters{&object.Encryption}, encryptionParameters{&object.Encryption},
) )
@ -109,7 +109,7 @@ func (db *DB) GetObjectLatestVersion(ctx context.Context, opts GetObjectLatestVe
stream_id, version, stream_id, version,
created_at, expires_at, created_at, expires_at,
segment_count, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption encryption
FROM objects FROM objects
@ -125,7 +125,7 @@ func (db *DB) GetObjectLatestVersion(ctx context.Context, opts GetObjectLatestVe
&object.StreamID, &object.Version, &object.StreamID, &object.Version,
&object.CreatedAt, &object.ExpiresAt, &object.CreatedAt, &object.ExpiresAt,
&object.SegmentCount, &object.SegmentCount,
&object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataNonce, &object.EncryptedMetadata, &object.EncryptedMetadataEncryptedKey,
&object.TotalEncryptedSize, &object.FixedSegmentSize, &object.TotalEncryptedSize, &object.FixedSegmentSize,
encryptionParameters{&object.Encryption}, encryptionParameters{&object.Encryption},
) )

View File

@ -9,6 +9,7 @@ import (
"storj.io/common/storj" "storj.io/common/storj"
"storj.io/common/testcontext" "storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/satellite/metainfo/metabase" "storj.io/storj/satellite/metainfo/metabase"
) )
@ -233,11 +234,16 @@ func TestGetObjectLatestVersion(t *testing.T) {
t.Run("Get object", func(t *testing.T) { t.Run("Get object", func(t *testing.T) {
defer DeleteAll{}.Check(ctx, t, db) defer DeleteAll{}.Check(ctx, t, db)
encryptedMetadata := testrand.Bytes(1024)
encryptedMetadataNonce := testrand.Nonce()
encryptedMetadataKey := testrand.Bytes(265)
CreateTestObject{ CreateTestObject{
CommitObject: &metabase.CommitObject{ CommitObject: &metabase.CommitObject{
ObjectStream: obj, ObjectStream: obj,
EncryptedMetadataNonce: []byte("nonce"), EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: []byte("metadata"), EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}, },
}.Run(ctx, t, db, obj, 0) }.Run(ctx, t, db, obj, 0)
@ -252,8 +258,9 @@ func TestGetObjectLatestVersion(t *testing.T) {
Encryption: defaultTestEncryption, Encryption: defaultTestEncryption,
EncryptedMetadataNonce: []byte("nonce"), EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: []byte("metadata"), EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}, },
}.Check(ctx, t, db) }.Check(ctx, t, db)
@ -265,8 +272,9 @@ func TestGetObjectLatestVersion(t *testing.T) {
Encryption: defaultTestEncryption, Encryption: defaultTestEncryption,
EncryptedMetadataNonce: []byte("nonce"), EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: []byte("metadata"), EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}, },
}}.Check(ctx, t, db) }}.Check(ctx, t, db)
}) })

View File

@ -146,7 +146,7 @@ func (it *objectsIterator) doNextQuery(ctx context.Context) (_ tagsql.Rows, err
object_key, stream_id, version, status, object_key, stream_id, version, status,
created_at, expires_at, created_at, expires_at,
segment_count, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption encryption
FROM objects FROM objects
@ -171,7 +171,7 @@ func (it *objectsIterator) scanItem(item *ObjectEntry) error {
&item.ObjectKey, &item.StreamID, &item.Version, &item.Status, &item.ObjectKey, &item.StreamID, &item.Version, &item.Status,
&item.CreatedAt, &item.ExpiresAt, &item.CreatedAt, &item.ExpiresAt,
&item.SegmentCount, &item.SegmentCount,
&item.EncryptedMetadataNonce, &item.EncryptedMetadata, &item.EncryptedMetadataNonce, &item.EncryptedMetadata, &item.EncryptedMetadataEncryptedKey,
&item.TotalEncryptedSize, &item.FixedSegmentSize, &item.TotalEncryptedSize, &item.FixedSegmentSize,
encryptionParameters{&item.Encryption}, encryptionParameters{&item.Encryption},
) )

View File

@ -9,6 +9,7 @@ import (
"time" "time"
"storj.io/common/testcontext" "storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/common/uuid" "storj.io/common/uuid"
"storj.io/storj/satellite/metainfo/metabase" "storj.io/storj/satellite/metainfo/metabase"
) )
@ -110,6 +111,10 @@ func TestIterateObjects(t *testing.T) {
Version: 1, Version: 1,
}.Check(ctx, t, db) }.Check(ctx, t, db)
encryptedMetadata := testrand.Bytes(1024)
encryptedMetadataNonce := testrand.Nonce()
encryptedMetadataKey := testrand.Bytes(265)
BeginObjectExactVersion{ BeginObjectExactVersion{
Opts: metabase.BeginObjectExactVersion{ Opts: metabase.BeginObjectExactVersion{
ObjectStream: committed, ObjectStream: committed,
@ -119,7 +124,10 @@ func TestIterateObjects(t *testing.T) {
}.Check(ctx, t, db) }.Check(ctx, t, db)
CommitObject{ CommitObject{
Opts: metabase.CommitObject{ Opts: metabase.CommitObject{
ObjectStream: committed, ObjectStream: committed,
EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}, },
}.Check(ctx, t, db) }.Check(ctx, t, db)
@ -131,10 +139,13 @@ func TestIterateObjects(t *testing.T) {
Status: metabase.Committed, Status: metabase.Committed,
}, },
Result: []metabase.ObjectEntry{{ Result: []metabase.ObjectEntry{{
ObjectStream: committed, ObjectStream: committed,
CreatedAt: now, CreatedAt: now,
Status: metabase.Committed, Status: metabase.Committed,
Encryption: defaultTestEncryption, Encryption: defaultTestEncryption,
EncryptedMetadataNonce: encryptedMetadataNonce[:],
EncryptedMetadata: encryptedMetadata,
EncryptedMetadataEncryptedKey: encryptedMetadataKey,
}}, }},
}.Check(ctx, t, db) }.Check(ctx, t, db)

View File

@ -23,8 +23,9 @@ type RawObject struct {
Status ObjectStatus Status ObjectStatus
SegmentCount int32 SegmentCount int32
EncryptedMetadataNonce []byte EncryptedMetadataNonce []byte
EncryptedMetadata []byte EncryptedMetadata []byte
EncryptedMetadataEncryptedKey []byte
TotalEncryptedSize int64 TotalEncryptedSize int64
FixedSegmentSize int32 FixedSegmentSize int32
@ -98,7 +99,7 @@ func (db *DB) testingGetAllObjects(ctx context.Context) (_ []RawObject, err erro
project_id, bucket_name, object_key, version, stream_id, project_id, bucket_name, object_key, version, stream_id,
created_at, expires_at, created_at, expires_at,
status, segment_count, status, segment_count,
encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_nonce, encrypted_metadata, encrypted_metadata_encrypted_key,
total_encrypted_size, fixed_segment_size, total_encrypted_size, fixed_segment_size,
encryption, encryption,
zombie_deletion_deadline zombie_deletion_deadline
@ -126,6 +127,7 @@ func (db *DB) testingGetAllObjects(ctx context.Context) (_ []RawObject, err erro
&obj.EncryptedMetadataNonce, &obj.EncryptedMetadataNonce,
&obj.EncryptedMetadata, &obj.EncryptedMetadata,
&obj.EncryptedMetadataEncryptedKey,
&obj.TotalEncryptedSize, &obj.TotalEncryptedSize,
&obj.FixedSegmentSize, &obj.FixedSegmentSize,