From cec6ea50eb086b9d3f09823cc2abc4490e2f447e Mon Sep 17 00:00:00 2001 From: jkoberg Date: Tue, 23 Jan 2024 12:48:44 +0100 Subject: [PATCH] remove unused stat cache Signed-off-by: jkoberg --- services/gateway/pkg/config/config.go | 8 ---- .../pkg/config/defaults/defaultconfig.go | 4 -- services/gateway/pkg/revaconfig/config.go | 11 ----- services/storage-users/pkg/config/config.go | 13 ------ .../pkg/config/defaults/defaultconfig.go | 6 --- .../storage-users/pkg/revaconfig/config.go | 35 ---------------- .../storage-users/pkg/revaconfig/drivers.go | 40 ------------------- 7 files changed, 117 deletions(-) diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index 4e0717bf3..a3242706b 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -85,14 +85,6 @@ type StorageRegistry struct { // Cache holds cache config type Cache struct { - StatCacheStore string // NOTE: The stat cache is not working atm. Hence we block configuring it - StatCacheNodes []string `yaml:"stat_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_STAT_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` - StatCacheDatabase string `yaml:"stat_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` - StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` - StatCacheSize int `yaml:"stat_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` - StatCacheDisablePersistence bool `yaml:"stat_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_STAT_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the stat cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` - StatCacheAuthUsername string `yaml:"stat_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_STAT_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured."` - StatCacheAuthPassword string `yaml:"stat_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_STAT_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured."` ProviderCacheStore string `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` diff --git a/services/gateway/pkg/config/defaults/defaultconfig.go b/services/gateway/pkg/config/defaults/defaultconfig.go index f1ae85004..b8bea1a4b 100644 --- a/services/gateway/pkg/config/defaults/defaultconfig.go +++ b/services/gateway/pkg/config/defaults/defaultconfig.go @@ -39,10 +39,6 @@ func DefaultConfig() *config.Config { DisableHomeCreationOnLogin: true, TransferExpires: 24 * 60 * 60, Cache: config.Cache{ - StatCacheStore: "noop", // NOTE: stat cache not working - StatCacheDatabase: "ocis", - StatCacheNodes: []string{"127.0.0.1:9233"}, - StatCacheTTL: 300 * time.Second, ProviderCacheStore: "noop", ProviderCacheNodes: []string{"127.0.0.1:9233"}, ProviderCacheDatabase: "cache-providers", diff --git a/services/gateway/pkg/revaconfig/config.go b/services/gateway/pkg/revaconfig/config.go index ecd233380..c13688aee 100644 --- a/services/gateway/pkg/revaconfig/config.go +++ b/services/gateway/pkg/revaconfig/config.go @@ -61,17 +61,6 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i "transfer_shared_secret": cfg.TransferSecret, "transfer_expires": cfg.TransferExpires, // cache and TTLs - "stat_cache_config": map[string]interface{}{ - "cache_store": cfg.Cache.StatCacheStore, - "cache_nodes": cfg.Cache.StatCacheNodes, - "cache_database": cfg.Cache.StatCacheDatabase, - "cache_table": "stat", - "cache_ttl": cfg.Cache.StatCacheTTL, - "cache_size": cfg.Cache.StatCacheSize, - "cache_disable_persistenc": cfg.Cache.StatCacheDisablePersistence, - "cache_auth_username": cfg.Cache.StatCacheAuthUsername, - "cache_auth_password": cfg.Cache.StatCacheAuthPassword, - }, "provider_cache_config": map[string]interface{}{ "cache_store": cfg.Cache.ProviderCacheStore, "cache_nodes": cfg.Cache.ProviderCacheNodes, diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index 3d75b52ab..8fd16c74b 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -31,7 +31,6 @@ type Config struct { TransferExpires int64 `yaml:"transfer_expires" env:"STORAGE_USERS_TRANSFER_EXPIRES" desc:"the time after which the token for upload postprocessing expires"` Events Events `yaml:"events"` - StatCache StatCache `yaml:"stat_cache"` FilemetadataCache FilemetadataCache `yaml:"filemetadata_cache"` IDCache IDCache `yaml:"id_cache"` MountID string `yaml:"mount_id" env:"STORAGE_USERS_MOUNT_ID" desc:"Mount ID of this storage."` @@ -182,18 +181,6 @@ type Events struct { AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;STORAGE_USERS_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.."` } -// StatCache holds cache config -type StatCache struct { - Store string `yaml:"store" env:"OCIS_CACHE_STORE;STORAGE_USERS_STAT_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` - Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_USERS_STAT_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` - Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` - TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_STAT_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` - Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` - DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_STAT_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_STAT_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_STAT_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` -} - // FilemetadataCache holds cache config type FilemetadataCache struct { Store string `yaml:"store" env:"OCIS_CACHE_STORE;STORAGE_USERS_FILEMETADATA_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` diff --git a/services/storage-users/pkg/config/defaults/defaultconfig.go b/services/storage-users/pkg/config/defaults/defaultconfig.go index 8bc070c6a..82a65ff79 100644 --- a/services/storage-users/pkg/config/defaults/defaultconfig.go +++ b/services/storage-users/pkg/config/defaults/defaultconfig.go @@ -94,12 +94,6 @@ func DefaultConfig() *config.Config { ClusterID: "ocis-cluster", EnableTLS: false, }, - StatCache: config.StatCache{ - Store: "memory", - Nodes: []string{"127.0.0.1:9233"}, - Database: "ocis", - TTL: 300 * time.Second, - }, FilemetadataCache: config.FilemetadataCache{ Store: "memory", Nodes: []string{"127.0.0.1:9233"}, diff --git a/services/storage-users/pkg/revaconfig/config.go b/services/storage-users/pkg/revaconfig/config.go index 4169106d0..f8ecffd9b 100644 --- a/services/storage-users/pkg/revaconfig/config.go +++ b/services/storage-users/pkg/revaconfig/config.go @@ -74,41 +74,6 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "nats_enable_tls": cfg.Events.EnableTLS, "nats_username": cfg.Events.AuthUsername, "nats_password": cfg.Events.AuthPassword, - "data_txs": map[string]interface{}{ - "simple": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_table": "stat", - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, - "spaces": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_table": "stat", - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, - "tus": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_table": "stat", - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, - }, }, }, }, diff --git a/services/storage-users/pkg/revaconfig/drivers.go b/services/storage-users/pkg/revaconfig/drivers.go index fc5b1e595..0a44caf74 100644 --- a/services/storage-users/pkg/revaconfig/drivers.go +++ b/services/storage-users/pkg/revaconfig/drivers.go @@ -132,16 +132,6 @@ func Ocis(cfg *config.Config) map[string]interface{} { "max_concurrency": cfg.Drivers.OCIS.MaxConcurrency, "asyncfileuploads": cfg.Drivers.OCIS.AsyncUploads, "max_quota": cfg.Drivers.OCIS.MaxQuota, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -195,16 +185,6 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "lock_cycle_duration_factor": cfg.Drivers.OCIS.LockCycleDurationFactor, "max_concurrency": cfg.Drivers.OCIS.MaxConcurrency, "max_quota": cfg.Drivers.OCIS.MaxQuota, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -267,16 +247,6 @@ func S3NG(cfg *config.Config) map[string]interface{} { "lock_cycle_duration_factor": cfg.Drivers.S3NG.LockCycleDurationFactor, "max_concurrency": cfg.Drivers.S3NG.MaxConcurrency, "asyncfileuploads": cfg.Drivers.OCIS.AsyncUploads, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -334,16 +304,6 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "max_acquire_lock_cycles": cfg.Drivers.S3NG.MaxAcquireLockCycles, "max_concurrency": cfg.Drivers.S3NG.MaxConcurrency, "lock_cycle_duration_factor": cfg.Drivers.S3NG.LockCycleDurationFactor, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes,