Skip to content

Commit

Permalink
docs: move SP cmd/module/api docs docs.bnbchain.org to sp repo (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruojunm committed May 15, 2024
1 parent ec154a1 commit 0c9a3ba
Show file tree
Hide file tree
Showing 64 changed files with 5,214 additions and 929 deletions.
Binary file removed docs/asset/01-sp_arch.jpg
Binary file not shown.
Binary file removed docs/asset/02-get_approval.jpg
Binary file not shown.
Binary file removed docs/asset/03-put_object.jpg
Binary file not shown.
Binary file removed docs/asset/04-replicate_object.jpg
Binary file not shown.
Binary file removed docs/asset/05-get_object.jpg
Binary file not shown.
Binary file removed docs/asset/06-query_meta.jpg
Binary file not shown.
Binary file removed docs/asset/07-challenge.jpg
Binary file not shown.
Binary file removed docs/asset/08-gc_object.jpg
Binary file not shown.
Binary file removed docs/asset/09-piecestore_arch.jpg
Binary file not shown.
Binary file removed docs/asset/10-ec.jpg
Binary file not shown.
Binary file removed docs/asset/11-gater.jpg
Binary file not shown.
Binary file removed docs/asset/12-manager.jpg
Binary file not shown.
Binary file removed docs/asset/13-bucket_migrate.jpg
Binary file not shown.
Binary file removed docs/asset/14-sp_exit.jpg
Binary file not shown.
77 changes: 0 additions & 77 deletions docs/introduction/overview.md

This file was deleted.

18 changes: 6 additions & 12 deletions docs/modules/approver.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Approver

Approver module is used to handle approval requests including `CreateBucketApproval`, `MigrateBucketApproval` and `CreateObjectApproval`. The workflow of Approver users can refer [GetApproval](../workflow/workflow.md#get-approval). We currently abstract SP as the GfSp framework, which provides users with customizable capabilities to meet their specific requirements. Approver module provides an abstract interface, which is called `Approver`, as follows:
Approver module is used to handle approval requests including `MigrateBucketApproval` . The workflow of Approver users can refer [GetApproval](../introduction/workflow.md#get-approval). We currently abstract SP as the GfSp framework, which provides users with customizable capabilities to meet their specific requirements. Approver module provides an abstract interface, which is called `Approver`, as follows:

Approver is an abstract interface to handle ask approval requests.

Expand Down Expand Up @@ -36,33 +36,27 @@ type Approver interface {

Approver interface inherits [Modular interface](./common/lifecycle_modular.md#modular-interface), so Approver module can be managed by lifecycle and resource manager.

In terms of the functions provided by Approver module, it can be divided into two parts: CreateBucketApproval and CreateObjectApproval. Both CreateBucketApproval and CreateObjectApproval have three methods: PreXXX, HanldeXXX and PostXXX. Therefore, if you can rewrite these methods to meet your own requirements.
The functionality of the Approver module is primarily centered around the MigrateBucketApproval process. This process encompasses three distinct phases, each managed by a dedicated method: PreXXX for preliminary actions, HandleXXX for core processing, and PostXXX for follow-up operations. Users have the flexibility to customize these methods to align with their specific needs, enabling a tailored approach to the migration process.

As we can see from the second parameter of the methods defined in `Approver` interface, bucketApproval is splitted into `ApprovalCreateBucketTask` and objectApproval is splitted into `ApprovalCreateObjectTask`. They are also defined as an interface.
The second parameter in PreMigrateBucketApproval(ctx context.Context, task task.ApprovalMigrateBucketTask), which is ApprovalMigrateBucketTask, is also an interface. This design facilitates future customization by the user.

We can query ApprovalCreateBucket and ApprovalCreateObject tasks that we care about by `QueryTasks` method through using subKey.
We can query ApprovalMigrateBucket task that we care about by `QueryTasks` method through using subKey.

## ApprovalCreateBucketTask and ApprovalCreateObjectTask
## ApprovalMigrateBucketTask

ApprovalTask is used to record approval information for users creating buckets and objects. Primary SP approval is required before serving the bucket and object. If the SP approves the message, it will sign the approval message. The greenfield will verify the signature of the approval message to determine whether the SP accepts the bucket and object. ApprovalTask includes `ApprovalCreateBucketTask` and `ApprovalCreateBucketTask`.
ApprovalTask is used to record approval information for users creating buckets and objects. Primary SP approval is required before serving the bucket and object. If the SP approves the message, it will sign the approval message. The greenfield will verify the signature of the approval message to determine whether the SP accepts the bucket and object. ApprovalTask includes `ApprovalMigrateBucketTask`.

The corresponding interfaces definition is shown below:

- [ApprovalTask](./common/task.md#approvaltask)
- [ApprovalCreateBucketTask](./common/task.md#approvalcreatebuckettask)
- [ApprovalMigrateBucketTask](./common/task.md#approvalmigratebuckettask)
- [ApprovalCreateObjectTask](./common/task.md#approvalcreateobjecttask)

ApprovalTask interface inherits [Task interface](./common/task.md#task), it describes what operations does a Task have. You can overwrite all these methods in your own.

The corresponding `protobuf` definition is shown below:

- [GfSpCreateBucketApprovalTask](./common/proto.md#gfspcreatebucketapprovaltask-proto)
- [GfSpMigrateBucketApprovalTask](./common/proto.md#gfspmigratebucketapprovaltask-proto)
- [GfSpCreateObjectApprovalTask](./common/proto.md#gfspcreateobjectapprovaltask-proto)
- [MsgCreateBucket](./common/proto.md#msgcreatebucket-proto)
- [MsgMigrateBucket](./common/proto.md#msgmigratebucket-proto)
- [MsgCreateObject](./common/proto.md#msgcreateobject-proto)

## GfSp Framework Approver Code

Expand Down
Loading

0 comments on commit 0c9a3ba

Please sign in to comment.