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

Open
opened 2025-12-28 17:20:42 +00:00 by sami · 2 comments
Owner

Originally created by @anatoly-bogatyrev on GitHub (Oct 11, 2022).

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
Originally created by @anatoly-bogatyrev on GitHub (Oct 11, 2022). ## 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 ```
Author
Owner

@cthulhu-rider commented on GitHub (Oct 13, 2022):

It doesn't seem convenient to have flex QL for limited needs. So lets provide container search --name test instead of container search --filter 'Name EQ test' .

@cthulhu-rider commented on GitHub (Oct 13, 2022): It doesn't seem convenient to have flex QL for limited needs. So lets provide `container search --name test` instead of `container search --filter 'Name EQ test' `.
Author
Owner

@roman-khimov commented on GitHub (Apr 7, 2023):

We can have named containers with NNS, so if we're talking names only, it's solved. Attributes are a bit different though.

@roman-khimov commented on GitHub (Apr 7, 2023): We can have named containers with NNS, so if we're talking names only, it's solved. Attributes are a bit different though.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-node#790
No description provided.