Run unused against codebase (#12968)
* Remove unused methods * Fix missed issues
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
63a28700f5
Коммит
a2adf7b3f5
@@ -9,12 +9,3 @@ const (
|
||||
LSH_NO_CACHE LayeredStoreHint = iota
|
||||
LSH_MASTER_ONLY
|
||||
)
|
||||
|
||||
func hintsContains(hints []LayeredStoreHint, contains LayeredStoreHint) bool {
|
||||
for _, hint := range hints {
|
||||
if hint == contains {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -49,30 +49,6 @@ func (s *LocalCacheSupplier) Next() LayeredStoreSupplier {
|
||||
return s.next
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) doStandardReadCache(ctx context.Context, cache ObjectCache, key string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
if hintsContains(hints, LSH_NO_CACHE) {
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheMissCounter(cache.Name())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if cacheItem, ok := cache.Get(key); ok {
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheHitCounter(cache.Name())
|
||||
}
|
||||
result := NewSupplierResult()
|
||||
result.Data = cacheItem
|
||||
return result
|
||||
}
|
||||
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheMissCounter(cache.Name())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) doStandardAddToCache(ctx context.Context, cache ObjectCache, key string, result *LayeredStoreSupplierResult, hints ...LayeredStoreHint) {
|
||||
if result.Err == nil && result.Data != nil {
|
||||
cache.AddWithDefaultExpires(key, result.Data)
|
||||
|
||||
@@ -35,19 +35,6 @@ func StoreTest(t *testing.T, f func(*testing.T, store.Store)) {
|
||||
}
|
||||
}
|
||||
|
||||
func StoreTestWithSqlSupplier(t *testing.T, f func(*testing.T, store.Store, storetest.SqlSupplier)) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
tearDownStores()
|
||||
panic(err)
|
||||
}
|
||||
}()
|
||||
for _, st := range storeTypes {
|
||||
st := st
|
||||
t.Run(st.Name, func(t *testing.T) { f(t, st.Store, st.SqlSupplier) })
|
||||
}
|
||||
}
|
||||
|
||||
func initStores() {
|
||||
storeTypes = append(storeTypes, &storeType{
|
||||
Name: "LocalCache+MySQL",
|
||||
|
||||
Ссылка в новой задаче
Block a user