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: support format flag to support json content for the head commands #103

Merged
merged 10 commits into from
Nov 23, 2023

Conversation

flywukong
Copy link
Collaborator

@flywukong flywukong commented Nov 22, 2023

Description

  1. support --format json flag to return the JSON format of head object/bucket/group
  2. fix the logic of uploading the folder by only uploading the last level directory of the file directory structure. For example , if using "object put aaa/bbb/ccc--recursive " to upload folder "ccc" , it will create it should just create "ccc/ " and the sub folders, not "aaa/bbb/ccc/"

Rationale

support json to show the meta

Example

./gnfd-cmd  object head --format json gnfd://diiik1/test8911

latest object info:
{"object_status":"OBJECT_STATUS_SEALED","owner":"0xCEE3823C39Fcc9845D7C7144A836562F37995085","bucket_name":"diiik1","object_name":"download.log90","id":"36290","local_virtual_group_id":1,"payload_size":1110920,"visibility":"VISIBILITY_TYPE_INHERIT","content_type":"text/plain;","create_at":"2023-11-20 16:42:59","checksums":{"checksum[0]":"225c3335355c3333352a5c3232355c3233305c3030375c3030306b635c3236325c3234355c32313357755c323631404c5c333434245c3236345c3335373e5c3234375c5c5c3230365c3333375c3032302e5c3330325c323033305c32373622","checksum[1]":"225c3336355c32333339334a5c3030326d2e3c5c30303644617946775c3233315c3231325c3336345c72625c3234325c3335375c333034697b685c3030305c3231365c323030775c3331327022","checksum[2]":"225c333734465c3335347e5c3335365c3337355c32323129","checksum[3]":"..}}
 
 ./gnfd-cmd  bucket head  --format json gnfd://diiik1
latest bucket info:
{"owner":"0xCEE3823C39Fcc9845D7C7144A836562F37995085","bucket_name":"dskj1909","visibility":"VISIBILITY_TYPE_PRIVATE","id":"2189","create_at":"1700725826","payment_address":"0xCEE3823C39Fcc9845D7C7144A836562F37995085","global_virtual_group_family_id":11,"bucket_status":"BUCKET_STATUS_CREATED"}

./gnfd-cmd  group head --format json leo-group
latest group info:
{"owner":"\"0xCEE3823C39Fcc9845D7C7144A836562F37995085\"","group_name":"\"leo-group\"","id":"\"180\""}

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

cmd/cmd_object.go Outdated Show resolved Hide resolved
if createFolderErr := uploadFile(bucketName, path+"/", path, urlInfo, ctx, gnfdClient, true, false, 0); createFolderErr != nil {
// use the base dir to construct object name of the sub-folder
index := strings.Index(path, baseDir)
if index == -1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

cmd/utils.go Show resolved Hide resolved
@flywukong flywukong changed the title feat: support json format for the head commands feat: support format flag to support json content for the head bucket/object/group commands Nov 23, 2023
@flywukong flywukong changed the title feat: support format flag to support json content for the head bucket/object/group commands feat: support format flag to support json content for the head commands Nov 23, 2023
Copy link
Collaborator

@sysvm sysvm left a comment

Choose a reason for hiding this comment

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

LGTM

@flywukong flywukong merged commit a860429 into bnb-chain:master Nov 23, 2023
4 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.

3 participants