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

refactor: update listobjects & blocksyncer modules #471

Merged
merged 9 commits into from
May 25, 2023

Conversation

BarryTong65
Copy link
Contributor

@BarryTong65 BarryTong65 commented May 24, 2023

Description

Block Syncer:

  1. Create a prefix tree specifically for the "/" delimiter, and then optimize the query.
  2. Refactor blocksyncer modules
    Metadata:
  3. Update to accommodate SlashPrefixTreeNode in the listobjects interface.
  4. Restore unit tests and add readme
  5. Update logic for getObjectMeta
    Download:
  6. Fix getObject and Universal Endpoint headers

Rationale

To optimize sql and speed up query efficiency

Example

N/A

Changes

Notable changes:

  • create/delete SlashPrefixTreeNode according to different events
  • update listobjects query
  • refactor blocksyncer modules
  • update GetObjectByName query
  • fix downloader's getObject and Universal Endpoint header

@BarryTong65 BarryTong65 added the r4r Ready for review label May 24, 2023
@BarryTong65 BarryTong65 requested review from constwz and krish-nr May 24, 2023 12:39
@BarryTong65 BarryTong65 changed the title feat: update listobjects refactor: update listobjects & db switch May 25, 2023
@BarryTong65 BarryTong65 changed the title refactor: update listobjects & db switch refactor: update listobjects & blocksyncer modules May 25, 2023
@BarryTong65 BarryTong65 requested a review from annielz May 25, 2023 02:23
@annielz annielz force-pushed the refactor-listobjectsapi branch from 65aa9a5 to f79e4fd Compare May 25, 2023 03:55
Copy link
Contributor

@krish-nr krish-nr left a comment

Choose a reason for hiding this comment

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

LGTM for code related to blocksyncer

go.mod Outdated
@@ -1,6 +1,6 @@
module github.com/bnb-chain/greenfield-storage-provider

go 1.20
go 1.19
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to update the golang version?

Copy link
Contributor Author

@BarryTong65 BarryTong65 May 25, 2023

Choose a reason for hiding this comment

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

it's now fixed.

core/README.md Outdated
@@ -65,6 +65,8 @@ Infrastructure interface includes:
must be a singleton.
* [Uploader](./module/README.md): Uploader is the modular to handle put object request from user
account, and store it in primary SP's piece store.
* [Metadata](./module/README.md): Metadata is the modular to handle the get request of metadata of objects,
Copy link
Contributor

Choose a reason for hiding this comment

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

Metadata module have not define the interface in core level, it is can not offer the customization ability.
This is not one of the standardized processes in the gfsp framework, so it is not recommended to add the introduction in the core layer. This will cause misleading, you can add it in modular/metadata/README.md

Copy link
Collaborator

Choose a reason for hiding this comment

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

done


## Metadata
Metadata is the modular to handle the get request of metadata of objects,
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Collaborator

Choose a reason for hiding this comment

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

done

