diff --git a/cmd/satellite/main.go b/cmd/satellite/main.go index 7ce72276b..325344502 100644 --- a/cmd/satellite/main.go +++ b/cmd/satellite/main.go @@ -30,7 +30,7 @@ import ( _ "storj.io/private/process/googleprofiler" // This attaches google cloud profiler. "storj.io/private/version" "storj.io/storj/cmd/satellite/reports" - "storj.io/storj/pkg/cache" + "storj.io/storj/pkg/lrucache" "storj.io/storj/pkg/revocation" _ "storj.io/storj/private/version" // This attaches version information during release builds. "storj.io/storj/satellite" @@ -64,16 +64,16 @@ type Satellite struct { } // APIKeysLRUOptions returns a cache.Options based on the APIKeys LRU config. -func (s *Satellite) APIKeysLRUOptions() cache.Options { - return cache.Options{ +func (s *Satellite) APIKeysLRUOptions() lrucache.Options { + return lrucache.Options{ Expiration: s.DatabaseOptions.APIKeysCache.Expiration, Capacity: s.DatabaseOptions.APIKeysCache.Capacity, } } // RevocationLRUOptions returns a cache.Options based on the Revocations LRU config. -func (s *Satellite) RevocationLRUOptions() cache.Options { - return cache.Options{ +func (s *Satellite) RevocationLRUOptions() lrucache.Options { + return lrucache.Options{ Expiration: s.DatabaseOptions.RevocationsCache.Expiration, Capacity: s.DatabaseOptions.RevocationsCache.Capacity, } diff --git a/pkg/cache/cache.go b/pkg/lrucache/cache.go similarity index 99% rename from pkg/cache/cache.go rename to pkg/lrucache/cache.go index 3c7ea55db..2bcc1f8b8 100644 --- a/pkg/cache/cache.go +++ b/pkg/lrucache/cache.go @@ -1,7 +1,7 @@ // Copyright (C) 2020 Storj Labs, Inc. // See LICENSE for copying information. -package cache +package lrucache import ( "container/list" diff --git a/pkg/cache/cache_test.go b/pkg/lrucache/cache_test.go similarity index 99% rename from pkg/cache/cache_test.go rename to pkg/lrucache/cache_test.go index a60b1b288..cfbb1f011 100644 --- a/pkg/cache/cache_test.go +++ b/pkg/lrucache/cache_test.go @@ -1,7 +1,7 @@ // Copyright (C) 2020 Storj Labs, Inc. // See LICENSE for copying information. -package cache +package lrucache import ( "math/rand" diff --git a/satellite/accounting/projectlimitcache.go b/satellite/accounting/projectlimitcache.go index a38480278..3d4fb3d03 100644 --- a/satellite/accounting/projectlimitcache.go +++ b/satellite/accounting/projectlimitcache.go @@ -11,7 +11,7 @@ import ( "storj.io/common/memory" "storj.io/common/uuid" - lrucache "storj.io/storj/pkg/cache" + "storj.io/storj/pkg/lrucache" ) var ( diff --git a/satellite/metainfo/metainfo.go b/satellite/metainfo/metainfo.go index 72c65b41a..af47b6d08 100644 --- a/satellite/metainfo/metainfo.go +++ b/satellite/metainfo/metainfo.go @@ -22,7 +22,7 @@ import ( "storj.io/common/signing" "storj.io/common/storj" "storj.io/common/uuid" - lrucache "storj.io/storj/pkg/cache" + "storj.io/storj/pkg/lrucache" "storj.io/storj/satellite/accounting" "storj.io/storj/satellite/attribution" "storj.io/storj/satellite/console" diff --git a/satellite/satellitedb/apikeys.go b/satellite/satellitedb/apikeys.go index 0668fd446..98d92d3af 100644 --- a/satellite/satellitedb/apikeys.go +++ b/satellite/satellitedb/apikeys.go @@ -10,7 +10,7 @@ import ( "github.com/zeebo/errs" "storj.io/common/uuid" - "storj.io/storj/pkg/cache" + "storj.io/storj/pkg/lrucache" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/dbx" ) @@ -21,7 +21,7 @@ var _ console.APIKeys = (*apikeys)(nil) // apikeys is an implementation of satellite.APIKeys. type apikeys struct { methods dbx.Methods - lru *cache.ExpiringLRU + lru *lrucache.ExpiringLRU db *satelliteDB } diff --git a/satellite/satellitedb/consoledb.go b/satellite/satellitedb/consoledb.go index 7ce5e6dd0..256784e2e 100644 --- a/satellite/satellitedb/consoledb.go +++ b/satellite/satellitedb/consoledb.go @@ -9,7 +9,7 @@ import ( "github.com/zeebo/errs" - "storj.io/storj/pkg/cache" + "storj.io/storj/pkg/lrucache" "storj.io/storj/satellite/console" "storj.io/storj/satellite/satellitedb/dbx" ) @@ -19,7 +19,7 @@ var _ console.DB = (*ConsoleDB)(nil) // ConsoleDB contains access to different satellite databases. type ConsoleDB struct { - apikeysLRUOptions cache.Options + apikeysLRUOptions lrucache.Options db *satelliteDB tx *dbx.Tx @@ -50,7 +50,7 @@ func (db *ConsoleDB) APIKeys() console.APIKeys { db.apikeysOnce.Do(func() { db.apikeys = &apikeys{ methods: db.methods, - lru: cache.New(db.apikeysLRUOptions), + lru: lrucache.New(db.apikeysLRUOptions), db: db.db, } }) diff --git a/satellite/satellitedb/database.go b/satellite/satellitedb/database.go index c1625f3b2..5d0530fb0 100644 --- a/satellite/satellitedb/database.go +++ b/satellite/satellitedb/database.go @@ -14,7 +14,7 @@ import ( "storj.io/private/dbutil" "storj.io/private/dbutil/pgutil" "storj.io/private/tagsql" - "storj.io/storj/pkg/cache" + "storj.io/storj/pkg/lrucache" "storj.io/storj/private/migrate" "storj.io/storj/satellite" "storj.io/storj/satellite/accounting" @@ -65,8 +65,8 @@ type satelliteDB struct { // Options includes options for how a satelliteDB runs. type Options struct { ApplicationName string - APIKeysLRUOptions cache.Options - RevocationLRUOptions cache.Options + APIKeysLRUOptions lrucache.Options + RevocationLRUOptions lrucache.Options // How many storage node rollups to save/read in one batch. SaveRollupBatchSize int @@ -223,7 +223,7 @@ func (dbc *satelliteDBCollection) Revocation() revocation.DB { db.revocationDBOnce.Do(func() { db.revocationDB = &revocationDB{ db: db, - lru: cache.New(db.opts.RevocationLRUOptions), + lru: lrucache.New(db.opts.RevocationLRUOptions), methods: db, } }) diff --git a/satellite/satellitedb/revocation.go b/satellite/satellitedb/revocation.go index 37738cc74..9c4ff62fa 100644 --- a/satellite/satellitedb/revocation.go +++ b/satellite/satellitedb/revocation.go @@ -9,13 +9,13 @@ import ( "github.com/zeebo/errs" - "storj.io/storj/pkg/cache" + "storj.io/storj/pkg/lrucache" "storj.io/storj/satellite/satellitedb/dbx" ) type revocationDB struct { db *satelliteDB - lru *cache.ExpiringLRU + lru *lrucache.ExpiringLRU methods dbx.Methods }