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

Closed
opened 2023-03-08 23:34:40 +00:00 by snegurochka · 1 comment

Original issue: https://github.com/nspcc-dev/neofs-node/issues/1882

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
Original issue: https://github.com/nspcc-dev/neofs-node/issues/1882 ## 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 ```
fyrchik added the
enhancement
frostfs-cli
labels 2023-03-23 08:49:32 +00:00

Comment from the original issue:

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' .
Comment from the original issue: ``` 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' . ```
aarifullin was assigned by fyrchik 2023-04-06 15:46:17 +00:00
fyrchik added this to the v0.37.0 milestone 2023-04-11 08:24:55 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
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: TrueCloudLab/frostfs-node#113
There is no content yet.