数据存储配置选项

本文档描述了 ipfs 配置文件中的Datastore.Spec字段不同的值.

flatfs

将每个键值对存储 为文件系统上的文件.

shardFunc-碎片 的前缀是/repo/flatfs/shard/v1,然后是分片策略的描述符. 一些示例值是:

  • /repo/flatfs/shard/v1/next-to-last/2
    • 密钥的最后两个字符旁边的碎片
  • /repo/flatfs/shard/v1/prefix/2
    • 密钥的两个字符前缀的碎片
  1. {
  2. "type": "flatfs",
  3. "path": "<relative path within repo for flatfs root>",
  4. "shardFunc": "<a descriptor of the sharding scheme>",
  5. "sync": true | false
  6. }

注意: flatfs 仅用作 块存储 (安装在/blocks) 作为当前的实现尚未完成.

levelds

使用 leveldb 数据库 存储键值对.

  1. {
  2. "type": "levelds",
  3. "path": "<location of db inside repo>",
  4. "compression": "none" | "snappy"
  5. }

badgerds

使用badger作为一个键值存储.

  1. {
  2. "type": "badgerds",
  3. "path": "<location of badger inside repo",
  4. "syncWrites": true | false
  5. }

挂载

允许指定的数据存储区 处理 前缀为给定路径的键. 挂载点 将作为子数据存储 定义中的键添加.

  1. {
  2. "type": "mount",
  3. "mounts": [
  4. {
  5. // Insert other datastore definition here, but add the following key:
  6. "mountpoint": "/path/to/handle"
  7. },
  8. {
  9. // Insert other datastore definition here, but add the following key:
  10. "mountpoint": "/path/to/handle"
  11. }
  12. ]
  13. }

测量-measure

此数据存储区是一个包装程序,用来添加 跟踪指标 到任何数据存储区.

  1. {
  2. "type": "measure",
  3. "prefix": "sometag.datastore",
  4. "child": { datastore being wrapped }
  5. }