nspcc-dev / nspcc-dev/neofs-node

Neofs-cli: Add `container search` method to get containers with target attribute

Open
#1,882 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement I3 neofs-cli S4 U4
Dominant language
Go
Stars
38
Forks
51
Avg merge
1d 20h
Merged PRs (30d)
38

Description

Problem

With a large number of containers (more than a few hundred), it becomes very difficult to find the target container. We have to make container get command request to check all of them one by one or use container list --with-attr in combination with grep now. But this is not the most convenient approach.

It would be good to simplify the management of containers by adding the ability to search by attributes.

Solution

Add container search command to find containers with specific attribute.

For example:

$ neofs-cli --rpc-endpoint node1.neofs:8080 -w scenarios/files/wallet.json container search --filter 'Name EQ test'  
Enter password > 
JCsuK9R8MLR35yD257BmPxmDZ52UuWuhUwswUG4nr8h6


$ neofs-cli --rpc-endpoint node1.neofs:8080 -w scenarios/files/wallet.json container get --cid JCsuK9R8MLR35yD257BmPxmDZ52UuWuhUwswUG4nr8h6
Enter password > 
container ID: JCsuK9R8MLR35yD257BmPxmDZ52UuWuhUwswUG4nr8h6
owner ID: Nge3U4wJpDGK2BWGfH5VcZ5PAbC6Ro7GHY
basic ACL: fbfbfff (eacl-public-read-write)
created: 2022-10-06 17:28:20 +0300 MSK
attributes:
	Timestamp=1665066500
	__NEOFS__NAME=test
	__NEOFS__ZONE=container
	Name=b0cfaae3-ed18-4ba2-9074-2b246bec8c26
	.s3-location-constraint=load-1-1
	__NEOFS__DISABLE_HOMOMORPHIC_HASHING=true
placement policy:
REP 1
CBF 1
SELECT 1 FROM *


$ neofs-cli --rpc-endpoint node1.neofs:8080 -w scenarios/files/wallet.json container search --filter '.s3-location-constraint NOPRESENT'  
Enter password > 
6RLC6wB49XetQNz9at9zopXan7SGuWyKqpk7FX31XBi
Gghm73EPsZSW1uxo759hiyrRrptkhLYaJBMBX4oCg9Yf
H2vR3MaoWAj2rA9dpgJsLBJnXiPRq9pEU7U5t7pBFBVh
HDd9N5mrPeEbjmiNLw6DrtZiMxUPQhDSWwUb9RL8cM85
HN9kdtg5DkFdFS36A6pgNbca5fVTMSTQgNaapzJ6QWeN

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the neofs-cli container get and container list entry points, using the shown scenarios/files/wallet.json invocation to understand their filtering and output behavior. Add the container search command with the demonstrated --filter expressions, and verify that matching container IDs are returned for present and NOPRESENT attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.