From 0a69da4ff100a75f21fcda3ecf0f798a6b332a34 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Mon, 30 Mar 2020 12:08:50 +0300 Subject: [PATCH] all: switch to storj.io/common/uuid Change-Id: I178a0a8dac691e57bce317b91411292fb3c40c9f --- cmd/satellite/main.go | 2 +- cmd/satellite/reports/attribution.go | 2 +- cmd/segment-reaper/observer_test.go | 24 +++++++-------- cmd/storj-sim/console.go | 2 +- go.mod | 3 +- go.sum | 2 ++ lib/uplink/bucket_attrs_test.go | 10 +++---- lib/uplink/project.go | 7 ++--- lib/uplinkc/uplink.go | 1 - private/dbutil/uuid.go | 3 +- private/dbutil/uuid_test.go | 2 +- private/testplanet/referralmanager.go | 2 +- private/testplanet/uplink.go | 2 +- satellite/accounting/billing_test.go | 2 +- satellite/accounting/bucketstats.go | 2 +- satellite/accounting/bucketusage.go | 2 +- satellite/accounting/db.go | 3 +- satellite/accounting/db_test.go | 6 ++-- satellite/accounting/live/live_test.go | 8 ++--- satellite/accounting/live/redis.go | 2 +- satellite/accounting/projectusage.go | 2 +- satellite/accounting/projectusage_test.go | 8 ++--- satellite/accounting/reportedrollup/chore.go | 2 +- satellite/accounting/tally/tally.go | 2 +- satellite/accounting/tally/tally_test.go | 2 +- satellite/admin/project.go | 2 +- satellite/attribution/db.go | 3 +- satellite/attribution/db_test.go | 18 +++++------ satellite/console/apikeys.go | 2 +- satellite/console/consoleauth/claims.go | 2 +- satellite/console/consoleauth/claims_test.go | 2 +- .../console/consoleweb/consoleapi/auth.go | 2 +- .../console/consoleweb/consoleql/mutation.go | 2 +- .../consoleweb/consoleql/mutation_test.go | 2 +- .../console/consoleweb/consoleql/query.go | 2 +- satellite/console/consoleweb/server.go | 2 +- satellite/console/projectmembers.go | 2 +- satellite/console/projectmembers_test.go | 16 +++++----- satellite/console/projects.go | 2 +- satellite/console/projects_test.go | 6 ++-- satellite/console/registrationtoken.go | 3 +- satellite/console/resetpasswordtoken.go | 3 +- satellite/console/resetpasswordtoken_test.go | 2 +- satellite/console/service.go | 4 +-- satellite/console/usercredits.go | 2 +- satellite/console/usercredits_test.go | 6 ++-- satellite/console/users.go | 2 +- satellite/console/users_test.go | 8 ++--- satellite/inspector/inspector.go | 2 +- satellite/metainfo/attribution.go | 3 +- satellite/metainfo/attribution_test.go | 4 +-- satellite/metainfo/db.go | 3 +- satellite/metainfo/db_test.go | 6 ++-- satellite/metainfo/endpoint_test.go | 2 +- satellite/metainfo/loop.go | 2 +- satellite/metainfo/metainfo.go | 10 +++---- satellite/metainfo/metainfo_test.go | 14 ++++----- satellite/metainfo/service.go | 2 +- satellite/metainfo/validation.go | 2 +- satellite/orders/endpoint.go | 2 +- satellite/orders/orders_test.go | 8 ++--- satellite/orders/rollups_write_cache.go | 2 +- satellite/orders/rollups_write_cache_test.go | 10 +++---- satellite/orders/service.go | 4 +-- satellite/payments/account.go | 3 +- satellite/payments/coupons.go | 3 +- satellite/payments/creditcards.go | 2 +- satellite/payments/credits.go | 3 +- satellite/payments/invoices.go | 2 +- .../payments/mockpayments/mockpayments.go | 2 +- satellite/payments/projectcharges.go | 3 +- .../payments/stripecoinpayments/accounts.go | 2 +- .../payments/stripecoinpayments/coupons.go | 2 +- .../stripecoinpayments/coupons_test.go | 30 +++++++++---------- .../stripecoinpayments/creditcards.go | 2 +- .../payments/stripecoinpayments/credits.go | 3 +- .../stripecoinpayments/credits_test.go | 20 ++++++------- .../payments/stripecoinpayments/customers.go | 2 +- .../stripecoinpayments/customers_test.go | 10 +++---- .../payments/stripecoinpayments/invoices.go | 2 +- .../stripecoinpayments/projectrecords.go | 2 +- .../stripecoinpayments/projectrecords_test.go | 8 ++--- .../payments/stripecoinpayments/service.go | 4 +-- .../payments/stripecoinpayments/tokens.go | 3 +- .../stripecoinpayments/transactions.go | 2 +- .../stripecoinpayments/transactions_test.go | 2 +- satellite/payments/tokens.go | 2 +- satellite/referrals/service.go | 6 ++-- satellite/referrals/service_test.go | 6 ++-- satellite/referrals/users.go | 2 +- satellite/repair/checker/checker_test.go | 4 +-- satellite/rewards/partner.go | 3 +- satellite/rewards/partners.go | 2 +- satellite/satellitedb/apikeys.go | 2 +- satellite/satellitedb/attribution.go | 2 +- satellite/satellitedb/attribution_test.go | 28 ++++++++--------- satellite/satellitedb/buckets.go | 9 +++--- satellite/satellitedb/coinpaymentstxs.go | 2 +- satellite/satellitedb/coupons.go | 2 +- satellite/satellitedb/credits.go | 2 +- satellite/satellitedb/customers.go | 3 +- .../satellitedb/invoiceprojectrecords.go | 2 +- satellite/satellitedb/orders.go | 2 +- satellite/satellitedb/projectaccounting.go | 2 +- satellite/satellitedb/projectmembers.go | 2 +- satellite/satellitedb/projects.go | 2 +- satellite/satellitedb/regtokens.go | 2 +- satellite/satellitedb/resetpasstokens.go | 3 +- satellite/satellitedb/usercredits.go | 2 +- satellite/satellitedb/users.go | 2 +- satellite/satellitedb/utils.go | 3 +- .../console/consoleapi/notifications.go | 2 +- storagenode/notifications/notifications.go | 3 +- .../notifications/notifications_test.go | 2 +- storagenode/notifications/service.go | 3 +- storagenode/storagenodedb/notifications.go | 4 +-- .../storagenodedbtest/run_test.go | 2 +- 117 files changed, 246 insertions(+), 253 deletions(-) diff --git a/cmd/satellite/main.go b/cmd/satellite/main.go index 7d30e63ab..6b1c4a6f7 100644 --- a/cmd/satellite/main.go +++ b/cmd/satellite/main.go @@ -12,7 +12,6 @@ import ( "text/tabwriter" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spf13/cobra" "github.com/zeebo/errs" "go.uber.org/zap" @@ -20,6 +19,7 @@ import ( "storj.io/common/context2" "storj.io/common/fpath" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/private/cfgstruct" "storj.io/private/process" "storj.io/private/version" diff --git a/cmd/satellite/reports/attribution.go b/cmd/satellite/reports/attribution.go index 0a3b28485..848b89147 100644 --- a/cmd/satellite/reports/attribution.go +++ b/cmd/satellite/reports/attribution.go @@ -12,11 +12,11 @@ import ( "strconv" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "go.uber.org/zap" "storj.io/common/memory" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/attribution" "storj.io/storj/satellite/satellitedb" diff --git a/cmd/segment-reaper/observer_test.go b/cmd/segment-reaper/observer_test.go index 3226c155d..f2cde8b2c 100644 --- a/cmd/segment-reaper/observer_test.go +++ b/cmd/segment-reaper/observer_test.go @@ -18,7 +18,6 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -26,6 +25,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite/metainfo" "storj.io/storj/storage" "storj.io/storj/storage/teststore" @@ -114,7 +114,7 @@ func TestObserver_processSegment(t *testing.T) { var ( bucketName = "test-bucket" - projectID = testrand.UUID() + projectID = testrand.UUID2() numSegments = 65 obsvr = observer{ objects: make(bucketsObjects), @@ -155,7 +155,7 @@ func TestObserver_processSegment(t *testing.T) { var ( bucketName = "test-bucket" - projectID = testrand.UUID() + projectID = testrand.UUID2() numSegments = 65 obsvr = observer{ objects: make(bucketsObjects), @@ -223,7 +223,7 @@ func TestObserver_processSegment(t *testing.T) { to = time.Now() from = to.Add(-time.Hour) bucketName = "test-bucket" - projectID = testrand.UUID() + projectID = testrand.UUID2() obsvr = observer{ objects: make(bucketsObjects), from: &from, @@ -262,7 +262,7 @@ func TestObserver_processSegment(t *testing.T) { from = to.Add(-2 * time.Hour) diffFromTo = to.Sub(from) bucketName = "test-bucket" - projectID = testrand.UUID() + projectID = testrand.UUID2() numSegmentsObjOutDateRange = rand.Intn(50) + 15 numSegmentsBeforeDate = rand.Intn(numSegmentsObjOutDateRange-1) + 1 obsvr = observer{ @@ -342,7 +342,7 @@ func TestObserver_processSegment(t *testing.T) { to = time.Now() from = to.Add(-time.Hour) bucketName = "test-bucket" - projectID = testrand.UUID() + projectID = testrand.UUID2() obsvr = observer{ objects: make(bucketsObjects), from: &from, @@ -381,7 +381,7 @@ func TestObserver_processSegment(t *testing.T) { from = to.Add(-2 * time.Hour) diffFromTo = to.Sub(from) bucketName = "test-bucket" - projectID = testrand.UUID() + projectID = testrand.UUID2() numSegmentsObjOutDateRange = rand.Intn(50) + 15 numSegmentsBeforeDate = rand.Intn(numSegmentsObjOutDateRange-1) + 1 obsvr = observer{ @@ -499,7 +499,7 @@ func TestObserver_processSegment_from_to(t *testing.T) { to: to, } path := metainfo.ScopedPath{ - ProjectID: testrand.UUID(), + ProjectID: testrand.UUID2(), Segment: "l", BucketName: "bucket1", EncryptedObjectPath: "path1", @@ -570,7 +570,7 @@ func TestObserver_processSegment_single_project(t *testing.T) { expected string } - project1 := testrand.UUID().String() + project1 := testrand.UUID2().String() tests := []struct { objects []object }{ @@ -725,7 +725,7 @@ func TestObserver_analyzeProject(t *testing.T) { observer := &observer{ objects: bucketObjects, - lastProjectID: testrand.UUID().String(), + lastProjectID: testrand.UUID2().String(), zombieBuffer: make([]int, 0, maxNumOfSegments), } err := observer.findZombieSegments(object) @@ -768,7 +768,7 @@ func createNewObjectSegments( t.Helper() var ( - objectID = testrand.UUID().String() + objectID = testrand.UUID2().String() projectIDString = projectID.String() references = make([]segmentRef, 0, numSegments) encryptedPath = fmt.Sprintf("%s-%s-%s", projectIDString, bucketName, objectID) @@ -864,7 +864,7 @@ func generateTestdataObjects( } bucketName = "0" numObjs = rand.Intn(10) + 2 - projID = testrand.UUID() + projID = testrand.UUID2() withoutLastSegmentCount = 0 withMoreThanMaxNumSegmentsCount = 0 numMaxGeneratedSegments = 10 diff --git a/cmd/storj-sim/console.go b/cmd/storj-sim/console.go index e46f2ef57..c4a85394a 100644 --- a/cmd/storj-sim/console.go +++ b/cmd/storj-sim/console.go @@ -15,9 +15,9 @@ import ( "net/http" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/satellite/console/consoleauth" ) diff --git a/go.mod b/go.mod index 35cf5ade9..13119112e 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,6 @@ require ( github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d github.com/shopspring/decimal v0.0.0-20200105231215-408a2507e114 github.com/sirupsen/logrus v1.4.2 // indirect - github.com/skyrings/skyring-common v0.0.0-20160929130248-d1c0bb1cbd5e github.com/spacemonkeygo/monkit/v3 v3.0.5 github.com/spf13/cast v1.3.0 github.com/spf13/cobra v0.0.6 @@ -44,7 +43,7 @@ require ( golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 golang.org/x/time v0.0.0-20191024005414-555d28b269f0 google.golang.org/grpc v1.28.0 - storj.io/common v0.0.0-20200325130515-1ce63718a5c6 + storj.io/common v0.0.0-20200331124657-a4f8265946f2 storj.io/drpc v0.0.11 storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b storj.io/uplink v1.0.2-0.20200325131054-76ecb3d2e025 diff --git a/go.sum b/go.sum index 9b9b29aa4..1c8e3995c 100644 --- a/go.sum +++ b/go.sum @@ -622,6 +622,8 @@ storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d h1:R4qel+wubcKJP8HvWromOGOplb storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d/go.mod h1:I0QTs7z1rI+ZEN95GGY2LKMzP5OZqu0Udga3WhyQfO0= storj.io/common v0.0.0-20200325130515-1ce63718a5c6 h1:oyYoBs5GofkCHt/F24uJMzkGpQOoJkp3TYdTVghsUAo= storj.io/common v0.0.0-20200325130515-1ce63718a5c6/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE= +storj.io/common v0.0.0-20200331124657-a4f8265946f2 h1:Fctei5lPPAfbvtpijLQZTjQeeuh+MCkacLYau7nyxKA= +storj.io/common v0.0.0-20200331124657-a4f8265946f2/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE= storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ= storj.io/drpc v0.0.11 h1:6vLxfpSbwCLtqzAoXzXx/SxBqBtbzbmquXPqfcWKqfw= storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw= diff --git a/lib/uplink/bucket_attrs_test.go b/lib/uplink/bucket_attrs_test.go index 4aa0418c4..488345137 100644 --- a/lib/uplink/bucket_attrs_test.go +++ b/lib/uplink/bucket_attrs_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" @@ -18,6 +17,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/lib/uplink" "storj.io/storj/private/testplanet" ) @@ -69,7 +69,7 @@ func TestBucket_PartnerAttribution(t *testing.T) { apikey, err := uplink.ParseAPIKey(planet.Uplinks[0].APIKey[satellite.ID()].Serialize()) require.NoError(t, err) - partnerID := testrand.UUID() + partnerID := testrand.UUID2() t.Run("without partner id", func(t *testing.T) { config := uplink.Config{} @@ -120,7 +120,7 @@ func TestBucket_PartnerAttribution(t *testing.T) { config := uplink.Config{} config.Volatile.Log = zaptest.NewLogger(t) config.Volatile.TLS.SkipPeerCAWhitelist = true - config.Volatile.PartnerID = testrand.UUID().String() + config.Volatile.PartnerID = testrand.UUID2().String() up, err := uplink.NewUplink(ctx, &config) require.NoError(t, err) @@ -202,7 +202,7 @@ func TestBucket_UserAgent(t *testing.T) { require.NoError(t, err) partnerID, err := uuid.Parse("8cd605fa-ad00-45b6-823e-550eddc611d6") require.NoError(t, err) - assert.Equal(t, *partnerID, bucketInfo.PartnerID) + assert.Equal(t, storj.DeprecatedUUID(*partnerID), bucketInfo.PartnerID) }) t.Run("open with different user agent", func(t *testing.T) { @@ -227,7 +227,7 @@ func TestBucket_UserAgent(t *testing.T) { require.NoError(t, err) partnerID, err := uuid.Parse("8cd605fa-ad00-45b6-823e-550eddc611d6") require.NoError(t, err) - assert.Equal(t, *partnerID, bucketInfo.PartnerID) + assert.Equal(t, storj.DeprecatedUUID(*partnerID), bucketInfo.PartnerID) }) }) } diff --git a/lib/uplink/project.go b/lib/uplink/project.go index 2ed90f3ac..6eff5e6ac 100644 --- a/lib/uplink/project.go +++ b/lib/uplink/project.go @@ -6,12 +6,11 @@ package uplink import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/encryption" "storj.io/common/memory" "storj.io/common/rpc" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/uplink/private/ecclient" "storj.io/uplink/private/metainfo" "storj.io/uplink/private/metainfo/kvmetainfo" @@ -108,7 +107,7 @@ func (p *Project) CreateBucket(ctx context.Context, name string, cfg *BucketConf } bucket = storj.Bucket{ - PartnerID: partnerID, + PartnerID: storj.DeprecatedUUID(partnerID), PathCipher: cfg.PathCipher, DefaultEncryptionParameters: cfg.EncryptionParameters, DefaultRedundancyScheme: cfg.Volatile.RedundancyScheme, @@ -242,6 +241,6 @@ func (p *Project) trySetBucketAttribution(ctx context.Context, bucketName string // UserAgent is sent via RequestHeader return p.metainfo.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ Bucket: bucketName, - PartnerID: partnerID, + PartnerID: storj.DeprecatedUUID(partnerID), }) } diff --git a/lib/uplinkc/uplink.go b/lib/uplinkc/uplink.go index da278f68e..e031eb3b3 100644 --- a/lib/uplinkc/uplink.go +++ b/lib/uplinkc/uplink.go @@ -8,7 +8,6 @@ import "C" import ( "fmt" - "time" "storj.io/common/memory" diff --git a/private/dbutil/uuid.go b/private/dbutil/uuid.go index 441d6b97a..9e0585097 100644 --- a/private/dbutil/uuid.go +++ b/private/dbutil/uuid.go @@ -4,8 +4,9 @@ package dbutil import ( - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + + "storj.io/common/uuid" ) // BytesToUUID is used to convert []byte to UUID. diff --git a/private/dbutil/uuid_test.go b/private/dbutil/uuid_test.go index 94da53d20..b498dfd67 100644 --- a/private/dbutil/uuid_test.go +++ b/private/dbutil/uuid_test.go @@ -23,7 +23,7 @@ func TestBytesToUUID(t *testing.T) { }) t.Run("Valid input", func(t *testing.T) { - id := testrand.UUID() + id := testrand.UUID2() result, err := BytesToUUID(id[:]) assert.NoError(t, err) assert.Equal(t, result, id) diff --git a/private/testplanet/referralmanager.go b/private/testplanet/referralmanager.go index 8bc77254c..375aeaf40 100644 --- a/private/testplanet/referralmanager.go +++ b/private/testplanet/referralmanager.go @@ -79,7 +79,7 @@ func (planet *Planet) newReferralManager() (*server.Server, error) { func (server *DefaultReferralManagerServer) GetTokens(ctx context.Context, req *pb.GetTokensRequest) (*pb.GetTokensResponse, error) { tokens := make([][]byte, server.tokenCount) for i := 0; i < server.tokenCount; i++ { - uuid := testrand.UUID() + uuid := testrand.UUID2() tokens[i] = uuid[:] } return &pb.GetTokensResponse{ diff --git a/private/testplanet/uplink.go b/private/testplanet/uplink.go index 0fcf7d078..10ff32ba5 100644 --- a/private/testplanet/uplink.go +++ b/private/testplanet/uplink.go @@ -12,7 +12,6 @@ import ( "strconv" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spf13/pflag" "github.com/zeebo/errs" "go.uber.org/zap" @@ -23,6 +22,7 @@ import ( "storj.io/common/peertls/tlsopts" "storj.io/common/rpc" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/private/cfgstruct" libuplink "storj.io/storj/lib/uplink" "storj.io/storj/satellite/console" diff --git a/satellite/accounting/billing_test.go b/satellite/accounting/billing_test.go index 1ccce47ad..4f11f35e1 100644 --- a/satellite/accounting/billing_test.go +++ b/satellite/accounting/billing_test.go @@ -8,7 +8,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/require" "go.uber.org/zap" @@ -17,6 +16,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/testplanet" "storj.io/storj/satellite" "storj.io/storj/satellite/accounting" diff --git a/satellite/accounting/bucketstats.go b/satellite/accounting/bucketstats.go index 12c2dd06a..449f5e209 100644 --- a/satellite/accounting/bucketstats.go +++ b/satellite/accounting/bucketstats.go @@ -4,7 +4,7 @@ package accounting import ( - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // BucketTally contains information about aggregate data stored in a bucket diff --git a/satellite/accounting/bucketusage.go b/satellite/accounting/bucketusage.go index a24dc7d7d..5752021a0 100644 --- a/satellite/accounting/bucketusage.go +++ b/satellite/accounting/bucketusage.go @@ -6,7 +6,7 @@ package accounting import ( "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // BucketStorageTally holds data about a bucket tally diff --git a/satellite/accounting/db.go b/satellite/accounting/db.go index 80a876f92..b10ba7a28 100644 --- a/satellite/accounting/db.go +++ b/satellite/accounting/db.go @@ -7,10 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/memory" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/satellite/compensation" ) diff --git a/satellite/accounting/db_test.go b/satellite/accounting/db_test.go index a8d013aa2..bd66fc08b 100644 --- a/satellite/accounting/db_test.go +++ b/satellite/accounting/db_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -17,6 +16,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/accounting" "storj.io/storj/satellite/console" @@ -26,7 +26,7 @@ import ( func TestSaveBucketTallies(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { // Setup: create bucket storage tallies - projectID := testrand.UUID() + projectID := testrand.UUID2() bucketTallies, expectedTallies, err := createBucketStorageTallies(projectID) require.NoError(t, err) @@ -136,7 +136,7 @@ func TestStorageNodeUsage(t *testing.T) { func TestProjectLimits(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { - proj, err := db.Console().Projects().Insert(ctx, &console.Project{Name: "test", OwnerID: testrand.UUID()}) + proj, err := db.Console().Projects().Insert(ctx, &console.Project{Name: "test", OwnerID: testrand.UUID2()}) require.NoError(t, err) err = db.ProjectAccounting().UpdateProjectUsageLimit(ctx, proj.ID, 1) diff --git a/satellite/accounting/live/live_test.go b/satellite/accounting/live/live_test.go index 022e27cf5..a0dc79d3c 100644 --- a/satellite/accounting/live/live_test.go +++ b/satellite/accounting/live/live_test.go @@ -8,7 +8,6 @@ import ( "math/rand" "testing" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" @@ -16,6 +15,7 @@ import ( "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite/accounting" "storj.io/storj/satellite/accounting/live" "storj.io/storj/storage/redis/redisserver" @@ -85,7 +85,7 @@ func TestRedisCacheConcurrency(t *testing.T) { cache, err := live.NewCache(zaptest.NewLogger(t).Named("live-accounting"), config) require.NoError(t, err) - projectID := testrand.UUID() + projectID := testrand.UUID2() const ( numConcurrent = 100 @@ -123,7 +123,7 @@ func populateCache(ctx context.Context, cache accounting.Cache) (projectIDs []uu // make up some project IDs projectIDs = make([]uuid.UUID, numProjects) for i := range projectIDs { - projectIDs[i] = testrand.UUID() + projectIDs[i] = testrand.UUID2() } // send lots of space used updates for all of these projects to the live @@ -179,7 +179,7 @@ func TestGetAllProjectTotals(t *testing.T) { projectIDs := make([]uuid.UUID, 1000) for i := range projectIDs { - projectIDs[i] = testrand.UUID() + projectIDs[i] = testrand.UUID2() err := cache.AddProjectStorageUsage(ctx, projectIDs[i], int64(i)) require.NoError(t, err) } diff --git a/satellite/accounting/live/redis.go b/satellite/accounting/live/redis.go index 57b2e2f9e..f02b54d4a 100644 --- a/satellite/accounting/live/redis.go +++ b/satellite/accounting/live/redis.go @@ -7,9 +7,9 @@ import ( "context" "strconv" - "github.com/skyrings/skyring-common/tools/uuid" "go.uber.org/zap" + "storj.io/common/uuid" "storj.io/storj/storage" "storj.io/storj/storage/redis" ) diff --git a/satellite/accounting/projectusage.go b/satellite/accounting/projectusage.go index 8147a88b4..1e0e6e2ca 100644 --- a/satellite/accounting/projectusage.go +++ b/satellite/accounting/projectusage.go @@ -7,12 +7,12 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "golang.org/x/sync/errgroup" "storj.io/common/memory" + "storj.io/common/uuid" ) var mon = monkit.Package() diff --git a/satellite/accounting/projectusage_test.go b/satellite/accounting/projectusage_test.go index 489336ec8..055861385 100644 --- a/satellite/accounting/projectusage_test.go +++ b/satellite/accounting/projectusage_test.go @@ -11,7 +11,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeebo/errs" @@ -26,6 +25,7 @@ import ( "storj.io/common/sync2" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/testplanet" "storj.io/storj/satellite" "storj.io/storj/satellite/accounting" @@ -208,7 +208,7 @@ func createBucketBandwidthRollups(ctx *testcontext.Context, satelliteDB satellit func TestProjectBandwidthTotal(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { pdb := db.ProjectAccounting() - projectID := testrand.UUID() + projectID := testrand.UUID2() // Setup: create bucket bandwidth rollup records expectedTotal, err := createBucketBandwidthRollups(ctx, db, projectID) @@ -290,8 +290,8 @@ func TestUsageRollups(t *testing.T) { now := time.Now() start := now.Add(tallyInterval * time.Duration(-tallyIntervals)) - project1 := testrand.UUID() - project2 := testrand.UUID() + project1 := testrand.UUID2() + project2 := testrand.UUID2() p1base := binary.BigEndian.Uint64(project1[:8]) >> 48 p2base := binary.BigEndian.Uint64(project2[:8]) >> 48 diff --git a/satellite/accounting/reportedrollup/chore.go b/satellite/accounting/reportedrollup/chore.go index bec4169e4..3de6fe10a 100644 --- a/satellite/accounting/reportedrollup/chore.go +++ b/satellite/accounting/reportedrollup/chore.go @@ -7,13 +7,13 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" "storj.io/common/pb" "storj.io/common/sync2" + "storj.io/common/uuid" "storj.io/storj/pkg/storj" "storj.io/storj/satellite/orders" ) diff --git a/satellite/accounting/tally/tally.go b/satellite/accounting/tally/tally.go index 5a6125963..4fab2ca62 100644 --- a/satellite/accounting/tally/tally.go +++ b/satellite/accounting/tally/tally.go @@ -7,7 +7,6 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" @@ -15,6 +14,7 @@ import ( "storj.io/common/pb" "storj.io/common/storj" "storj.io/common/sync2" + "storj.io/common/uuid" "storj.io/storj/satellite/accounting" "storj.io/storj/satellite/metainfo" ) diff --git a/satellite/accounting/tally/tally_test.go b/satellite/accounting/tally/tally_test.go index 4d3095034..805429d02 100644 --- a/satellite/accounting/tally/tally_test.go +++ b/satellite/accounting/tally/tally_test.go @@ -8,7 +8,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -18,6 +17,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/testplanet" "storj.io/storj/private/teststorj" "storj.io/storj/satellite/accounting" diff --git a/satellite/admin/project.go b/satellite/admin/project.go index 1cc9f57b5..e28c310eb 100644 --- a/satellite/admin/project.go +++ b/satellite/admin/project.go @@ -10,9 +10,9 @@ import ( "github.com/gorilla/mux" "github.com/gorilla/schema" - "github.com/skyrings/skyring-common/tools/uuid" "storj.io/common/memory" + "storj.io/common/uuid" ) func (server *Server) getProjectLimit(w http.ResponseWriter, r *http.Request) { diff --git a/satellite/attribution/db.go b/satellite/attribution/db.go index 1dbb4f81f..746577d6b 100644 --- a/satellite/attribution/db.go +++ b/satellite/attribution/db.go @@ -8,8 +8,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + + "storj.io/common/uuid" ) // ErrBucketNotAttributed is returned if a requested bucket not attributed(entry not found) diff --git a/satellite/attribution/db_test.go b/satellite/attribution/db_test.go index 51be999ab..d6068d710 100644 --- a/satellite/attribution/db_test.go +++ b/satellite/attribution/db_test.go @@ -7,13 +7,13 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "storj.io/common/pb" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite" "storj.io/storj/satellite/accounting" @@ -64,8 +64,8 @@ func (testData *AttributionTestData) init() { func TestDB(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { attributionDB := db.Attribution() - project1, project2 := testrand.UUID(), testrand.UUID() - partner1, partner2 := testrand.UUID(), testrand.UUID() + project1, project2 := testrand.UUID2(), testrand.UUID2() + partner1, partner2 := testrand.UUID2(), testrand.UUID2() infos := []*attribution.Info{ {project1, []byte("alpha"), partner1, time.Time{}}, @@ -94,14 +94,14 @@ func TestQueryAttribution(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { now := time.Now() - projectID := testrand.UUID() - partnerID := testrand.UUID() + projectID := testrand.UUID2() + partnerID := testrand.UUID2() alphaBucket := []byte("alpha") betaBucket := []byte("beta") testData := []AttributionTestData{ { name: "new partnerID, projectID, alpha", - partnerID: testrand.UUID(), + partnerID: testrand.UUID2(), projectID: projectID, bucketName: alphaBucket, @@ -116,7 +116,7 @@ func TestQueryAttribution(t *testing.T) { { name: "partnerID, new projectID, alpha", partnerID: partnerID, - projectID: testrand.UUID(), + projectID: testrand.UUID2(), bucketName: alphaBucket, remoteSize: remoteSize / 2, @@ -129,7 +129,7 @@ func TestQueryAttribution(t *testing.T) { }, { name: "new partnerID, projectID, beta", - partnerID: testrand.UUID(), + partnerID: testrand.UUID2(), projectID: projectID, bucketName: betaBucket, @@ -144,7 +144,7 @@ func TestQueryAttribution(t *testing.T) { { name: "partnerID, new projectID, beta", partnerID: partnerID, - projectID: testrand.UUID(), + projectID: testrand.UUID2(), bucketName: betaBucket, remoteSize: remoteSize / 4, diff --git a/satellite/console/apikeys.go b/satellite/console/apikeys.go index f8fa5c3eb..1e31f8396 100644 --- a/satellite/console/apikeys.go +++ b/satellite/console/apikeys.go @@ -7,7 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // APIKeys is interface for working with api keys store diff --git a/satellite/console/consoleauth/claims.go b/satellite/console/consoleauth/claims.go index 35b507335..2952ea10e 100644 --- a/satellite/console/consoleauth/claims.go +++ b/satellite/console/consoleauth/claims.go @@ -8,7 +8,7 @@ import ( "encoding/json" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) //TODO: change to JWT or Macaroon based auth diff --git a/satellite/console/consoleauth/claims_test.go b/satellite/console/consoleauth/claims_test.go index 93d2d8b7a..016a17313 100644 --- a/satellite/console/consoleauth/claims_test.go +++ b/satellite/console/consoleauth/claims_test.go @@ -13,7 +13,7 @@ import ( ) func TestClaims(t *testing.T) { - id := testrand.UUID() + id := testrand.UUID2() claims := Claims{ ID: id, diff --git a/satellite/console/consoleweb/consoleapi/auth.go b/satellite/console/consoleweb/consoleapi/auth.go index 987a8df88..15000e001 100644 --- a/satellite/console/consoleweb/consoleapi/auth.go +++ b/satellite/console/consoleweb/consoleapi/auth.go @@ -8,10 +8,10 @@ import ( "net/http" "github.com/gorilla/mux" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "go.uber.org/zap" + "storj.io/common/uuid" "storj.io/storj/private/post" "storj.io/storj/satellite/console" "storj.io/storj/satellite/console/consoleweb/consoleql" diff --git a/satellite/console/consoleweb/consoleql/mutation.go b/satellite/console/consoleweb/consoleql/mutation.go index b161c3ff1..6ec090c00 100644 --- a/satellite/console/consoleweb/consoleql/mutation.go +++ b/satellite/console/consoleweb/consoleql/mutation.go @@ -5,9 +5,9 @@ package consoleql import ( "github.com/graphql-go/graphql" - "github.com/skyrings/skyring-common/tools/uuid" "go.uber.org/zap" + "storj.io/common/uuid" "storj.io/storj/private/post" "storj.io/storj/satellite/console" "storj.io/storj/satellite/mailservice" diff --git a/satellite/console/consoleweb/consoleql/mutation_test.go b/satellite/console/consoleweb/consoleql/mutation_test.go index 83195b30f..ffcaa2f3d 100644 --- a/satellite/console/consoleweb/consoleql/mutation_test.go +++ b/satellite/console/consoleweb/consoleql/mutation_test.go @@ -9,12 +9,12 @@ import ( "testing" "github.com/graphql-go/graphql" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" "storj.io/common/testcontext" + "storj.io/common/uuid" "storj.io/storj/pkg/auth" "storj.io/storj/private/post" "storj.io/storj/satellite" diff --git a/satellite/console/consoleweb/consoleql/query.go b/satellite/console/consoleweb/consoleql/query.go index 4f0f99637..2444fce84 100644 --- a/satellite/console/consoleweb/consoleql/query.go +++ b/satellite/console/consoleweb/consoleql/query.go @@ -5,8 +5,8 @@ package consoleql import ( "github.com/graphql-go/graphql" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" "storj.io/storj/satellite/console" "storj.io/storj/satellite/mailservice" "storj.io/storj/satellite/rewards" diff --git a/satellite/console/consoleweb/server.go b/satellite/console/consoleweb/server.go index 931db9e41..d964ef1ce 100644 --- a/satellite/console/consoleweb/server.go +++ b/satellite/console/consoleweb/server.go @@ -22,12 +22,12 @@ import ( "github.com/gorilla/mux" "github.com/graphql-go/graphql" "github.com/graphql-go/graphql/gqlerrors" - "github.com/skyrings/skyring-common/tools/uuid" monkit "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" "golang.org/x/sync/errgroup" + "storj.io/common/uuid" "storj.io/storj/pkg/auth" "storj.io/storj/satellite/console" "storj.io/storj/satellite/console/consoleweb/consoleapi" diff --git a/satellite/console/projectmembers.go b/satellite/console/projectmembers.go index 01c06f2e0..b70883724 100644 --- a/satellite/console/projectmembers.go +++ b/satellite/console/projectmembers.go @@ -7,7 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // ProjectMembers exposes methods to manage ProjectMembers table in database. diff --git a/satellite/console/projectmembers_test.go b/satellite/console/projectmembers_test.go index 36bc953a7..8ec201b44 100644 --- a/satellite/console/projectmembers_test.go +++ b/satellite/console/projectmembers_test.go @@ -26,7 +26,7 @@ func TestProjectMembersRepository(t *testing.T) { createdUsers, createdProjects := prepareUsersAndProjects(ctx, t, users, projects) t.Run("Can't insert projectMember without memberID", func(t *testing.T) { - missingUserID := testrand.UUID() + missingUserID := testrand.UUID2() projMember, err := projectMembers.Insert(ctx, missingUserID, createdProjects[0].ID) assert.Nil(t, projMember) @@ -34,7 +34,7 @@ func TestProjectMembersRepository(t *testing.T) { }) t.Run("Can't insert projectMember without projectID", func(t *testing.T) { - missingProjectID := testrand.UUID() + missingProjectID := testrand.UUID2() projMember, err := projectMembers.Insert(ctx, createdUsers[0].ID, missingProjectID) assert.Nil(t, projMember) @@ -156,37 +156,37 @@ func TestProjectMembersRepository(t *testing.T) { func prepareUsersAndProjects(ctx context.Context, t *testing.T, users console.Users, projects console.Projects) ([]*console.User, []*console.Project) { usersList := []*console.User{{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Email: "2email2@mail.test", PasswordHash: []byte("some_readable_hash"), ShortName: "Liam", FullName: "Liam Jameson", }, { - ID: testrand.UUID(), + ID: testrand.UUID2(), Email: "1email1@mail.test", PasswordHash: []byte("some_readable_hash"), ShortName: "William", FullName: "Noahson William", }, { - ID: testrand.UUID(), + ID: testrand.UUID2(), Email: "email3@mail.test", PasswordHash: []byte("some_readable_hash"), ShortName: "Mason", FullName: "Mason Elijahson", }, { - ID: testrand.UUID(), + ID: testrand.UUID2(), Email: "email4@mail.test", PasswordHash: []byte("some_readable_hash"), ShortName: "Oliver", FullName: "Oliver Jacobson", }, { - ID: testrand.UUID(), + ID: testrand.UUID2(), Email: "email5@mail.test", PasswordHash: []byte("some_readable_hash"), ShortName: "Lucas", FullName: "Michaelson Lucas", }, { - ID: testrand.UUID(), + ID: testrand.UUID2(), Email: "email6@mail.test", PasswordHash: []byte("some_readable_hash"), ShortName: "Alexander", diff --git a/satellite/console/projects.go b/satellite/console/projects.go index 282201b32..6b159fb0b 100644 --- a/satellite/console/projects.go +++ b/satellite/console/projects.go @@ -7,7 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // Projects exposes methods to manage Project table in database. diff --git a/satellite/console/projects_test.go b/satellite/console/projects_test.go index 4df09e8d2..a06f835ac 100644 --- a/satellite/console/projects_test.go +++ b/satellite/console/projects_test.go @@ -44,7 +44,7 @@ func TestProjectsRepository(t *testing.T) { t.Run("Insert project successfully", func(t *testing.T) { var err error owner, err = users.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: userFullName, ShortName: shortName, Email: email, @@ -53,7 +53,7 @@ func TestProjectsRepository(t *testing.T) { require.NoError(t, err) require.NotNil(t, owner) owner, err := users.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: userFullName, ShortName: shortName, Email: email, @@ -178,7 +178,7 @@ func TestProjectsList(t *testing.T) { // create owner owner, err := db.Console().Users().Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "Billy H", Email: "billyh@example.com", PasswordHash: []byte("example_password"), diff --git a/satellite/console/registrationtoken.go b/satellite/console/registrationtoken.go index f509e6eaa..b98ad24b0 100644 --- a/satellite/console/registrationtoken.go +++ b/satellite/console/registrationtoken.go @@ -10,8 +10,9 @@ import ( "encoding/base64" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + + "storj.io/common/uuid" ) // RegistrationTokens is interface for working with registration tokens diff --git a/satellite/console/resetpasswordtoken.go b/satellite/console/resetpasswordtoken.go index 78dc7e0ba..ba89adea4 100644 --- a/satellite/console/resetpasswordtoken.go +++ b/satellite/console/resetpasswordtoken.go @@ -9,8 +9,9 @@ import ( "encoding/base64" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + + "storj.io/common/uuid" ) // ResetPasswordTokens is interface for working with reset password tokens diff --git a/satellite/console/resetpasswordtoken_test.go b/satellite/console/resetpasswordtoken_test.go index fc3904903..70d301bf4 100644 --- a/satellite/console/resetpasswordtoken_test.go +++ b/satellite/console/resetpasswordtoken_test.go @@ -35,7 +35,7 @@ func TestNewRegistrationSecret(t *testing.T) { t.Run("Insert reset password token successfully", func(t *testing.T) { var err error owner, err = users.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: userFullName, ShortName: shortName, Email: email, diff --git a/satellite/console/service.go b/satellite/console/service.go index 27aa6ba3e..6acc4d25e 100644 --- a/satellite/console/service.go +++ b/satellite/console/service.go @@ -11,7 +11,6 @@ import ( "sort" "time" - "github.com/skyrings/skyring-common/tools/uuid" monkit "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" @@ -19,6 +18,7 @@ import ( "storj.io/common/macaroon" "storj.io/common/memory" + "storj.io/common/uuid" "storj.io/storj/pkg/auth" "storj.io/storj/satellite/accounting" "storj.io/storj/satellite/console/consoleauth" @@ -450,7 +450,7 @@ func (s *Service) CreateUser(ctx context.Context, user CreateUser, tokenSecret R } newUser := &User{ - ID: *userID, + ID: userID, Email: user.Email, FullName: user.FullName, ShortName: user.ShortName, diff --git a/satellite/console/usercredits.go b/satellite/console/usercredits.go index d63119283..8a6ca0ea6 100644 --- a/satellite/console/usercredits.go +++ b/satellite/console/usercredits.go @@ -7,9 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/currency" "storj.io/storj/satellite/rewards" ) diff --git a/satellite/console/usercredits_test.go b/satellite/console/usercredits_test.go index e2c2d3b93..110dc4fb4 100644 --- a/satellite/console/usercredits_test.go +++ b/satellite/console/usercredits_test.go @@ -25,7 +25,7 @@ func TestUserCredits(t *testing.T) { consoleDB := db.Console() user, referrer, activeOffer, defaultOffer := setupData(ctx, t, db) - randomID := testrand.UUID() + randomID := testrand.UUID2() invalidOffer := rewards.Offer{ ID: 10, } @@ -290,7 +290,7 @@ func setupData(ctx context.Context, t *testing.T, db satellite.DB) (user *consol // create an user user, err = consoleDB.Users().Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "John Doe", Email: "john@mail.test", PasswordHash: userPassHash, @@ -300,7 +300,7 @@ func setupData(ctx context.Context, t *testing.T, db satellite.DB) (user *consol //create an user as referrer referrer, err = consoleDB.Users().Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "referrer", Email: "referrer@mail.test", PasswordHash: referrerPassHash, diff --git a/satellite/console/users.go b/satellite/console/users.go index cb2edab66..a4969aa96 100644 --- a/satellite/console/users.go +++ b/satellite/console/users.go @@ -8,7 +8,7 @@ import ( "net/mail" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // Users exposes methods to manage User table in database. diff --git a/satellite/console/users_test.go b/satellite/console/users_test.go index 37b09aa9f..c9a2129c1 100644 --- a/satellite/console/users_test.go +++ b/satellite/console/users_test.go @@ -32,11 +32,11 @@ const ( func TestUserRepository(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { repository := db.Console().Users() - partnerID := testrand.UUID() + partnerID := testrand.UUID2() // Test with and without partnerID user := &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: name, ShortName: lastName, Email: email, @@ -47,7 +47,7 @@ func TestUserRepository(t *testing.T) { testUsers(ctx, t, repository, user) user = &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: name, ShortName: lastName, Email: email, @@ -72,7 +72,7 @@ func TestUserEmailCase(t *testing.T) { {email: "_______@domain.com "}, } { newUser := &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: newName, ShortName: newLastName, Email: testCase.email, diff --git a/satellite/inspector/inspector.go b/satellite/inspector/inspector.go index 10dd3039f..d4e02755d 100644 --- a/satellite/inspector/inspector.go +++ b/satellite/inspector/inspector.go @@ -7,13 +7,13 @@ import ( "context" "strconv" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" "storj.io/common/pb" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/satellite/metainfo" "storj.io/storj/satellite/overlay" ) diff --git a/satellite/metainfo/attribution.go b/satellite/metainfo/attribution.go index 2bdfa1f86..d93813c96 100644 --- a/satellite/metainfo/attribution.go +++ b/satellite/metainfo/attribution.go @@ -7,11 +7,10 @@ import ( "context" "strings" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/pb" "storj.io/common/rpc/rpcstatus" "storj.io/common/useragent" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" ) diff --git a/satellite/metainfo/attribution_test.go b/satellite/metainfo/attribution_test.go index 8b789a4f9..a8766af41 100644 --- a/satellite/metainfo/attribution_test.go +++ b/satellite/metainfo/attribution_test.go @@ -6,12 +6,12 @@ package metainfo_test import ( "testing" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/require" "storj.io/common/pb" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/testplanet" ) @@ -32,7 +32,7 @@ func TestResolvePartnerID(t *testing.T) { _, err = endpoint.ResolvePartnerID(ctx, &pb.RequestHeader{}, []byte{1, 2, 3}) require.Error(t, err) - randomUUID := testrand.UUID() + randomUUID := testrand.UUID2() // good uuid result, err := endpoint.ResolvePartnerID(ctx, &pb.RequestHeader{}, randomUUID[:]) diff --git a/satellite/metainfo/db.go b/satellite/metainfo/db.go index 39c00d2eb..162ea6a14 100644 --- a/satellite/metainfo/db.go +++ b/satellite/metainfo/db.go @@ -6,10 +6,9 @@ package metainfo import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/macaroon" "storj.io/common/storj" + "storj.io/common/uuid" ) // BucketsDB is the interface for the database to interact with buckets diff --git a/satellite/metainfo/db_test.go b/satellite/metainfo/db_test.go index 4bb7a9c0d..695344118 100644 --- a/satellite/metainfo/db_test.go +++ b/satellite/metainfo/db_test.go @@ -6,13 +6,13 @@ package metainfo_test import ( "testing" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/require" "storj.io/common/macaroon" "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/satellitedbtest" @@ -20,9 +20,9 @@ import ( func newTestBucket(name string, projectID uuid.UUID) storj.Bucket { return storj.Bucket{ - ID: testrand.UUID(), + ID: storj.DeprecatedUUID(testrand.UUID2()), Name: name, - ProjectID: projectID, + ProjectID: storj.DeprecatedUUID(projectID), PathCipher: storj.EncAESGCM, DefaultSegmentsSize: 65536, DefaultRedundancyScheme: storj.RedundancyScheme{ diff --git a/satellite/metainfo/endpoint_test.go b/satellite/metainfo/endpoint_test.go index 5301c0e74..c6c268d26 100644 --- a/satellite/metainfo/endpoint_test.go +++ b/satellite/metainfo/endpoint_test.go @@ -8,7 +8,6 @@ import ( "strconv" "testing" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/require" "storj.io/common/memory" @@ -16,6 +15,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/testplanet" "storj.io/storj/satellite/metainfo" "storj.io/storj/storage" diff --git a/satellite/metainfo/loop.go b/satellite/metainfo/loop.go index 7f3c07780..12766bd80 100644 --- a/satellite/metainfo/loop.go +++ b/satellite/metainfo/loop.go @@ -9,13 +9,13 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "golang.org/x/time/rate" "storj.io/common/pb" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/storage" ) diff --git a/satellite/metainfo/metainfo.go b/satellite/metainfo/metainfo.go index 482085646..a27aff1bf 100644 --- a/satellite/metainfo/metainfo.go +++ b/satellite/metainfo/metainfo.go @@ -12,7 +12,6 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" @@ -23,6 +22,7 @@ import ( "storj.io/common/rpc/rpcstatus" "storj.io/common/signing" "storj.io/common/storj" + "storj.io/common/uuid" lrucache "storj.io/storj/pkg/cache" "storj.io/storj/pkg/macaroon" "storj.io/storj/satellite/accounting" @@ -898,7 +898,7 @@ func (endpoint *Endpoint) setBucketAttribution(ctx context.Context, header *pb.R } // update bucket information - bucket.PartnerID = partnerID + bucket.PartnerID = storj.DeprecatedUUID(partnerID) _, err = endpoint.metainfo.UpdateBucket(ctx, bucket) if err != nil { endpoint.log.Error("error while updating bucket", zap.ByteString("bucketName", bucketName), zap.Error(err)) @@ -939,10 +939,10 @@ func convertProtoToBucket(req *pb.BucketCreateRequest, projectID uuid.UUID) (buc } return storj.Bucket{ - ID: *bucketID, + ID: storj.DeprecatedUUID(bucketID), Name: string(req.GetName()), - ProjectID: projectID, - PartnerID: partnerID, + ProjectID: storj.DeprecatedUUID(projectID), + PartnerID: storj.DeprecatedUUID(partnerID), PathCipher: storj.CipherSuite(req.GetPathCipher()), DefaultSegmentsSize: req.GetDefaultSegmentSize(), DefaultRedundancyScheme: storj.RedundancyScheme{ diff --git a/satellite/metainfo/metainfo_test.go b/satellite/metainfo/metainfo_test.go index 7adc1d9ce..63b5098a9 100644 --- a/satellite/metainfo/metainfo_test.go +++ b/satellite/metainfo/metainfo_test.go @@ -280,11 +280,11 @@ func TestSetBucketAttribution(t *testing.T) { require.NoError(t, err) defer ctx.Check(metainfoClient.Close) - partnerID := testrand.UUID() + partnerID := testrand.UUID2() { // bucket with no items err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ Bucket: "alpha", - PartnerID: partnerID, + PartnerID: storj.DeprecatedUUID(partnerID), }) require.NoError(t, err) } @@ -292,7 +292,7 @@ func TestSetBucketAttribution(t *testing.T) { { // setting attribution on a bucket that doesn't exist should fail err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ Bucket: "beta", - PartnerID: partnerID, + PartnerID: storj.DeprecatedUUID(partnerID), }) require.Error(t, err) } @@ -304,7 +304,7 @@ func TestSetBucketAttribution(t *testing.T) { // trying to set attribution should be ignored err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ Bucket: "alpha", - PartnerID: partnerID, + PartnerID: storj.DeprecatedUUID(partnerID), }) require.NoError(t, err) } @@ -316,7 +316,7 @@ func TestSetBucketAttribution(t *testing.T) { // bucket with items err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ Bucket: "alpha-new", - PartnerID: partnerID, + PartnerID: storj.DeprecatedUUID(partnerID), }) require.Error(t, err) } @@ -499,7 +499,7 @@ func TestBeginCommitListSegment(t *testing.T) { bucket := storj.Bucket{ Name: "initial-bucket", - ProjectID: projectID, + ProjectID: storj.DeprecatedUUID(projectID), PathCipher: config.GetEncryptionParameters().CipherSuite, } _, err = metainfoService.CreateBucket(ctx, bucket) @@ -694,7 +694,7 @@ func TestInlineSegment(t *testing.T) { bucket := storj.Bucket{ Name: "inline-segments-bucket", - ProjectID: projectID, + ProjectID: storj.DeprecatedUUID(projectID), PathCipher: config.GetEncryptionParameters().CipherSuite, } _, err = metainfoService.CreateBucket(ctx, bucket) diff --git a/satellite/metainfo/service.go b/satellite/metainfo/service.go index 27c7ff735..58745bb9a 100644 --- a/satellite/metainfo/service.go +++ b/satellite/metainfo/service.go @@ -8,13 +8,13 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "go.uber.org/zap" "storj.io/common/macaroon" "storj.io/common/pb" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/storage" "storj.io/uplink/private/storage/meta" ) diff --git a/satellite/metainfo/validation.go b/satellite/metainfo/validation.go index 57a71e121..8d3ddb70f 100644 --- a/satellite/metainfo/validation.go +++ b/satellite/metainfo/validation.go @@ -11,7 +11,6 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "go.uber.org/zap" "golang.org/x/time/rate" @@ -21,6 +20,7 @@ import ( "storj.io/common/pb" "storj.io/common/rpc/rpcstatus" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/pkg/auth" "storj.io/storj/satellite/console" ) diff --git a/satellite/orders/endpoint.go b/satellite/orders/endpoint.go index d726d4ec4..53705e19f 100644 --- a/satellite/orders/endpoint.go +++ b/satellite/orders/endpoint.go @@ -10,7 +10,6 @@ import ( "sort" "time" - "github.com/skyrings/skyring-common/tools/uuid" monkit "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" @@ -21,6 +20,7 @@ import ( "storj.io/common/rpc/rpcstatus" "storj.io/common/signing" "storj.io/common/storj" + "storj.io/common/uuid" ) // DB implements saving order after receiving from storage node diff --git a/satellite/orders/orders_test.go b/satellite/orders/orders_test.go index aecbb9cd4..1232df2c2 100644 --- a/satellite/orders/orders_test.go +++ b/satellite/orders/orders_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" @@ -19,6 +18,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/testplanet" "storj.io/storj/satellite" "storj.io/storj/satellite/accounting/reportedrollup" @@ -396,7 +396,7 @@ func TestLargeOrderLimit(t *testing.T) { require.NoError(t, chore.RunOnce(ctx, now)) // check only the bandwidth we've used is taken into account - bucketBandwidth, err := ordersDB.GetBucketBandwidth(ctx, *projectID, []byte("b"), beforeRollup, afterRollup) + bucketBandwidth, err := ordersDB.GetBucketBandwidth(ctx, projectID, []byte("b"), beforeRollup, afterRollup) require.NoError(t, err) require.Equal(t, int64(100), bucketBandwidth) @@ -422,7 +422,7 @@ func TestProcessOrders(t *testing.T) { // assertion helpers checkBucketBandwidth := func(bucket string, amount int64) { - settled, err := ordersDB.GetBucketBandwidth(ctx, *projectID, []byte(bucket), beforeRollup, afterRollup) + settled, err := ordersDB.GetBucketBandwidth(ctx, projectID, []byte(bucket), beforeRollup, afterRollup) require.NoError(t, err) require.Equal(t, amount, settled) } @@ -656,7 +656,7 @@ func TestProcessOrders_DoubleSend(t *testing.T) { // assertion helpers checkBucketBandwidth := func(bucket string, amount int64) { - settled, err := ordersDB.GetBucketBandwidth(ctx, *projectID, []byte(bucket), beforeRollup, afterRollup) + settled, err := ordersDB.GetBucketBandwidth(ctx, projectID, []byte(bucket), beforeRollup, afterRollup) require.NoError(t, err) require.Equal(t, amount, settled) } diff --git a/satellite/orders/rollups_write_cache.go b/satellite/orders/rollups_write_cache.go index 8a86861f5..4d8750133 100644 --- a/satellite/orders/rollups_write_cache.go +++ b/satellite/orders/rollups_write_cache.go @@ -8,11 +8,11 @@ import ( "sync" "time" - "github.com/skyrings/skyring-common/tools/uuid" "go.uber.org/zap" "storj.io/common/pb" "storj.io/common/sync2" + "storj.io/common/uuid" ) // CacheData stores the amount of inline and allocated data diff --git a/satellite/orders/rollups_write_cache_test.go b/satellite/orders/rollups_write_cache_test.go index 52974c245..5f7932710 100644 --- a/satellite/orders/rollups_write_cache_test.go +++ b/satellite/orders/rollups_write_cache_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" @@ -18,6 +17,7 @@ import ( "storj.io/common/pb" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/private/testplanet" "storj.io/storj/satellite" "storj.io/storj/satellite/accounting" @@ -42,7 +42,7 @@ func TestRollupsWriteCacheBatchLimitReached(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { useBatchSize := 10 amount := (memory.MB * 500).Int64() - projectID := testrand.UUID() + projectID := testrand.UUID2() startTime := time.Now() rwc := orders.NewRollupsWriteCache(zaptest.NewLogger(t), db.Orders(), useBatchSize) @@ -89,7 +89,7 @@ func TestRollupsWriteCacheBatchChore(t *testing.T) { func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) { useBatchSize := 10 amount := (memory.MB * 500).Int64() - projectID := testrand.UUID() + projectID := testrand.UUID2() startTime := time.Now() planet.Satellites[0].Orders.Chore.Loop.Pause() @@ -145,7 +145,7 @@ func TestUpdateBucketBandwidthAllocation(t *testing.T) { require.Equal(t, size, 0) // setup: add one item to the cache - projectID := testrand.UUID() + projectID := testrand.UUID2() bucketName := []byte("testbucketname") amount := (memory.MB * 500).Int64() err := ordersDB.UpdateBucketBandwidthAllocation(ctx, projectID, bucketName, pb.PieceAction_GET, amount, time.Now()) @@ -169,7 +169,7 @@ func TestUpdateBucketBandwidthAllocation(t *testing.T) { require.Equal(t, projectMap, expected) // setup: add another item to the cache but with a different projectID - projectID2 := testrand.UUID() + projectID2 := testrand.UUID2() amount2 := (memory.MB * 10).Int64() err = ordersDB.UpdateBucketBandwidthAllocation(ctx, projectID2, bucketName, pb.PieceAction_GET, amount2, time.Now()) require.NoError(t, err) diff --git a/satellite/orders/service.go b/satellite/orders/service.go index f4cb11d9e..2b3880cb9 100644 --- a/satellite/orders/service.go +++ b/satellite/orders/service.go @@ -11,13 +11,13 @@ import ( "sync" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "go.uber.org/zap" "storj.io/common/pb" "storj.io/common/signing" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/satellite/overlay" "storj.io/uplink/private/eestream" ) @@ -82,7 +82,7 @@ func (service *Service) createSerial(ctx context.Context) (_ storj.SerialNumber, if err != nil { return storj.SerialNumber{}, Error.Wrap(err) } - return storj.SerialNumber(*id), nil + return storj.SerialNumber(id), nil } func (service *Service) saveSerial(ctx context.Context, serialNumber storj.SerialNumber, bucketID []byte, expiresAt time.Time) (err error) { diff --git a/satellite/payments/account.go b/satellite/payments/account.go index fcd0da365..e53e84b74 100644 --- a/satellite/payments/account.go +++ b/satellite/payments/account.go @@ -7,8 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + + "storj.io/common/uuid" ) // ErrAccountNotSetup is an error type which indicates that payment account is not created. diff --git a/satellite/payments/coupons.go b/satellite/payments/coupons.go index 9a7085c57..882f5e4c6 100644 --- a/satellite/payments/coupons.go +++ b/satellite/payments/coupons.go @@ -7,9 +7,8 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/memory" + "storj.io/common/uuid" ) // Coupons exposes all needed functionality to manage coupons. diff --git a/satellite/payments/creditcards.go b/satellite/payments/creditcards.go index f011276be..83b9262bb 100644 --- a/satellite/payments/creditcards.go +++ b/satellite/payments/creditcards.go @@ -6,7 +6,7 @@ package payments import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // CreditCards exposes all needed functionality to manage account credit cards. diff --git a/satellite/payments/credits.go b/satellite/payments/credits.go index f08b0d4b9..ae7575d5b 100644 --- a/satellite/payments/credits.go +++ b/satellite/payments/credits.go @@ -7,8 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" - + "storj.io/common/uuid" "storj.io/storj/satellite/payments/coinpayments" ) diff --git a/satellite/payments/invoices.go b/satellite/payments/invoices.go index 2cea7c810..02b91a9f3 100644 --- a/satellite/payments/invoices.go +++ b/satellite/payments/invoices.go @@ -7,7 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // Invoices exposes all needed functionality to manage account invoices. diff --git a/satellite/payments/mockpayments/mockpayments.go b/satellite/payments/mockpayments/mockpayments.go index 5b89feeff..0f1e0105e 100644 --- a/satellite/payments/mockpayments/mockpayments.go +++ b/satellite/payments/mockpayments/mockpayments.go @@ -7,11 +7,11 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "storj.io/common/memory" + "storj.io/common/uuid" "storj.io/storj/satellite/payments" ) diff --git a/satellite/payments/projectcharges.go b/satellite/payments/projectcharges.go index 4c401c6a7..f09787228 100644 --- a/satellite/payments/projectcharges.go +++ b/satellite/payments/projectcharges.go @@ -4,8 +4,7 @@ package payments import ( - "github.com/skyrings/skyring-common/tools/uuid" - + "storj.io/common/uuid" "storj.io/storj/satellite/accounting" ) diff --git a/satellite/payments/stripecoinpayments/accounts.go b/satellite/payments/stripecoinpayments/accounts.go index abd51beb5..5359236d1 100644 --- a/satellite/payments/stripecoinpayments/accounts.go +++ b/satellite/payments/stripecoinpayments/accounts.go @@ -7,9 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stripe/stripe-go" + "storj.io/common/uuid" "storj.io/storj/satellite/payments" ) diff --git a/satellite/payments/stripecoinpayments/coupons.go b/satellite/payments/stripecoinpayments/coupons.go index 177c22991..b8122ffea 100644 --- a/satellite/payments/stripecoinpayments/coupons.go +++ b/satellite/payments/stripecoinpayments/coupons.go @@ -7,10 +7,10 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stripe/stripe-go" "storj.io/common/memory" + "storj.io/common/uuid" "storj.io/storj/satellite/payments" ) diff --git a/satellite/payments/stripecoinpayments/coupons_test.go b/satellite/payments/stripecoinpayments/coupons_test.go index e38298e78..c74ce98a3 100644 --- a/satellite/payments/stripecoinpayments/coupons_test.go +++ b/satellite/payments/stripecoinpayments/coupons_test.go @@ -7,12 +7,12 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/require" "storj.io/common/memory" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/console" "storj.io/storj/satellite/payments" @@ -28,8 +28,8 @@ func TestCouponRepository(t *testing.T) { Amount: 10, Status: payments.CouponActive, Description: "description", - ProjectID: testrand.UUID(), - UserID: testrand.UUID(), + ProjectID: testrand.UUID2(), + UserID: testrand.UUID2(), } now := time.Now().UTC() @@ -112,7 +112,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // activated user with 2 project. New coupon should be added to the first project. user1, err := usersRepo.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "user1", ShortName: "", Email: "test1@example.com", @@ -127,7 +127,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // activated user with proj. New coupon should be added. user2, err := usersRepo.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "user2", ShortName: "", Email: "test2@example.com", @@ -142,7 +142,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // activated user without proj. New coupon should not be added. user3, err := usersRepo.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "user3", ShortName: "", Email: "test3@example.com", @@ -157,7 +157,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // inactive user. New coupon should not be added. user4, err := usersRepo.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "user4", ShortName: "", Email: "test4@example.com", @@ -167,7 +167,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // activated user with proj and coupon. New coupon should not be added. user5, err := usersRepo.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "user5", ShortName: "", Email: "test5@example.com", @@ -182,7 +182,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // creating projects for users above. proj1, err := projectsRepo.Insert(ctx, &console.Project{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Name: "proj 1 of user 1", Description: "descr 1", OwnerID: user1.ID, @@ -191,7 +191,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // should not be processed as we takes only first project of the user. proj2, err := projectsRepo.Insert(ctx, &console.Project{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Name: "proj 2 of user 1", Description: "descr 2", OwnerID: user1.ID, @@ -199,7 +199,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { require.NoError(t, err) proj3, err := projectsRepo.Insert(ctx, &console.Project{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Name: "proj 1 of user 2", Description: "descr 3", OwnerID: user2.ID, @@ -207,14 +207,14 @@ func TestPopulatePromotionalCoupons(t *testing.T) { require.NoError(t, err) proj4, err := projectsRepo.Insert(ctx, &console.Project{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Name: "proj 1 of user 5", Description: "descr 4", OwnerID: user5.ID, }) require.NoError(t, err) - couponID := testrand.UUID() + couponID := testrand.UUID2() err = couponsRepo.Insert(ctx, payments.Coupon{ ID: couponID, UserID: user5.ID, @@ -229,7 +229,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { // creating new users and projects to test that multiple execution of populate method wont generate extra coupons. user6, err := usersRepo.Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "user6", ShortName: "", Email: "test6@example.com", @@ -243,7 +243,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) { require.NoError(t, err) proj5, err := projectsRepo.Insert(ctx, &console.Project{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Name: "proj 1 of user 6", Description: "descr 6", OwnerID: user6.ID, diff --git a/satellite/payments/stripecoinpayments/creditcards.go b/satellite/payments/stripecoinpayments/creditcards.go index 25ccb08ea..8f5f4ce00 100644 --- a/satellite/payments/stripecoinpayments/creditcards.go +++ b/satellite/payments/stripecoinpayments/creditcards.go @@ -6,10 +6,10 @@ package stripecoinpayments import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stripe/stripe-go" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/satellite/payments" ) diff --git a/satellite/payments/stripecoinpayments/credits.go b/satellite/payments/stripecoinpayments/credits.go index 78e6dfcd1..8381e6ae1 100644 --- a/satellite/payments/stripecoinpayments/credits.go +++ b/satellite/payments/stripecoinpayments/credits.go @@ -7,8 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" - + "storj.io/common/uuid" "storj.io/storj/satellite/payments" "storj.io/storj/satellite/payments/coinpayments" ) diff --git a/satellite/payments/stripecoinpayments/credits_test.go b/satellite/payments/stripecoinpayments/credits_test.go index 9f93621f0..08a9dd0e5 100644 --- a/satellite/payments/stripecoinpayments/credits_test.go +++ b/satellite/payments/stripecoinpayments/credits_test.go @@ -8,12 +8,12 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/payments" "storj.io/storj/satellite/payments/coinpayments" @@ -24,7 +24,7 @@ import ( func TestCreditsRepository(t *testing.T) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { creditsRepo := db.StripeCoinPayments().Credits() - userID := testrand.UUID() + userID := testrand.UUID2() credit := payments.Credit{ UserID: userID, Amount: 10, @@ -32,7 +32,7 @@ func TestCreditsRepository(t *testing.T) { } spending := stripecoinpayments.CreditsSpending{ - ProjectID: testrand.UUID(), + ProjectID: testrand.UUID2(), UserID: userID, Amount: 5, Status: stripecoinpayments.CreditsSpendingStatusUnapplied, @@ -95,9 +95,9 @@ func TestCreditsRepositoryList(t *testing.T) { require.NoError(t, err) spending := stripecoinpayments.CreditsSpending{ - ID: *spendingID, - ProjectID: *projectID, - UserID: *userID, + ID: spendingID, + ProjectID: projectID, + UserID: userID, Amount: int64(5 + i), Status: 0, } @@ -136,7 +136,7 @@ func TestCreditsRepositoryList(t *testing.T) { transactionID := "transID" + strconv.Itoa(i) credit := payments.Credit{ - UserID: *user2ID, + UserID: user2ID, Amount: 5, TransactionID: coinpayments.TransactionID(transactionID), } @@ -145,21 +145,21 @@ func TestCreditsRepositoryList(t *testing.T) { require.NoError(t, err) } - page2, err := creditsDB.ListCreditsPaged(ctx, 0, spendLen, time.Now(), *user2ID) + page2, err := creditsDB.ListCreditsPaged(ctx, 0, spendLen, time.Now(), user2ID) require.NoError(t, err) require.Equal(t, spendLen, len(page2.Credits)) assert.True(t, page2.Next) assert.Equal(t, int64(5), page2.NextOffset) - page2, err = creditsDB.ListCreditsPaged(ctx, page2.NextOffset, spendLen, time.Now(), *user2ID) + page2, err = creditsDB.ListCreditsPaged(ctx, page2.NextOffset, spendLen, time.Now(), user2ID) require.NoError(t, err) require.Equal(t, spendLen, len(page2.Credits)) assert.True(t, page2.Next) assert.Equal(t, int64(10), page2.NextOffset) - page2, err = creditsDB.ListCreditsPaged(ctx, page2.NextOffset, spendLen, time.Now(), *user2ID) + page2, err = creditsDB.ListCreditsPaged(ctx, page2.NextOffset, spendLen, time.Now(), user2ID) require.NoError(t, err) require.Equal(t, 3, len(page2.Credits)) diff --git a/satellite/payments/stripecoinpayments/customers.go b/satellite/payments/stripecoinpayments/customers.go index 11e8a119f..1d0921ded 100644 --- a/satellite/payments/stripecoinpayments/customers.go +++ b/satellite/payments/stripecoinpayments/customers.go @@ -7,7 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // ErrNoCustomer is error class defining that there is no customer for user. diff --git a/satellite/payments/stripecoinpayments/customers_test.go b/satellite/payments/stripecoinpayments/customers_test.go index 3f183f3cc..3a04c9359 100644 --- a/satellite/payments/stripecoinpayments/customers_test.go +++ b/satellite/payments/stripecoinpayments/customers_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "storj.io/common/testcontext" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/payments/stripecoinpayments" "storj.io/storj/satellite/satellitedb/satellitedbtest" @@ -27,17 +27,17 @@ func TestCustomersRepository(t *testing.T) { require.NoError(t, err) t.Run("Insert", func(t *testing.T) { - err = customers.Insert(ctx, *userID, customerID) + err = customers.Insert(ctx, userID, customerID) assert.NoError(t, err) }) t.Run("Can not insert duplicate customerID", func(t *testing.T) { - err = customers.Insert(ctx, *userID, customerID) + err = customers.Insert(ctx, userID, customerID) assert.Error(t, err) }) t.Run("GetCustomerID", func(t *testing.T) { - id, err := customers.GetCustomerID(ctx, *userID) + id, err := customers.GetCustomerID(ctx, userID) assert.NoError(t, err) assert.Equal(t, id, customerID) }) @@ -56,7 +56,7 @@ func TestCustomersRepositoryList(t *testing.T) { cus := stripecoinpayments.Customer{ ID: "customerID" + strconv.Itoa(i), - UserID: *userID, + UserID: userID, } err = customersDB.Insert(ctx, cus.UserID, cus.ID) diff --git a/satellite/payments/stripecoinpayments/invoices.go b/satellite/payments/stripecoinpayments/invoices.go index 7f8d19cf8..6af1b448b 100644 --- a/satellite/payments/stripecoinpayments/invoices.go +++ b/satellite/payments/stripecoinpayments/invoices.go @@ -7,9 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stripe/stripe-go" + "storj.io/common/uuid" "storj.io/storj/satellite/payments" ) diff --git a/satellite/payments/stripecoinpayments/projectrecords.go b/satellite/payments/stripecoinpayments/projectrecords.go index 6aa90588b..fb0bbf320 100644 --- a/satellite/payments/stripecoinpayments/projectrecords.go +++ b/satellite/payments/stripecoinpayments/projectrecords.go @@ -7,7 +7,7 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // ErrProjectRecordExists is error class defining that such project record already exists. diff --git a/satellite/payments/stripecoinpayments/projectrecords_test.go b/satellite/payments/stripecoinpayments/projectrecords_test.go index 6eef3f1d2..38bfc02eb 100644 --- a/satellite/payments/stripecoinpayments/projectrecords_test.go +++ b/satellite/payments/stripecoinpayments/projectrecords_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "storj.io/common/testcontext" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/payments/stripecoinpayments" "storj.io/storj/satellite/satellitedb/satellitedbtest" @@ -33,7 +33,7 @@ func TestProjectRecords(t *testing.T) { err = projectRecordsDB.Create(ctx, []stripecoinpayments.CreateProjectRecord{ { - ProjectID: *prjID, + ProjectID: prjID, Storage: 1, Egress: 2, Objects: 3, @@ -47,7 +47,7 @@ func TestProjectRecords(t *testing.T) { }) t.Run("check", func(t *testing.T) { - err = projectRecordsDB.Check(ctx, *prjID, start, end) + err = projectRecordsDB.Check(ctx, prjID, start, end) require.Error(t, err) assert.Equal(t, stripecoinpayments.ErrProjectRecordExists, err) }) @@ -86,7 +86,7 @@ func TestProjectRecordsList(t *testing.T) { createProjectRecords = append(createProjectRecords, stripecoinpayments.CreateProjectRecord{ - ProjectID: *projID, + ProjectID: projID, Storage: float64(i) + 1, Egress: int64(i) + 2, Objects: float64(i) + 3, diff --git a/satellite/payments/stripecoinpayments/service.go b/satellite/payments/stripecoinpayments/service.go index 6d1b0fc4f..f295a1b78 100644 --- a/satellite/payments/stripecoinpayments/service.go +++ b/satellite/payments/stripecoinpayments/service.go @@ -11,7 +11,6 @@ import ( "time" "github.com/shopspring/decimal" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/stripe/stripe-go" "github.com/stripe/stripe-go/client" @@ -19,6 +18,7 @@ import ( "go.uber.org/zap" "storj.io/common/memory" + "storj.io/common/uuid" "storj.io/storj/satellite/accounting" "storj.io/storj/satellite/console" "storj.io/storj/satellite/payments" @@ -509,7 +509,7 @@ func (service *Service) createProjectRecords(ctx context.Context, projects []con } creditsSpendings = append(creditsSpendings, CreditsSpending{ - ID: *creditSpendingID, + ID: creditSpendingID, Amount: amountChargedFromBonuses, UserID: project.OwnerID, ProjectID: project.ID, diff --git a/satellite/payments/stripecoinpayments/tokens.go b/satellite/payments/stripecoinpayments/tokens.go index 830190067..f0bddf18f 100644 --- a/satellite/payments/stripecoinpayments/tokens.go +++ b/satellite/payments/stripecoinpayments/tokens.go @@ -6,8 +6,7 @@ package stripecoinpayments import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" - + "storj.io/common/uuid" "storj.io/storj/satellite/payments" "storj.io/storj/satellite/payments/coinpayments" ) diff --git a/satellite/payments/stripecoinpayments/transactions.go b/satellite/payments/stripecoinpayments/transactions.go index 44bb9dab1..e168f2c4d 100644 --- a/satellite/payments/stripecoinpayments/transactions.go +++ b/satellite/payments/stripecoinpayments/transactions.go @@ -8,9 +8,9 @@ import ( "math/big" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/satellite/payments/coinpayments" ) diff --git a/satellite/payments/stripecoinpayments/transactions_test.go b/satellite/payments/stripecoinpayments/transactions_test.go index 760ee878c..d150faa8b 100644 --- a/satellite/payments/stripecoinpayments/transactions_test.go +++ b/satellite/payments/stripecoinpayments/transactions_test.go @@ -10,7 +10,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeebo/errs" @@ -19,6 +18,7 @@ import ( "storj.io/common/memory" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/payments/coinpayments" "storj.io/storj/satellite/payments/stripecoinpayments" diff --git a/satellite/payments/tokens.go b/satellite/payments/tokens.go index 1f2f4d577..a70f92afb 100644 --- a/satellite/payments/tokens.go +++ b/satellite/payments/tokens.go @@ -8,7 +8,7 @@ import ( "math/big" "time" - "github.com/skyrings/skyring-common/tools/uuid" + "storj.io/common/uuid" ) // StorjTokens defines all payments STORJ token related functionality. diff --git a/satellite/referrals/service.go b/satellite/referrals/service.go index e54ca5433..8d0ab058f 100644 --- a/satellite/referrals/service.go +++ b/satellite/referrals/service.go @@ -6,7 +6,6 @@ package referrals import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "github.com/zeebo/errs" "go.uber.org/zap" @@ -16,6 +15,7 @@ import ( "storj.io/common/rpc" "storj.io/common/signing" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" ) @@ -120,7 +120,7 @@ func (service *Service) CreateUser(ctx context.Context, user CreateUser) (_ *con return nil, errs.Wrap(err) } - err = service.redeemToken(ctx, userID, user.ReferralToken) + err = service.redeemToken(ctx, &userID, user.ReferralToken) if err != nil { return nil, errs.Wrap(err) } @@ -131,7 +131,7 @@ func (service *Service) CreateUser(ctx context.Context, user CreateUser) (_ *con } newUser := &console.User{ - ID: *userID, + ID: userID, Email: user.Email, FullName: user.FullName, ShortName: user.ShortName, diff --git a/satellite/referrals/service_test.go b/satellite/referrals/service_test.go index aeae02758..8d291d249 100644 --- a/satellite/referrals/service_test.go +++ b/satellite/referrals/service_test.go @@ -34,7 +34,7 @@ func TestServiceSuccess(t *testing.T) { satellite := planet.Satellites[0] - userID := testrand.UUID() + userID := testrand.UUID2() tokens, err := satellite.API.Referrals.Service.GetTokens(ctx, &userID) require.NoError(t, err) require.Len(t, tokens, tokenCount) @@ -44,7 +44,7 @@ func TestServiceSuccess(t *testing.T) { ShortName: "test", Email: "test@mail.test", Password: "123a123", - ReferralToken: testrand.UUID().String(), + ReferralToken: testrand.UUID2().String(), } createdUser, err := satellite.API.Referrals.Service.CreateUser(ctx, user) @@ -74,7 +74,7 @@ func TestServiceRedeemFailure(t *testing.T) { ShortName: "test", Email: "test@mail.test", Password: "123a123", - ReferralToken: testrand.UUID().String(), + ReferralToken: testrand.UUID2().String(), } _, err := satellite.API.Referrals.Service.CreateUser(ctx, user) require.Error(t, err) diff --git a/satellite/referrals/users.go b/satellite/referrals/users.go index 590be4d69..d264d3a46 100644 --- a/satellite/referrals/users.go +++ b/satellite/referrals/users.go @@ -6,9 +6,9 @@ package referrals import ( "net/mail" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/satellite/console" ) diff --git a/satellite/repair/checker/checker_test.go b/satellite/repair/checker/checker_test.go index 256b0a234..0cdd79f80 100644 --- a/satellite/repair/checker/checker_test.go +++ b/satellite/repair/checker/checker_test.go @@ -37,7 +37,7 @@ func TestIdentifyInjuredSegments(t *testing.T) { ErasureShareSize: int32(256), } - projectID := testrand.UUID() + projectID := testrand.UUID2() pointerPathPrefix := storj.JoinPaths(projectID.String(), "l", "bucket") + "/" // add some valid pointers @@ -100,7 +100,7 @@ func TestIdentifyIrreparableSegments(t *testing.T) { expectedLostPieces[int32(i)] = true } - projectID := testrand.UUID() + projectID := testrand.UUID2() pointerPath := storj.JoinPaths(projectID.String(), "l", "bucket", "piece") pieceID := testrand.PieceID() diff --git a/satellite/rewards/partner.go b/satellite/rewards/partner.go index a3eb0c81a..698d2f313 100644 --- a/satellite/rewards/partner.go +++ b/satellite/rewards/partner.go @@ -8,8 +8,9 @@ import ( "os" "strings" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + + "storj.io/common/uuid" ) // PartnerList defines a json struct for defining partners. diff --git a/satellite/rewards/partners.go b/satellite/rewards/partners.go index abe1d141e..20e6e42b7 100644 --- a/satellite/rewards/partners.go +++ b/satellite/rewards/partners.go @@ -3,7 +3,7 @@ package rewards -import "github.com/skyrings/skyring-common/tools/uuid" +import "storj.io/common/uuid" // DefaultPartnersDB is current default settings. var DefaultPartnersDB = func() PartnersDB { diff --git a/satellite/satellitedb/apikeys.go b/satellite/satellitedb/apikeys.go index da230d368..4613cc9a0 100644 --- a/satellite/satellitedb/apikeys.go +++ b/satellite/satellitedb/apikeys.go @@ -7,9 +7,9 @@ import ( "context" "strings" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/pkg/cache" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" diff --git a/satellite/satellitedb/attribution.go b/satellite/satellitedb/attribution.go index d1758da4f..ec5d6b953 100644 --- a/satellite/satellitedb/attribution.go +++ b/satellite/satellitedb/attribution.go @@ -8,9 +8,9 @@ import ( "database/sql" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/attribution" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/attribution_test.go b/satellite/satellitedb/attribution_test.go index db402138f..37f4efc7f 100644 --- a/satellite/satellitedb/attribution_test.go +++ b/satellite/satellitedb/attribution_test.go @@ -7,12 +7,12 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/require" "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/satellite" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/satellitedbtest" @@ -27,18 +27,18 @@ func TestUsers(t *testing.T) { // create an user with partnerID _, err := consoleDB.Users().Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "John Doe", Email: "john@mail.test", PasswordHash: userPassHash, Status: console.Active, - PartnerID: testrand.UUID(), + PartnerID: testrand.UUID2(), }) require.NoError(t, err) // create an user with no partnerID _, err = consoleDB.Users().Insert(ctx, &console.User{ - ID: testrand.UUID(), + ID: testrand.UUID2(), FullName: "John Doe", Email: "john@mail.test", PasswordHash: userPassHash, @@ -48,17 +48,17 @@ func TestUsers(t *testing.T) { // create a project with partnerID _, err = consoleDB.Projects().Insert(ctx, &console.Project{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Name: "John Doe", Description: "some description", - PartnerID: testrand.UUID(), + PartnerID: testrand.UUID2(), CreatedAt: time.Now(), }) require.NoError(t, err) // create a project with no partnerID proj, err := consoleDB.Projects().Insert(ctx, &console.Project{ - ID: testrand.UUID(), + ID: testrand.UUID2(), Name: "John Doe", Description: "some description", CreatedAt: time.Now(), @@ -67,7 +67,7 @@ func TestUsers(t *testing.T) { // create a APIKey with no partnerID _, err = consoleDB.APIKeys().Create(ctx, testrand.Bytes(8), console.APIKeyInfo{ - ID: testrand.UUID(), + ID: testrand.UUID2(), ProjectID: proj.ID, Name: "John Doe", Secret: []byte("xyz"), @@ -77,9 +77,9 @@ func TestUsers(t *testing.T) { // create a bucket with no partnerID _, err = db.Buckets().CreateBucket(ctx, storj.Bucket{ - ID: testrand.UUID(), + ID: storj.DeprecatedUUID(testrand.UUID2()), Name: "testbucket", - ProjectID: proj.ID, + ProjectID: storj.DeprecatedUUID(proj.ID), Created: time.Now(), PathCipher: storj.EncAESGCM, DefaultSegmentsSize: int64(100), @@ -88,10 +88,10 @@ func TestUsers(t *testing.T) { // update a bucket with partnerID bucket, err := db.Buckets().UpdateBucket(ctx, storj.Bucket{ - ID: testrand.UUID(), + ID: storj.DeprecatedUUID(testrand.UUID2()), Name: "testbucket", - ProjectID: proj.ID, - PartnerID: proj.ID, + ProjectID: storj.DeprecatedUUID(proj.ID), + PartnerID: storj.DeprecatedUUID(proj.ID), Created: time.Now(), PathCipher: storj.EncAESGCM, DefaultSegmentsSize: int64(100), @@ -99,7 +99,7 @@ func TestUsers(t *testing.T) { require.NoError(t, err) bucket, err = db.Buckets().GetBucket(ctx, []byte("testbucket"), proj.ID) require.NoError(t, err) - flag := uuid.Equal(bucket.PartnerID, proj.ID) + flag := uuid.UUID(bucket.PartnerID) == proj.ID require.True(t, flag) }) } diff --git a/satellite/satellitedb/buckets.go b/satellite/satellitedb/buckets.go index 10577279f..6ee427876 100644 --- a/satellite/satellitedb/buckets.go +++ b/satellite/satellitedb/buckets.go @@ -8,10 +8,9 @@ import ( "database/sql" "errors" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/macaroon" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/metainfo" "storj.io/storj/satellite/satellitedb/dbx" @@ -202,9 +201,9 @@ func convertDBXtoBucket(dbxBucket *dbx.BucketMetainfo) (bucket storj.Bucket, err } bucket = storj.Bucket{ - ID: id, + ID: storj.DeprecatedUUID(id), Name: string(dbxBucket.Name), - ProjectID: project, + ProjectID: storj.DeprecatedUUID(project), Created: dbxBucket.CreatedAt, PathCipher: storj.CipherSuite(dbxBucket.PathCipher), DefaultSegmentsSize: int64(dbxBucket.DefaultSegmentSize), @@ -227,7 +226,7 @@ func convertDBXtoBucket(dbxBucket *dbx.BucketMetainfo) (bucket storj.Bucket, err if err != nil { return bucket, storj.ErrBucket.Wrap(err) } - bucket.PartnerID = partnerID + bucket.PartnerID = storj.DeprecatedUUID(partnerID) } return bucket, nil diff --git a/satellite/satellitedb/coinpaymentstxs.go b/satellite/satellitedb/coinpaymentstxs.go index 1f01088b6..17f8366f5 100644 --- a/satellite/satellitedb/coinpaymentstxs.go +++ b/satellite/satellitedb/coinpaymentstxs.go @@ -8,9 +8,9 @@ import ( "math/big" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/payments/coinpayments" "storj.io/storj/satellite/payments/stripecoinpayments" diff --git a/satellite/satellitedb/coupons.go b/satellite/satellitedb/coupons.go index 677e72fbd..c596e023b 100644 --- a/satellite/satellitedb/coupons.go +++ b/satellite/satellitedb/coupons.go @@ -10,10 +10,10 @@ import ( "time" "github.com/lib/pq" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "storj.io/common/memory" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" "storj.io/storj/satellite/payments" diff --git a/satellite/satellitedb/credits.go b/satellite/satellitedb/credits.go index e4645e807..1a3b0e8e1 100644 --- a/satellite/satellitedb/credits.go +++ b/satellite/satellitedb/credits.go @@ -7,9 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/payments" "storj.io/storj/satellite/payments/coinpayments" diff --git a/satellite/satellitedb/customers.go b/satellite/satellitedb/customers.go index 050b8f3cf..528a638e3 100644 --- a/satellite/satellitedb/customers.go +++ b/satellite/satellitedb/customers.go @@ -8,8 +8,7 @@ import ( "database/sql" "time" - "github.com/skyrings/skyring-common/tools/uuid" - + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/payments/stripecoinpayments" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/invoiceprojectrecords.go b/satellite/satellitedb/invoiceprojectrecords.go index fb60447b3..85f04d629 100644 --- a/satellite/satellitedb/invoiceprojectrecords.go +++ b/satellite/satellitedb/invoiceprojectrecords.go @@ -8,9 +8,9 @@ import ( "database/sql" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/payments/stripecoinpayments" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/orders.go b/satellite/satellitedb/orders.go index 44af9988b..b1a47397f 100644 --- a/satellite/satellitedb/orders.go +++ b/satellite/satellitedb/orders.go @@ -9,12 +9,12 @@ import ( "time" "github.com/lib/pq" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "go.uber.org/zap" "storj.io/common/pb" "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/private/dbutil/pgutil" "storj.io/storj/satellite/orders" diff --git a/satellite/satellitedb/projectaccounting.go b/satellite/satellitedb/projectaccounting.go index d420c4148..5c864868b 100644 --- a/satellite/satellitedb/projectaccounting.go +++ b/satellite/satellitedb/projectaccounting.go @@ -10,11 +10,11 @@ import ( "time" "github.com/lib/pq" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "storj.io/common/memory" "storj.io/common/pb" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/accounting" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/projectmembers.go b/satellite/satellitedb/projectmembers.go index b39fda135..40c840b51 100644 --- a/satellite/satellitedb/projectmembers.go +++ b/satellite/satellitedb/projectmembers.go @@ -7,9 +7,9 @@ import ( "context" "strings" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/projects.go b/satellite/satellitedb/projects.go index 158f07066..92389e19e 100644 --- a/satellite/satellitedb/projects.go +++ b/satellite/satellitedb/projects.go @@ -7,9 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/regtokens.go b/satellite/satellitedb/regtokens.go index 0f06afab5..fc1ef7e95 100644 --- a/satellite/satellitedb/regtokens.go +++ b/satellite/satellitedb/regtokens.go @@ -6,9 +6,9 @@ package satellitedb import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/resetpasstokens.go b/satellite/satellitedb/resetpasstokens.go index c76be0c81..3efb92fa0 100644 --- a/satellite/satellitedb/resetpasstokens.go +++ b/satellite/satellitedb/resetpasstokens.go @@ -7,8 +7,7 @@ import ( "context" "errors" - "github.com/skyrings/skyring-common/tools/uuid" - + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/usercredits.go b/satellite/satellitedb/usercredits.go index d88d77a2f..cf2be1c8d 100644 --- a/satellite/satellitedb/usercredits.go +++ b/satellite/satellitedb/usercredits.go @@ -8,9 +8,9 @@ import ( "database/sql" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/currency" "storj.io/storj/private/dbutil/pgutil" "storj.io/storj/satellite/console" diff --git a/satellite/satellitedb/users.go b/satellite/satellitedb/users.go index e5c35a207..38a70a619 100644 --- a/satellite/satellitedb/users.go +++ b/satellite/satellitedb/users.go @@ -7,9 +7,9 @@ import ( "context" "strings" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/dbx" diff --git a/satellite/satellitedb/utils.go b/satellite/satellitedb/utils.go index f8e776085..2452b69d5 100644 --- a/satellite/satellitedb/utils.go +++ b/satellite/satellitedb/utils.go @@ -6,9 +6,8 @@ package satellitedb import ( "database/sql/driver" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/storj" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" ) diff --git a/storagenode/console/consoleapi/notifications.go b/storagenode/console/consoleapi/notifications.go index 884ae3fcc..920bc00ae 100644 --- a/storagenode/console/consoleapi/notifications.go +++ b/storagenode/console/consoleapi/notifications.go @@ -9,10 +9,10 @@ import ( "strconv" "github.com/gorilla/mux" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" "go.uber.org/zap" + "storj.io/common/uuid" "storj.io/storj/storagenode/notifications" ) diff --git a/storagenode/notifications/notifications.go b/storagenode/notifications/notifications.go index a80a29435..b77e1a88b 100644 --- a/storagenode/notifications/notifications.go +++ b/storagenode/notifications/notifications.go @@ -7,9 +7,8 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" - "storj.io/common/storj" + "storj.io/common/uuid" ) // DB tells how application works with notifications database. diff --git a/storagenode/notifications/notifications_test.go b/storagenode/notifications/notifications_test.go index 9d173530a..7a179b786 100644 --- a/storagenode/notifications/notifications_test.go +++ b/storagenode/notifications/notifications_test.go @@ -148,7 +148,7 @@ func TestEmptyNotificationsDB(t *testing.T) { // test notification read with not existing id. t.Run("test notification read with not existing id", func(t *testing.T) { - err := notificationsdb.Read(ctx, testrand.UUID()) + err := notificationsdb.Read(ctx, testrand.UUID2()) assert.Error(t, err, "no rows affected") }) diff --git a/storagenode/notifications/service.go b/storagenode/notifications/service.go index 10cf4d10b..bdc982641 100644 --- a/storagenode/notifications/service.go +++ b/storagenode/notifications/service.go @@ -6,9 +6,10 @@ package notifications import ( "context" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/spacemonkeygo/monkit/v3" "go.uber.org/zap" + + "storj.io/common/uuid" ) var ( diff --git a/storagenode/storagenodedb/notifications.go b/storagenode/storagenodedb/notifications.go index 17d7d868d..ff29078b1 100644 --- a/storagenode/storagenodedb/notifications.go +++ b/storagenode/storagenodedb/notifications.go @@ -7,9 +7,9 @@ import ( "context" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/zeebo/errs" + "storj.io/common/uuid" "storj.io/storj/private/dbutil" "storj.io/storj/storagenode/notifications" ) @@ -54,7 +54,7 @@ func (db *notificationDB) Insert(ctx context.Context, notification notifications } return notifications.Notification{ - ID: *id, + ID: id, SenderID: notification.SenderID, Type: notification.Type, Title: notification.Title, diff --git a/storagenode/storagenodedb/storagenodedbtest/run_test.go b/storagenode/storagenodedb/storagenodedbtest/run_test.go index 73e65526a..f2e5b3562 100644 --- a/storagenode/storagenodedb/storagenodedbtest/run_test.go +++ b/storagenode/storagenodedb/storagenodedbtest/run_test.go @@ -11,7 +11,6 @@ import ( "testing" "time" - "github.com/skyrings/skyring-common/tools/uuid" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" @@ -22,6 +21,7 @@ import ( "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/common/testrand" + "storj.io/common/uuid" "storj.io/storj/storagenode" "storj.io/storj/storagenode/orders" "storj.io/storj/storagenode/storagenodedb"