git ssb

0+

wanderer🌟 / js-dfinity-radix-tree



Commit 06b2218f6ef66cc3a3f189638221ab05e9d11687

rebuild docs

wanderer committed on 3/1/2018, 2:09:57 AM
Parent: 1d5b8ce3a8cd7e95f4f5918187cbd383ed870576

Files changed

README.mdchanged
docs/index.mdchanged
treeNode.jschanged
README.mdView
@@ -42,10 +42,10 @@
4242 db: db,
4343 root: merkleroot
4444 })
4545
46- const value = await verifier.get('monkey')
47- console.log(value.toString())
46 + const result = await verifier.get('monkey')
47 + console.log(result.value.toString())
4848 }
4949
5050 main()
5151 ```
docs/index.mdView
@@ -2,9 +2,8 @@
22
33 ### Table of Contents
44
55 - [constructor](#constructor)
6-- [getSubTree](#getsubtree)
76 - [get](#get)
87 - [set](#set)
98 - [delete](#delete)
109 - [done](#done)
@@ -14,9 +13,9 @@
1413 - [getMerkleLink](#getmerklelink)
1514
1615 ## constructor
1716
18-[index.js:17-26](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L17-L26 "Source code on GitHub")
17 +[index.js:17-25](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L17-L25 "Source code on GitHub")
1918
2019 **Parameters**
2120
2221 - `opts`
@@ -24,37 +23,23 @@
2423 - `opts.db` {object} a level db instance alternitly `opts.graph` can be used
2524 - `opts.graph` {object} an instance of [ipld-graph-builder](https://github.com/ipld/js-ipld-graph-builder) alternitvly `opts.dag` can be used
2625 - `opts.dag` {object} an instance if [ipfs.dag](https://github.com/ipfs/js-ipfs#dag). If there is no `opts.graph` this will be used to create a new graph instance.
2726
28-## getSubTree
29-
30-[index.js:33-38](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L33-L38 "Source code on GitHub")
31-
32-creates a new instance of RadixTree that is the subTree of the given key
33-
34-**Parameters**
35-
36-- `key` **any**
37-- `decode`
38-
39-Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** resolve to the new instance of RadixTree
40-
4127 ## get
4228
43-[index.js:45-50](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L45-L50 "Source code on GitHub")
29 +[index.js:32-36](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L32-L36 "Source code on GitHub")
4430
4531 gets a value given a key
4632
4733 **Parameters**
4834
4935 - `key` **any**
50-- `decode`
5136
5237 Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
5338
5439 ## set
5540
56-[index.js:100-103](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L100-L103 "Source code on GitHub")
41 +[index.js:86-89](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L86-L89 "Source code on GitHub")
5742
5843 stores a value at a given key
5944
6045 **Parameters**
@@ -65,9 +50,9 @@
6550 Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
6651
6752 ## delete
6853
69-[index.js:148-151](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L148-L151 "Source code on GitHub")
54 +[index.js:134-137](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L134-L137 "Source code on GitHub")
7055
7156 deletes a value at a given key
7257
7358 **Parameters**
@@ -77,39 +62,39 @@
7762 Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
7863
7964 ## done
8065
81-[index.js:210-216](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L210-L216 "Source code on GitHub")
66 +[index.js:196-202](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L196-L202 "Source code on GitHub")
8267
8368 returns a promise that resolve when the tree is done with all of its writes
8469
8570 Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
8671
8772 ## flush
8873
89-[index.js:232-235](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L232-L235 "Source code on GitHub")
74 +[index.js:218-221](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L218-L221 "Source code on GitHub")
9075
9176 creates a merkle root for the current tree and stores the data perstantly
9277
9378 Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
9479
9580 ## emptyTreeState
9681
97-[index.js:265-267](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L265-L267 "Source code on GitHub")
82 +[index.js:247-249](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L247-L249 "Source code on GitHub")
9883
9984 returns the state of an empty tree
10085
10186 ## ArrayConstructor
10287
103-[index.js:273-275](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L273-L275 "Source code on GitHub")
88 +[index.js:255-257](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L255-L257 "Source code on GitHub")
10489
10590 returns an Uint1Array constructir which is used to repersent keys
10691
10792 Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
10893
10994 ## getMerkleLink
11095
111-[index.js:282-284](https://github.com/dfinity/js-dfinity-radix-tree/blob/f2549aeaac0dc25adbecd0d5c3e4acb0f9c5ca94/index.js#L282-L284 "Source code on GitHub")
96 +[index.js:264-266](https://github.com/dfinity/js-dfinity-radix-tree/blob/d8e138d6c098bb9fe80d40c19b9987c94516c5d0/index.js#L264-L266 "Source code on GitHub")
11297
11398 returns a merkle link for some given data
11499
115100 **Parameters**
treeNode.jsView
@@ -52,13 +52,4 @@
5252 exports.isEmpty = function (node) {
5353 const branch = exports.getBranch(node)
5454 return !node['/'][EXTENSION] && !branch[0] && !branch[1] && node['/'][VALUE] === undefined
5555 }
56-
57-// PREFIX := | LBP | RBP | EXT | LB | RB | VALUE |
58-// NODE := | PREFIX | LEN | PAYLOAD
59-const MASK = {
60- EXTENSION: 8,
61- LBRANCH: 4,
62- RBRANCH: 2,
63- VALUE: 1
64-}

Built with git-ssb-web