Skip to content

Commit

Permalink
Translate chinese to english and remove redundant parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
streetycat committed May 15, 2023
1 parent beec9d0 commit ceada20
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 82 deletions.
14 changes: 0 additions & 14 deletions src/component/cyfs-group-lib/readme.md

This file was deleted.

13 changes: 3 additions & 10 deletions src/component/cyfs-group-lib/src/requestor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ impl GroupRequestor {
Arc::new(Box::new(self.clone()))
}

fn encode_common_headers(
&self,
action: NONAction,
com_req: &NONOutputRequestCommon,
http_req: &mut Request,
) {
fn encode_common_headers(&self, com_req: &NONOutputRequestCommon, http_req: &mut Request) {
let dec_id = com_req.dec_id.as_ref().unwrap_or(&self.dec_id);
http_req.insert_header(cyfs_base::CYFS_DEC_ID, dec_id.to_string());

Expand All @@ -57,8 +52,6 @@ impl GroupRequestor {
com_req.req_path.as_deref(),
);

http_req.insert_header(cyfs_base::CYFS_NON_ACTION, action.to_string());

http_req.insert_header(CYFS_API_LEVEL, com_req.level.to_string());

if let Some(target) = &com_req.target {
Expand Down Expand Up @@ -99,7 +92,7 @@ impl GroupRequestor {
rpath: rpath.to_string(),
};

self.encode_common_headers(NONAction::PutObject, &req_common, &mut http_req);
self.encode_common_headers(&req_common, &mut http_req);
let body = req.encode_string();
http_req.set_body(body);

Expand Down Expand Up @@ -157,7 +150,7 @@ impl GroupRequestor {
let url = self.service_url.join("proposal").unwrap();
let mut http_req = Request::new(Method::Put, url);

self.encode_common_headers(NONAction::PutObject, &req_common, &mut http_req);
self.encode_common_headers(&req_common, &mut http_req);

NONRequestorHelper::encode_object_info(
&mut http_req,
Expand Down
82 changes: 24 additions & 58 deletions src/component/cyfs-group/src/statepath/design.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,38 @@
```
/--groups // for manager;通过决议以后构造/更新的Group对象放在这里,更新步骤
| | // 1.得到一个创建/更新一个Group的决议(旧成员一定量的投票+所有新成员签名)
| | // 形成决议的方式可以是合约,也可以是超送用`DEC框架`实现的DEC
| | // 2.跟friend管理一样,用决议设定到系统更新Group信息
| | // 3.更新Group下所有r-path的本地Group版本,并达成共识;这里主要要同步ood-list
| |--list-->Set<GroupId>
| |--option-->GroupOption
|
|--${group-id}
|--${group-id} // one group
| |--${DecId("shells", ${group-id})}
| | |--.shells
| | |--.latest-->GroupShell // latest version
| | |--${group.version}-->GroupShell // add shells for history versions of group
| |--${dec-id}
| |--.dec-state-->ObjectId // for dec;各Group的dec状态放这里
| | // APP控制的实体状态,通常是个map-id
| | // 最终在APP看到的${r-path}结构是这级物理结构的相对路径
| | // 其他内部逻辑隐藏掉
| | // 每个${r-path}管理范围内是串行的
| | // 不同${r-path}范围内的操作是并行的
| | // 且不同${r-path}之间是并列的,不能嵌套
| |--.link // 区块链结构,记录状态变更链条
| |--${r-path}
| |--users
| |--${dec-id} // one dec for a group
| |--${r-path}
| |--.dec-state-->ObjectId // for dec;the latest state of all groups
| | // one state of a r-path, It's calculated by the app, and it's a map-id in most times
| | // Each state change for same ${r-path} is serial
| | // Each state change for different ${r-path} is parallel
| | // **The process of state change for different ${r-path} should always not be nested, Because the change of each branch will affect the state of the root**
| |--.link // Blockchain for hotstuff, record the state change chain,Most of the time, application developers do not need to pay attention
| |--group-blob-->BLOB(Group) // the latest group, it's store as chunk, so, it'll not be updated by different version
| |--users // info of any user, is useful?
| | |--${user-id}
| | |--xxx
| |--last-vote-round-->u64 // 最后一次投票的 轮次
| |--last-qc-->GroupQuorumCertificate // 最后一次被确认的共识证明
| |--last-vote-round-->u64 // the round that I voted last time
| |--last-qc-->GroupQuorumCertificate
| |
| |--range-->(${first_height}, ${header_height}) // 保留的历史block序列号区间
| |--str(${height})->block
| |--range-->(${first_height}, ${header_height}) // the range retained, we can remove some history
| |--str(${height})->block // commited blocks with any height, QC(Quorum Certificate) by next blocks at least 2
| |
| |--prepares // Prepare状态的block
| |--prepares // prepare blocks, with QC for pre-block(pre-commit/commited), but not QC by any one
| | |--${block.id}
| | |--block
| | |--result-state-->ObjectId(result-state)
| |--pre-commits // pre-commit状态的block
| | |--block
| | |--result-state-->ObjectId(result-state) // hold the ref to avoid recycle
| |--pre-commits // pre-commit blocks, with QC for the header block, and is QC by a prepare block
| | |--${block.id}
| | |--block
| | |--result-state-->ObjectId(result-state)
| | |--block
| | |--result-state-->ObjectId(result-state) // hold the ref to avoid recycle
| |
| |--finish-proposals
| | |--flip-time-->Timestamp // 取block时间戳
| | |--over-->Set<ObjectId>
| |--finish-proposals // The proposal is de-duplicated. Proposals that exceed the timeout period are directly discarded, and those within the timeout period are de-duplicated by the list
| | |--flip-time-->Timestamp // the timestamp of the first block
| | |--recycle-->Set<ObjectId>
| | |--adding-->Set<ObjectId>
```

```
// .group结构
/--${group-id}
|--ObjectId(.group)
|--.update
|--voting
| |--${proposal-id}
| |--proposal-->GroupUpdateProposal
| |--decides-->Set<decide-proposal>
|--latest-version-->GroupUpdateProposal // Chunk(Encode(group))
|--str(version-seq)-->GroupUpdateProposal // Chunk(Encode(group))
|--str(group-hash)-->GroupUpdateProposal
```

member 同步结构

```
|--${/} // config by the DecAPP
|--${group-id}
|--${r-path}
|--state-->ObjectId // the latest state
|--block-->Block // the hightest block
|--qc-->qc-block // the qc for the ${block}
```

0 comments on commit ceada20

Please sign in to comment.