Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tags for bucket/object/group and support SetTags tx #105

Merged
merged 6 commits into from
Dec 12, 2023

Conversation

ruojunm
Copy link
Collaborator

@ruojunm ruojunm commented Dec 11, 2023

Description

feat: add tags for bucket/object/group and support SetTags tx

Rationale

Greenfield v1.2.0 will introduce tags fields for bucket/object/group entities and also has a SetTags API to set tags for existing bucket/object/group

Example

  • Create a bucket with tags
 ./gnfd-cmd bucket create --tags='[{"Key":"0","value":"value1"},{"key":"key2","value":"0"}]'   gnfd://clyde-test-3 
  • Create an object with tags
 ./gnfd-cmd object put --tags='[{"key":"key1","value":"value1"},{"key":"key2","value":"value2"}]' file.txt gnfd://clyde-test-3/file.txt
  • Create a group with tags
gnfd-cmd group create --tags='[{"key":"key1","value":"value1"},{"key":"key2","value":"value2"}]' clyde-group-1
  • Set tags for existing bucket
./gnfd-cmd bucket setTag --tags='[{"key":"level","value":"grade3"}]' gnfd://clyde-test-2
  • Set tags for existing object
./gnfd-cmd object setTag --tags='[{"key":"level","value":"grade4"}]'  gnfd://clyde-test-3/file.txt 
  • Set tags for existing group
./gnfd-cmd group setTag --tags='[{"key":"level","value":"grade5"}]'  clyde-group-2
  • head object/bucket/group
./gnfd-cmd object head  --format=json gnfd://clyde-test-3/file.txt 
./gnfd-cmd bucket head --format=json clyde-test-2
./gnfd-cmd group head --format=json clyde-group-2 

Changes

Notable changes:

  • add tags parameters when creating objects/buckets/groups
  • add a ./gnfd-cmd bucket/object/group setTag cmd to send SetTag message to greenfield chain.
  • Refine json format response when heading bucket/object/group

@keefel
Copy link

keefel commented Dec 11, 2023

The set-tag subcommand should be for gnfd-cmd bucket/object/group, not for gnfd-cmd. The correct format is 'gnfd-cmd bucket set-tags --tags='[{"Key":"0","value":"value1"},{"key":"key2","value":"0"}]' gnfd://clyde-test-3'.

Copy link

@keefel keefel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ruojunm ruojunm merged commit cd2be3a into master Dec 12, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants