From 794d91d4e608f22e8c963ced662718929b481365 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Wed, 26 Jun 2024 12:56:27 +0200 Subject: [PATCH] feat(storage-provider): add option to disable versioning Signed-off-by: jkoberg --- changelog/unreleased/allow-disable-versioning.md | 5 +++++ services/storage-system/pkg/revaconfig/config.go | 1 + services/storage-users/pkg/config/config.go | 2 ++ services/storage-users/pkg/revaconfig/drivers.go | 4 ++++ 4 files changed, 12 insertions(+) create mode 100644 changelog/unreleased/allow-disable-versioning.md diff --git a/changelog/unreleased/allow-disable-versioning.md b/changelog/unreleased/allow-disable-versioning.md new file mode 100644 index 00000000000..004c6dbf23c --- /dev/null +++ b/changelog/unreleased/allow-disable-versioning.md @@ -0,0 +1,5 @@ +Enhancement: Allow disable versioning + +Adds new configuration options to disable versioning for the storage providers + +https://github.com/owncloud/ocis/pull/9473 diff --git a/services/storage-system/pkg/revaconfig/config.go b/services/storage-system/pkg/revaconfig/config.go index 5557552097e..0dc62e3be54 100644 --- a/services/storage-system/pkg/revaconfig/config.go +++ b/services/storage-system/pkg/revaconfig/config.go @@ -155,6 +155,7 @@ func metadataDrivers(cfg *config.Config) map[string]interface{} { "permissionssvc": "com.owncloud.api.storage-system", "max_acquire_lock_cycles": cfg.Drivers.OCIS.MaxAcquireLockCycles, "lock_cycle_duration_factor": cfg.Drivers.OCIS.LockCycleDurationFactor, + "disable_versioning": true, "statcache": map[string]interface{}{ "cache_store": "noop", "cache_database": "system", diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index 5114c91e1b4..1024fb2f43c 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -138,6 +138,7 @@ type OCISDriver struct { MaxConcurrency int `yaml:"max_concurrency" env:"STORAGE_USERS_OCIS_MAX_CONCURRENCY" desc:"Maximum number of concurrent go-routines. Higher values can potentially get work done faster but will also cause more load on the system. Values of 0 or below will be ignored and the default value will be used." introductionVersion:"pre5.0"` AsyncUploads bool `yaml:"async_uploads" env:"OCIS_ASYNC_UPLOADS" desc:"Enable asynchronous file uploads." introductionVersion:"pre5.0"` MaxQuota uint64 `yaml:"max_quota" env:"OCIS_SPACES_MAX_QUOTA;STORAGE_USERS_OCIS_MAX_QUOTA" desc:"Set a global max quota for spaces in bytes. A value of 0 equals unlimited. If not using the global OCIS_SPACES_MAX_QUOTA, you must define the FRONTEND_MAX_QUOTA in the frontend service." introductionVersion:"pre5.0"` + DisableVersioning bool `yaml:"disable_versioning" env:"OCIS_DISABLE_VERSIONING" desc:"Disables versioning of files. When set to true, new uploads with the same filename will overwrite existing files instead of creating a new version." introductionVersion:"6.0"` } // S3NGDriver is the storage driver configuration when using 's3ng' storage driver @@ -173,6 +174,7 @@ type S3NGDriver struct { MaxAcquireLockCycles int `yaml:"max_acquire_lock_cycles" env:"STORAGE_USERS_S3NG_MAX_ACQUIRE_LOCK_CYCLES" desc:"When trying to lock files, ocis will try this amount of times to acquire the lock before failing. After each try it will wait for an increasing amount of time. Values of 0 or below will be ignored and the default value of 20 will be used." introductionVersion:"pre5.0"` LockCycleDurationFactor int `yaml:"lock_cycle_duration_factor" env:"STORAGE_USERS_S3NG_LOCK_CYCLE_DURATION_FACTOR" desc:"When trying to lock files, ocis will multiply the cycle with this factor and use it as a millisecond timeout. Values of 0 or below will be ignored and the default value of 30 will be used." introductionVersion:"pre5.0"` MaxConcurrency int `yaml:"max_concurrency" env:"STORAGE_USERS_S3NG_MAX_CONCURRENCY" desc:"Maximum number of concurrent go-routines. Higher values can potentially get work done faster but will also cause more load on the system. Values of 0 or below will be ignored and the default value of 100 will be used." introductionVersion:"pre5.0"` + DisableVersioning bool `yaml:"disable_versioning" env:"OCIS_DISABLE_VERSIONING" desc:"Disables versioning of files. When set to true, new uploads with the same filename will overwrite existing files instead of creating a new version." introductionVersion:"6.0"` } // OwnCloudSQLDriver is the storage driver configuration when using 'owncloudsql' storage driver diff --git a/services/storage-users/pkg/revaconfig/drivers.go b/services/storage-users/pkg/revaconfig/drivers.go index 8d3c108e927..7637a145a54 100644 --- a/services/storage-users/pkg/revaconfig/drivers.go +++ b/services/storage-users/pkg/revaconfig/drivers.go @@ -161,6 +161,7 @@ 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, + "disable_versioning": cfg.Drivers.OCIS.DisableVersioning, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -216,6 +217,7 @@ 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, + "disable_versioning": cfg.Drivers.OCIS.DisableVersioning, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -285,6 +287,7 @@ func S3NG(cfg *config.Config) map[string]interface{} { "max_acquire_lock_cycles": cfg.Drivers.S3NG.MaxAcquireLockCycles, "lock_cycle_duration_factor": cfg.Drivers.S3NG.LockCycleDurationFactor, "max_concurrency": cfg.Drivers.S3NG.MaxConcurrency, + "disable_versioning": cfg.Drivers.S3NG.DisableVersioning, "asyncfileuploads": cfg.Drivers.OCIS.AsyncUploads, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, @@ -344,6 +347,7 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "s3.bucket": cfg.Drivers.S3NG.Bucket, "max_acquire_lock_cycles": cfg.Drivers.S3NG.MaxAcquireLockCycles, "max_concurrency": cfg.Drivers.S3NG.MaxConcurrency, + "disable_versioning": cfg.Drivers.S3NG.DisableVersioning, "lock_cycle_duration_factor": cfg.Drivers.S3NG.LockCycleDurationFactor, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store,