Skip to content

Commit

Permalink
node/metabase: Provide API for SearchV2
Browse files Browse the repository at this point in the history
There is a need to serve `ObjectService.SearchV2` RPC by the SN. In
order not to expand the structure and configuration of the node, the
best place to store metadata is metabase.

Metabases are extended with per-container object metadata buckets. For
each object, following indexes are created:
 - OID;
 - attribute->OID;
 - OID->attribute.

Integers are stored specifically to reach lexicographic comparisons
without decoding.

New `Search` method is provided: it allows to filter out container's
objects and receive specified attributes. Count is also limited, op is
paged via cursor. In other words, the method follows SearchV2 behavior
within single metabase.

Refs #3058.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
  • Loading branch information
cthulhu-rider committed Feb 10, 2025
1 parent 5279df2 commit 302aa38
Show file tree
Hide file tree
Showing 7 changed files with 2,237 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/local_object_storage/metabase/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ func (db *DB) DeleteContainer(cID cid.ID) error {
return fmt.Errorf("link objects' bucket cleanup: %w", err)
}

// Metadata
if err = tx.DeleteBucket(metaBucketKey(cID)); err != nil && !errors.Is(err, bbolt.ErrBucketNotFound) {
return fmt.Errorf("metadata bucket cleanup: %w", err)
}

Check warning on line 190 in pkg/local_object_storage/metabase/containers.go

View check run for this annotation

Codecov / codecov/patch

pkg/local_object_storage/metabase/containers.go#L189-L190

Added lines #L189 - L190 were not covered by tests

// indexes

err = tx.DeleteBucket(ownerBucketName(cID, buff))
Expand Down
Loading

0 comments on commit 302aa38

Please sign in to comment.