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

Introduction CYFS for Developers(Part6-2): Components(cyfs-core) #137

Closed
streetycat opened this issue Mar 22, 2023 · 0 comments
Closed

Introduction CYFS for Developers(Part6-2): Components(cyfs-core) #137

streetycat opened this issue Mar 22, 2023 · 0 comments
Labels
Docs Improvements or additions to documentation

Comments

@streetycat
Copy link
Collaborator

streetycat commented Mar 22, 2023

cyfs-core

I mentioned 4 object categories in previous issue. The Core object is collected in the crate cyfs-core.Many object types have been collected, most of those support the functions of the current CYFS system.

common

  • Text
    It's a common Object to describe a String.You can save a short(<=31Bytes) string in the ObjectId immediately building with the ObjectIdDataBuilder.Otherwise, you can use the Text object.

    It contains 3 fields:

    • id: immutable
    • header: immutable
    • value mutable
      I can't tell the design intent from the field name, maybe it need to rename or redesign?
      You can flexibly use these three fields according to your needs, for example:
    • Make a mutable Text,fill the id with key, and file the value with the content, header for other immutable annotation.
    • Make a immutable simple Text,fill the id with the content, header for immutable annotation, and value for mutable annotation.
    • Make a immutable large(>=64KBytes,Actually less for the header of Desc) Text, fill the value with the content, and fill the id with the hash of content to verify the value, header for immutable annotation.
    • Other usage
  • Storage
    It's a common Object to describe a binary buffer(Vec),it can describe both the immutable and mutable buffer.

    It contains 3 fields:

    • id: immutable,set by the creator.
    • hash: immutable,the hash of the buffer,set None if the buffer is mutable to avoid the ObjectId is changed when the buffer is changed.
    • value: mutable, the content of the buffer.

app

It supports the running of the system service app-manager,Various related entity objects and behavior objects are defined here.

  • DecApp
    Describe App Details, the main fields as follow:
    • id: immutable, UniqueId?
    • source: mutable, what?
    • icon: mutable
    • desc: mutable, the description for the App
    • source_desc: mutable, what?
    • tags: tags for the App
  • AppCmd: Describe the control commands for APP, it has 2 fields:
    • app id
    • command code:
      • Add: add the app to the app list.
      • Remove: remove the app from the app list
      • Install: install the app in my zone
      • Uninstall: uninstall the app from my zone
      • Start: start the app
      • Stop
      • SetPermission: update the permission for the app
      • SetQuota: config the limit amout of resource for the app
      • SetAutoUpdate
  • AppCmdList
    Use this object when we need to execute multiple commands sequentially.
  • AppList
    APP list organized by category, the main fields as follow:
    • category: immutable, the name of the APP category
    • id: immutable, set by user to manage the APP category when the AppList is created, What's the different with category field? It's unique?
    • list of applications: mutable,The latest version is maintained by OOD in the zone.
  • AppLocalList
    What does the Local mean?
  • AppLocalStatus
    What does the Local mean?
  • AppManagerAction
    Is it related to the implementation logic of AppManager?
  • AppSetting
    Configuration for the app.
  • AppStatus
    • id: immutable,DecAppId.
    • version: mutable
    • status: mutable, Why is it a boolean?
      The latest version is maintained by OOD in the zone.
  • DefaultAppList
    APPs that are automatically installed after the CYFS system is installed.

group

There is a issue for it.The core objects for group is implemented in cyfs-core.

We use the blockchain structure to record the state evolution process of the Group.The consensus algorithm is Hotstuff.

  • GroupProposal
    The object that prompts the infomation of group to update.It will answer the DECApp 3 questions:

    • Who want to update?
    • What does he want to update?
    • How to update?
      The fields is follow:
    • rpath: immutable, rpath the blockchain is running on.there is a blockchain is running for each rpath of the group.
    • method: immutable,the method provided by the DECApp,it will be called with the proposal.
    • params: immutable, the parameters for the method, it's defined and parsed by the DECApp.
    • meta_block_id: immutable,the highest block on MetaChain currently,Indicates that this proposal was made after the block on MetaChain.
    • effective_begining: immutable, when the proposal will effective.
    • effective_ending: immutable, when the proposal will invalid, The proposal should be discarded if it has not reached consensus after effective_ending.
    • payload: mutable, A buffer reserved for DECApp, the DECApp guarantees its correctness. It's usefull when the params is large.
  • GroupQuorumCertificate
    The certificate to the blocks for Hotstuff.It has 2 types:

    • QC: the quorum certificate for the previous block.
      • block_id: immutable,current blockid.
      • prev_block_id: immutable,the previous block will be proven.
      • round: immutable,the round of the previous block.
      • votes: immutable,the set of signatures for the QC.
        • voter: the signer
        • signature: the signature
    • TC:the timeout certificate for last round.
      • round: immutable,the timeout round number
      • votes: immutable,the set of signatures for the round
        • voter: the signer
        • high_qc_round: the max round of the block which has collect the QC.
        • signature: the signature
  • GroupConsensusBlock
    GroupConsensusBlock is used to describe the content of each block.
    The fields is follow:

    • rpath: immutable, rpath the blockchain is running on.there is a blockchain is running for each rpath of the group.
    • body_hash: immutable, the hash of GroupConsensusBlock, is used to verify the body.
    • result_state_id: immutable, the ObjectId of the result calculated by the DECApp,
    • height: immutable, the height of the block.
    • meta_block_id: immutable,the highest block on MetaChain currently,Indicates that this block was constructed after the block on MetaChain.
    • round: immutable,the round to vote for the block,used by Hotstuff.
    • group_chunk_id: immutable,the version of Group the block is depend on.
    • proposals: immutable,save in body, verify by body_hash,the set of the proposals(proposal/result/receipt/context) collected by the block.
    • qc: immutable,save in body, verify by body_hash,the quorum certificate for the previous block.
    • tc: immutable,save in body, verify by body_hash,the timeout certificate for last round.

nft

NFT is a popular application scenario in recent years.CYFS collect and defined its own NFT objects.In theory,any named data is NFT in CYFS,but most NFTs are files in fact.So NFT is limited to file types.
* NFTList
Is a file list:
* nft_list: immutable, file list.

trans

I don't know this part?

  • TransContext

zone

It's the manager of the devices belonging to the same owner.

  • Zone
    The field is follow:
    • owner: immutable
    • ood_list: mutable
    • known_device_list: mutable
      How to maintain the latest version of the Body?
@streetycat streetycat added the Docs Improvements or additions to documentation label Mar 22, 2023
@streetycat streetycat changed the title Introduction CYFS for Developers(Part6-2): Components (cyfs-core) Docs Introduction CYFS for Developers(Part6-2): Components (cyfs-core) Mar 25, 2023
@streetycat streetycat changed the title Introduction CYFS for Developers(Part6-2): Components (cyfs-core) Introduction CYFS for Developers(Part6-2): Components:cyfs-core Mar 25, 2023
@streetycat streetycat changed the title Introduction CYFS for Developers(Part6-2): Components:cyfs-core Introduction CYFS for Developers(Part6-2): Components(cyfs-core) Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant