Skip to content

Commit

Permalink
satellite/metainfo: fix listing for VersioningUnsupported buckets
Browse files Browse the repository at this point in the history
For now we would like to use metabase.ListObjects only for buckets with versioning state Versioned or Suspended. By accident buckets with VersioningUnsupported state were also on that list.

Change-Id: If2068c722d7e775b5f014a87f7afdee4267c7f32
  • Loading branch information
mniewrzal committed Jan 31, 2024
1 parent 648eae2 commit 0269cb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions satellite/buckets/db.go
Expand Up @@ -69,6 +69,11 @@ const (
VersioningSuspended Versioning = 3
)

// IsUnversioned returns true if bucket state represents unversioned bucket.
func (v Versioning) IsUnversioned() bool {
return v == VersioningUnsupported || v == Unversioned
}

// MinimalBucket contains minimal bucket fields for metainfo protocol.
type MinimalBucket struct {
Name []byte
Expand Down
4 changes: 2 additions & 2 deletions satellite/metainfo/endpoint_object.go
Expand Up @@ -995,8 +995,8 @@ func (endpoint *Endpoint) ListObjects(ctx context.Context, req *pb.ObjectListReq
return nil, endpoint.convertMetabaseErr(err)
}
} else if !req.IncludeAllVersions {
// handles regular listing for all type of buckets
if bucket.Versioning == buckets.Unversioned {
if bucket.Versioning.IsUnversioned() {
// handles listing for VersioningUnsupported and Unversioned buckets
err = endpoint.metabase.IterateObjectsAllVersionsWithStatusAscending(ctx,
metabase.IterateObjectsWithStatus{
ProjectID: keyInfo.ProjectID,
Expand Down

0 comments on commit 0269cb3

Please sign in to comment.