w.Header().Set(model.ContentTypeHeader, objectInfo.GetContentType())
if isRange {
w.Header().Set(model.ContentRangeHeader, "bytes "+util.Uint64ToString(uint64(low))+
"-"+util.Uint64ToString(uint64(high)))
} else {
w.Header().Set(model.ContentLengthHeader, util.Uint64ToString(objectInfo.GetPayloadSize()))
}
w.Write(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

why change the location for write body?

Copy link

Choose a reason for hiding this comment

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

@will-2012 told me that frontend peers found if the write of data is before the header, it will cause the headers to not be written correctly. This was fixed in develop branch by Will, but not in this refactor code, so adding it here.

@@ -0,0 +1,51 @@
package registrar
Copy link
Contributor

Choose a reason for hiding this comment

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

blocksyncer/modular/modules seems not good name.
modules is special for ‘metadata’, 'uploader' etc.
here modules have some confusion with the above.

Copy link
Contributor Author

@BarryTong65 BarryTong65 May 25, 2023

Choose a reason for hiding this comment

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

We have expanded the interface of Juno in SP and implemented it. In Juno, every data module is conceptualized as 'modules', so we have aligned it here.
cc @krish-nr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@krish-nr krish-nr force-pushed the refactor-listobjectsapi branch from fc8d501 to 9f1acd6 Compare May 25, 2023 08:31
@annielz annielz merged commit 424ea6a into release-refactor-v0.2.1 May 25, 2023
joeylichang added a commit that referenced this pull request May 26, 2023
* fix: data query issues caused by character set replacement (#431)

* fix:blocksyncer statement policy id

* refactor: add gfsp interface, frame, moduler

refactor: add modular entry

refactor: delete redundant code

refactor: add modular options

refactor: tidy entry of gfsp

refactor: delete config dir

feat: add intergrity interface impl

docs: add task readme and annotation

docs: add core modular readme

docs: add piece store docs

docs: add core readme

docs: add error code readme

docs: add bass app readme

refactor: add register modular in main

chore: tidy error code

feat: add manager status

feat: add executor mertic and state

feat: add task info interface for log and debug

feat: add compute func for secondary approval expired height

feat: code tidy for ask approval workflow

feat: code tidy for challenge workflow

feat: code tidy for replicate piece workflow

feat: code tidy for bucket quata workflow

feat: code tidy for upload and download object workflow

feat: code tidy for gfsp config and main entry

feat: code tidy for gfsp client

feat: code tidy for gfsp app dir

feat: code tidy for metrics

feat: code tidy for executor

feat: code tidy for manager

* Release refactor v0.2.1 query cli (#444)

* feat: add query task service and cli command

* fix: add register query service to grpc server

* feat: add p2p ant address config (#446)

* fix: fix check actions (#440)

* fix: fix e2e action

* fix: fix lint action

* fix: fix ut action

---------

Co-authored-by: will-2012 <xibaow2020@qq.com>

* chore: add code format (#443)

* fix: update go.mod (#452)

Co-authored-by: VM <arimas@foxmail.com>

* fix: fix new piece store and spdb (#460)

Co-authored-by: VM <arimas@foxmail.com>

* fix: base app rcmgr span panic (#462)

* chore: refine the refactored branch codes (#451)

* fix: task queue gc delay when call has method (#464)

* refactor:blocksyncer (#450)

* refactor: add block syncer modular
---------

Co-authored-by: constwz <changbohao@gmail.com>

* feat: metadata refactor v0.2.1 (#449)

feat: migrate all metadata methods clients and services

add getObjects handler

fix: runnable retriever

feat: migrate get bucket meta and get object meta

feat: migrate universal endpoint and related methods

feat: migrate switch db

feat: unify naming from retriever to metadata

fix: tests and switch db logic

fix: remove outdated metadata proto

fix: protobuf lint

fix: golangci-lint

fix: db switch and e2e test

fix:typo

fix: e2e script

fix: tests

fix: update switch db logic

fix: naming of methods

fix: restore auth

* chore: add error for cal nil model (#468)

* refactor: update listobjects & blocksyncer modules (#471)

* feat: update listobjects

* fix: add bsdb metadata readme, restore tests, fix get object ue

* fix: adapt juno latest version

* refactor: update go mod

* refactor: update go version to 1.20

* fix: move metadata readme

* fix: bsdb init allow error

* feat: more readme contexts

fix: typo

* fix: update juno version

---------

Co-authored-by: annielz <lmlmzhen@sina.com>
Co-authored-by: krish-nr <krish.z@nodereal.io>

* fix: swtich query error (#476)

* fix: fix sp metrics var name (#474)

Co-authored-by: VM <arimas@foxmail.com>

* refactor: update stop serving module (#473)

* refactor: update stop serving module

* refactor: refactor codes and fix review comments

* fix: fix nonce issue

* chore: add default discontinue bucket keep alive days

---------

Co-authored-by: joeylichang <joeycli0919@gmail.com>

* build: update greenfield chain version (#475)

* chore: refine some codes

* fix: fix error code judgment logic

* chore: refine e2e yml

* build: update greenfield chain dependency

---------

Co-authored-by: will-2012 <xibaow2020@qq.com>

* fix: metrics items name error (#477)

* build: update e2e yml (#479)

Co-authored-by: will-2012 <xibaow2020@qq.com>

* fix: add get public object auth (#481)

* fix: check public object auth

* chore: rm log file

---------

Co-authored-by: Barry <122767193+BarryTong65@users.noreply.github.com>
Co-authored-by: constwz <changbohao30@gmail.com>
Co-authored-by: constwz <122766871+constwz@users.noreply.github.com>
Co-authored-by: actioncli <joeycli0919@qq.com>
Co-authored-by: will-2012 <117156346+will-2012@users.noreply.github.com>
Co-authored-by: will-2012 <xibaow2020@qq.com>
Co-authored-by: Fynn <zcheng1004@gmail.com>
Co-authored-by: VM <112189277+sysvm@users.noreply.github.com>
Co-authored-by: VM <arimas@foxmail.com>
Co-authored-by: constwz <changbohao@gmail.com>
Co-authored-by: Annie <108039750+annielz@users.noreply.github.com>
Co-authored-by: annielz <lmlmzhen@sina.com>
Co-authored-by: krish-nr <krish.z@nodereal.io>
Co-authored-by: forcodedancing <just.haha.it@gmail.com>
@sysvm sysvm deleted the refactor-listobjectsapi branch May 26, 2023 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r4r Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants