[#569] Rename versioning consts
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
77f466b1d5
commit
56eb2dc3dc
9 changed files with 17 additions and 17 deletions
2
api/cache/cache_test.go
vendored
2
api/cache/cache_test.go
vendored
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue