@cryptotaxi247 / kubo / commits / 70be25e3e

documentify

License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>

Jeromy committed Sep 7, 2017 at 16:18 UTC 70be25e3e5cf0f4ccec63a69ecf166bf83f1f288
2 files changed +112 -12
docs/config.md
+36 -12
@@ -68,11 +68,6 @@ Default: The ipfs.io bootstrap nodes
68 Contains information related to the construction and operation of the on-disk
69 storage system.
70
71 -- `Type`
72 -Denotes overall datastore type. The only currently valid option is `leveldb`.
73 -
74 -Default: `leveldb`
75 -
71 - `Path`
72 Path to the leveldb datastore directory. Set during init to either `$IPFS_PATH/datastore`, or `$HOME/.ipfs/datastore` if `$IPFS_PATH` is unset.
73
@@ -91,11 +86,6 @@ A time duration specifying how frequently to run a garbage collection. Only used
86
87 Default: `1h`
88
94 -- `NoSync` *!*
95 -A boolean value denoting whether or not to disable sanity syncing in the flatfs datastore code. Setting this to true may significantly improve performance, but be careful using it as if the daemon is killed before a write is synchronized to disk, there is a chance of data loss.
96 -
97 -Default: `false`
98 -
89 - `HashOnRead`
90 A boolean value. If set to true, all block reads from disk will be hashed and verified. This will cause increased CPU utilization.
91
@@ -104,8 +94,42 @@ A number representing the size in bytes of the blockstore's bloom filter. A valu
94
95 Default: `0`
96
107 -- `Params`
108 -Extra parameters for datastore construction, not currently used.
97 +- `Spec`
98 +Spec defines the structure of the ipfs datastore. It is a composable structure, where each datastore is represented by a json object. Datastores can wrap other datastores to provide extra functionality (eg metrics, logging, or caching).
99 +
100 +This can be changed manually, however, if you make any changes that require a different on-disk structure, you will need to run the [ipfs-ds-convert tool](https://github.com/ipfs/ipfs-ds-convert) to migrate data into the new structures.
101 +
102 +For more information on possible values for this configuration option, see docs/datastores.md
103 +
104 +Default:
105 +```
106 +{
107 + "mounts": [
108 + {
109 + "child": {
110 + "path": "blocks",
111 + "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
112 + "sync": true,
113 + "type": "flatfs"
114 + },
115 + "mountpoint": "/blocks",
116 + "prefix": "flatfs.datastore",
117 + "type": "measure"
118 + },
119 + {
120 + "child": {
121 + "compression": "none",
122 + "path": "datastore",
123 + "type": "levelds"
124 + },
125 + "mountpoint": "/",
126 + "prefix": "leveldb.datastore",
127 + "type": "measure"
128 + }
129 + ],
130 + "type": "mount"
131 +}
132 +```
133
134 ## `Discovery`
135 Contains options for configuring ipfs node discovery mechanisms.
docs/datastores.md new
+76
@@ -0,0 +1,76 @@
1 +# Datastore Configuration Options
2 +
3 +This document describes the different possible values for the `Datastore.Spec`
4 +field in the ipfs configuration file.
5 +
6 +## flatfs
7 +Stores each key value pair as a file on the filesystem.
8 +
9 +The shardFunc is prefixed with `/repo/flatfs/shard/v1` then followed by a descriptor of the sharding strategy. Some example values are:
10 +- `/repo/flatfs/shard/v1/next-to-last/2`
11 + - Shards on the two next to last characters of the key
12 +- `/repo/flatfs/shard/v1/prefix/2`
13 + - Shards based on the two character prefix of the key
14 +
15 +```json
16 +{
17 + "type": "flatfs",
18 + "path": "<relative path within repo for flatfs root>",
19 + "shardFunc": "<a descriptor of the sharding scheme>",
20 + "sync": true|false
21 +}
22 +```
23 +
24 +## levelds
25 +Uses a leveldb database to store key value pairs.
26 +
27 +```json
28 +{
29 + "type": "levelds",
30 + "path": "<location of db inside repo>",
31 + "compression": "none" | "snappy",
32 +}
33 +```
34 +
35 +## badgerds
36 +Uses [badger](https://github.com/dgraph-io/badger) as a key value store.
37 +
38 +```json
39 +{
40 + "type": "badgerds",
41 + "path": "<location of badger inside repo",
42 + "syncWrites": true|false
43 +}
44 +```
45 +
46 +## mount
47 +Allows specified datastores to handle keys prefixed with a given path.
48 +The mountpoints are added as keys within the child datastore definitions.
49 +
50 +```json
51 +{
52 + "type": "mount",
53 + "mounts": [
54 + {
55 + // Insert other datastore definition here, but add the following key:
56 + "mountpoint": "/path/to/handle"
57 + },
58 + {
59 + // Insert other datastore definition here, but add the following key:
60 + "mountpoint": "/path/to/handle"
61 + },
62 + ]
63 +}
64 +```
65 +
66 +## measure
67 +This datastore is a wrapper that adds metrics tracking to any datastore.
68 +
69 +```json
70 +{
71 + "type": "measure",
72 + "prefix": "sometag.datastore",
73 + "child": { datastore being wrapped }
74 +}
75 +```
76 +