IPFS Block Layer

Concept

  • blocks
    block是一个包含data和cid的结构,go-block-format中定义了Block接口,和一个BasicBlock;
    // Package blocks contains the lowest level of IPLD data structures.
    // A block is raw data accompanied by a CID. The CID contains the multihash
    // corresponding to the block.

  • Blockstore
    Blockstore基本上就是个k-v数据库,根据CID存取block
    go-ipfs-blockstore中定义了Blockstore接口,以及GCBlockStore接口,GCBlockstore继承了Blockstore;应该看一下GCBlockstore规定需要实现的方法;
    // Package blockstore implements a thin wrapper over a datastore, giving a
    // clean interface for Getting and Putting block objects.

  • BlockService
    go-blockservice中定义了BlockService的接口,用于给DAG层提供服务
    // package blockservice implements a BlockService interface that provides
    // a single GetBlock/AddBlock interface that seamlessly retrieves data either
    // locally or from a remote peer through the exchange.

Note

这些概念位于IPFS的Blcok层;顺带说一下,这一层只负责以k-v方式存取block,不知道block之间的结构和关系;

你可能感兴趣的:(IPFS)