Allow registry exporter to work with gRPC objects #142
No reviewers
Labels
No Label
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No Milestone
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/xk6-frostfs#142
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "elebedeva/xk6-frostfs:fix/registry-export-grpc-obj"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Close #139
Added
CID
andOID
keys export ifS3Bucket
orS3Key
is empty.Signed-off-by: Ekaterina Lebedeva ekaterina.lebedeva@yadro.com
@ -69,3 +64,1 @@
comma = ""
for bucket := range bucketMap {
if _, err = f.WriteString(fmt.Sprintf(`%s"%s"`, comma, bucket)); err != nil {
if len(bucketMap) > 1 {
This is wrong:
len(bucketMap)
can happily be 1 if we have exactly 1 S3 bucket, and in this case we need to print it.What we might do instead is to have 2 maps (
bucketMap
andcontainerMap
) and add only nonzero keys to them.fixed
@ -83,0 +85,4 @@
func writeObjectInfo(comma string, info *ObjectInfo, f *os.File) (err error) {
var res string
if info.S3Bucket != "" || info.S3Key != "" {
res += fmt.Sprintf(`%s{"bucket":"%s","object":"%s"}`, comma, info.S3Bucket, info.S3Key)
Why is it
res +=
and notres =
?Didn't notice, fixed
Approved accidentally
91aa27972b
toba769db1e3
@ -62,3 +67,3 @@
}
if _, err = f.WriteString(`],"buckets":[`); err != nil {
if len(bucketMap) > 0 {
Can be shortened to:
fixed
ba769db1e3
to84f698bbdf
@ -65,0 +69,4 @@
if len(bucketMap) > 0 {
err = writeContainerInfo("buckets", bucketMap, f)
} else {
err = writeContainerInfo("containers", containerMap, f)
This is tricky: each object was either put via gRPC or via S3.
But both can be in the registry at the same time, so we should print both maps, I believe.
fixed
@ -70,2 +94,2 @@
for bucket := range bucketMap {
if _, err = f.WriteString(fmt.Sprintf(`%s"%s"`, comma, bucket)); err != nil {
comma := ""
for cnr := range cnrMap {
This change seems unnecessary and pollutes diff (it was
bucketMap
, we could continue to acceptbucketMap
).84f698bbdf
toebdadf2868
@ -63,2 +69,3 @@
if _, err = f.WriteString(`],"buckets":[`); err != nil {
if len(bucketMap) > 0 {
err = errors.Join(err, writeContainerInfo("buckets", bucketMap, f))
Why do you use
errors.Join
?Error on write most likely will result in corrupted file (invalid JSON), we should just return the error.
accidentally pushed, will fix
ebdadf2868
to5a547e6d58
5a547e6d58
to3dd559a7b1