From c6436e1500b1ec94d867093b1aa96186fcbb233a Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Mon, 2 Oct 2023 16:14:52 +0300 Subject: [PATCH] satellite/metabase: rename BeginObjectExactVersion method With the upcoming versioning changes `BeginObjectExactVersion` makes only sense for testing. Currently this does not rename the options struct or move it into `metabasetest`, because it would create a significant amount of merge/rebase noise. Change-Id: Iafa2f81a05ae66320bc6a839828217ec94c63e1f --- satellite/metabase/bench_expired_test.go | 2 +- satellite/metabase/bench_test.go | 2 +- satellite/metabase/commit.go | 4 ++-- satellite/metabase/delete_objects_test.go | 2 +- satellite/metabase/metabasetest/create.go | 2 +- satellite/metabase/metabasetest/test.go | 2 +- satellite/repair/checker/observer_test.go | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/satellite/metabase/bench_expired_test.go b/satellite/metabase/bench_expired_test.go index 3d89b3dec..b58c957d0 100644 --- a/satellite/metabase/bench_expired_test.go +++ b/satellite/metabase/bench_expired_test.go @@ -136,7 +136,7 @@ func (s *expiredScenario) run(ctx *testcontext.Context, b *testing.B, db *metaba StreamID: testrand.UUID(), } s.objectStream = append(s.objectStream, objectStream) - _, err := db.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ + _, err := db.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ ObjectStream: objectStream, Encryption: storj.EncryptionParameters{ CipherSuite: storj.EncAESGCM, diff --git a/satellite/metabase/bench_test.go b/satellite/metabase/bench_test.go index 65821aa64..2bd47445e 100644 --- a/satellite/metabase/bench_test.go +++ b/satellite/metabase/bench_test.go @@ -119,7 +119,7 @@ func (s *scenario) run(ctx *testcontext.Context, b *testing.B, db *metabase.DB) totalUpload.Record(func() { beginObject.Record(func() { - _, err := db.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ + _, err := db.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ ObjectStream: objectStream, Encryption: storj.EncryptionParameters{ CipherSuite: storj.EncAESGCM, diff --git a/satellite/metabase/commit.go b/satellite/metabase/commit.go index 95e29763d..7d341037b 100644 --- a/satellite/metabase/commit.go +++ b/satellite/metabase/commit.go @@ -191,8 +191,8 @@ func (opts *BeginObjectExactVersion) Verify() error { return nil } -// BeginObjectExactVersion adds a pending object to the database, with specific version. -func (db *DB) BeginObjectExactVersion(ctx context.Context, opts BeginObjectExactVersion) (committed Object, err error) { +// TestingBeginObjectExactVersion adds a pending object to the database, with specific version. +func (db *DB) TestingBeginObjectExactVersion(ctx context.Context, opts BeginObjectExactVersion) (committed Object, err error) { defer mon.Task()(&ctx)(&err) if err := opts.Verify(); err != nil { diff --git a/satellite/metabase/delete_objects_test.go b/satellite/metabase/delete_objects_test.go index 6632dc61d..7606c1aa3 100644 --- a/satellite/metabase/delete_objects_test.go +++ b/satellite/metabase/delete_objects_test.go @@ -457,7 +457,7 @@ func TestDeleteZombieObjects(t *testing.T) { t.Run("migrated objects", func(t *testing.T) { defer metabasetest.DeleteAll{}.Check(ctx, t, db) - _, err := db.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ + _, err := db.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ ObjectStream: obj1, }) require.NoError(t, err) diff --git a/satellite/metabase/metabasetest/create.go b/satellite/metabase/metabasetest/create.go index c1a82771f..05eb1b02c 100644 --- a/satellite/metabase/metabasetest/create.go +++ b/satellite/metabase/metabasetest/create.go @@ -267,7 +267,7 @@ func (co CreateTestObject) Run(ctx *testcontext.Context, t testing.TB, db *metab boeOpts = *co.BeginObjectExactVersion } - object, err := db.BeginObjectExactVersion(ctx, boeOpts) + object, err := db.TestingBeginObjectExactVersion(ctx, boeOpts) require.NoError(t, err) createdSegments := []metabase.Segment{} diff --git a/satellite/metabase/metabasetest/test.go b/satellite/metabase/metabasetest/test.go index 3fdd3722c..ea88132be 100644 --- a/satellite/metabase/metabasetest/test.go +++ b/satellite/metabase/metabasetest/test.go @@ -65,7 +65,7 @@ type BeginObjectExactVersion struct { // Check runs the test. func (step BeginObjectExactVersion) Check(ctx *testcontext.Context, t require.TestingT, db *metabase.DB) { - got, err := db.BeginObjectExactVersion(ctx, step.Opts) + got, err := db.TestingBeginObjectExactVersion(ctx, step.Opts) checkError(t, err, step.ErrClass, step.ErrText) if step.ErrClass == nil { require.Equal(t, step.Opts.Version, got.Version) diff --git a/satellite/repair/checker/observer_test.go b/satellite/repair/checker/observer_test.go index 75bc794fb..9c94feb82 100644 --- a/satellite/repair/checker/observer_test.go +++ b/satellite/repair/checker/observer_test.go @@ -508,7 +508,7 @@ func insertSegment(ctx context.Context, t *testing.T, planet *testplanet.Planet, StreamID: testrand.UUID(), } - _, err := metabaseDB.BeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ + _, err := metabaseDB.TestingBeginObjectExactVersion(ctx, metabase.BeginObjectExactVersion{ ObjectStream: obj, Encryption: storj.EncryptionParameters{ CipherSuite: storj.EncAESGCM,