pkg/lrucache: rename package

cache is really common variable and type name and we have already used
the package name alias in multiple places.

Change-Id: I6435785b7549b541d533de59ec94557b9bd11e04
This commit is contained in:
Egon Elbre 2021-04-23 15:59:10 +03:00
parent 4d37378129
commit c641ddcb54
9 changed files with 20 additions and 20 deletions

View File

@ -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,
}

View File

@ -1,7 +1,7 @@
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package cache
package lrucache
import (
"container/list"

View File

@ -1,7 +1,7 @@
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package cache
package lrucache
import (
"math/rand"

View File

@ -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 (

View File

@ -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"

View File

@ -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
}

View File

@ -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,
}
})

View File

@ -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,
}
})

View File

@ -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
}