From 56eb2dc3dc20434db1bb892bd3ceeea7e92d888b Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Wed, 20 Jul 2022 14:30:19 +0400 Subject: [PATCH] [#569] Rename versioning consts Signed-off-by: Angira Kekteeva --- api/cache/cache_test.go | 2 +- api/data/info.go | 12 ++++++------ api/handler/handlers_test.go | 2 +- api/handler/put.go | 2 +- api/handler/versioning.go | 2 +- api/layer/locking_test.go | 2 +- api/layer/system_object.go | 2 +- api/layer/versioning_test.go | 8 ++++---- internal/neofs/tree.go | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/api/cache/cache_test.go b/api/cache/cache_test.go index 0db074a1..679b491b 100644 --- a/api/cache/cache_test.go +++ b/api/cache/cache_test.go @@ -153,7 +153,7 @@ func TestSettingsCacheType(t *testing.T) { cache := NewSystemCache(DefaultSystemConfig(logger)) key := "key" - settings := &data.BucketSettings{Versioning: data.VerEnabled} + settings := &data.BucketSettings{Versioning: data.VersioningEnabled} err := cache.PutSettings(key, settings) require.NoError(t, err) diff --git a/api/data/info.go b/api/data/info.go index 86c5329e..8cda7060 100644 --- a/api/data/info.go +++ b/api/data/info.go @@ -14,9 +14,9 @@ const ( bktCORSConfigurationObject = ".s3-cors" bktNotificationConfigurationObject = ".s3-notifications" - VerUnversioned = "Unversioned" - VerEnabled = "Enabled" - VerSuspended = "Suspended" + VersioningUnversioned = "Unversioned" + VersioningEnabled = "Enabled" + VersioningSuspended = "Suspended" ) type ( @@ -96,13 +96,13 @@ func (o *ObjectInfo) Address() oid.Address { } func (b BucketSettings) Unversioned() bool { - return b.Versioning == VerUnversioned + return b.Versioning == VersioningUnversioned } func (b BucketSettings) VersioningEnabled() bool { - return b.Versioning == VerEnabled + return b.Versioning == VersioningEnabled } func (b BucketSettings) VersioningSuspended() bool { - return b.Versioning == VerSuspended + return b.Versioning == VersioningSuspended } diff --git a/api/handler/handlers_test.go b/api/handler/handlers_test.go index 9ab09f00..04007bb5 100644 --- a/api/handler/handlers_test.go +++ b/api/handler/handlers_test.go @@ -109,7 +109,7 @@ func createTestBucketWithLock(ctx context.Context, t *testing.T, h *handlerConte sp := &layer.PutSettingsParams{ BktInfo: bktInfo, Settings: &data.BucketSettings{ - Versioning: data.VerEnabled, + Versioning: data.VersioningEnabled, LockConfiguration: conf, }, } diff --git a/api/handler/put.go b/api/handler/put.go index 94a68e60..ea360a8a 100644 --- a/api/handler/put.go +++ b/api/handler/put.go @@ -659,7 +659,7 @@ func (h *handler) CreateBucketHandler(w http.ResponseWriter, r *http.Request) { if p.ObjectLockEnabled { sp := &layer.PutSettingsParams{ BktInfo: bktInfo, - Settings: &data.BucketSettings{Versioning: data.VerEnabled}, + Settings: &data.BucketSettings{Versioning: data.VersioningEnabled}, } if err = h.obj.PutBucketSettings(r.Context(), sp); err != nil { h.logAndSendError(w, "couldn't enable bucket versioning", reqInfo, err, diff --git a/api/handler/versioning.go b/api/handler/versioning.go index e04af6f7..f67a784f 100644 --- a/api/handler/versioning.go +++ b/api/handler/versioning.go @@ -33,7 +33,7 @@ func (h *handler) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Requ return } - if configuration.Status != data.VerEnabled && configuration.Status != data.VerSuspended { + if configuration.Status != data.VersioningEnabled && configuration.Status != data.VersioningSuspended { h.logAndSendError(w, "invalid versioning configuration", reqInfo, err) return } diff --git a/api/layer/locking_test.go b/api/layer/locking_test.go index 3c257d54..bd06d21e 100644 --- a/api/layer/locking_test.go +++ b/api/layer/locking_test.go @@ -12,7 +12,7 @@ func TestObjectLockAttributes(t *testing.T) { tc := prepareContext(t) err := tc.layer.PutBucketSettings(tc.ctx, &PutSettingsParams{ BktInfo: tc.bktInfo, - Settings: &data.BucketSettings{Versioning: data.VerEnabled}, + Settings: &data.BucketSettings{Versioning: data.VersioningEnabled}, }) require.NoError(t, err) diff --git a/api/layer/system_object.go b/api/layer/system_object.go index 367835b7..238c4dd8 100644 --- a/api/layer/system_object.go +++ b/api/layer/system_object.go @@ -189,7 +189,7 @@ func (n *layer) GetBucketSettings(ctx context.Context, bktInfo *data.BucketInfo) if !errorsStd.Is(err, ErrNodeNotFound) { return nil, err } - settings = &data.BucketSettings{Versioning: data.VerUnversioned} + settings = &data.BucketSettings{Versioning: data.VersioningUnversioned} } if err = n.systemCache.PutSettings(systemKey, settings); err != nil { diff --git a/api/layer/versioning_test.go b/api/layer/versioning_test.go index 46cbd7c0..b4bf392c 100644 --- a/api/layer/versioning_test.go +++ b/api/layer/versioning_test.go @@ -183,7 +183,7 @@ func TestSimpleVersioning(t *testing.T) { tc := prepareContext(t) err := tc.layer.PutBucketSettings(tc.ctx, &PutSettingsParams{ BktInfo: tc.bktInfo, - Settings: &data.BucketSettings{Versioning: data.VerEnabled}, + Settings: &data.BucketSettings{Versioning: data.VersioningEnabled}, }) require.NoError(t, err) @@ -220,7 +220,7 @@ func TestSimpleNoVersioning(t *testing.T) { func TestVersioningDeleteObject(t *testing.T) { tc := prepareContext(t) - settings := &data.BucketSettings{Versioning: data.VerEnabled} + settings := &data.BucketSettings{Versioning: data.VersioningEnabled} err := tc.layer.PutBucketSettings(tc.ctx, &PutSettingsParams{ BktInfo: tc.bktInfo, Settings: settings, @@ -242,7 +242,7 @@ func TestGetUnversioned(t *testing.T) { objContent := []byte("content obj1 v1") objInfo := tc.putObject(objContent) - settings := &data.BucketSettings{Versioning: data.VerUnversioned} + settings := &data.BucketSettings{Versioning: data.VersioningUnversioned} err := tc.layer.PutBucketSettings(tc.ctx, &PutSettingsParams{ BktInfo: tc.bktInfo, Settings: settings, @@ -256,7 +256,7 @@ func TestGetUnversioned(t *testing.T) { func TestVersioningDeleteSpecificObjectVersion(t *testing.T) { tc := prepareContext(t) - settings := &data.BucketSettings{Versioning: data.VerEnabled} + settings := &data.BucketSettings{Versioning: data.VersioningEnabled} err := tc.layer.PutBucketSettings(tc.ctx, &PutSettingsParams{ BktInfo: tc.bktInfo, Settings: settings, diff --git a/internal/neofs/tree.go b/internal/neofs/tree.go index ad7cfd2b..012b6585 100644 --- a/internal/neofs/tree.go +++ b/internal/neofs/tree.go @@ -266,7 +266,7 @@ func (c *TreeClient) GetSettingsNode(ctx context.Context, cnrID cid.ID) (*data.B return nil, fmt.Errorf("couldn't get node: %w", err) } - settings := &data.BucketSettings{Versioning: data.VerUnversioned} + settings := &data.BucketSettings{Versioning: data.VersioningUnversioned} if versioningValue, ok := node.Get(versioningKV); ok { settings.Versioning = versioningValue }