docs/index.mdView |
---|
2 | 2 … | |
3 | 3 … | ### Table of Contents |
4 | 4 … | |
5 | 5 … | - [constructor](#constructor) |
6 | | -- [getSubTree](#getsubtree) |
7 | 6 … | - [get](#get) |
8 | 7 … | - [set](#set) |
9 | 8 … | - [delete](#delete) |
10 | 9 … | - [done](#done) |
14 | 13 … | - [getMerkleLink](#getmerklelink) |
15 | 14 … | |
16 | 15 … | ## constructor |
17 | 16 … | |
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") |
19 | 18 … | |
20 | 19 … | **Parameters** |
21 | 20 … | |
22 | 21 … | - `opts` |
24 | 23 … | - `opts.db` {object} a level db instance alternitly `opts.graph` can be used |
25 | 24 … | - `opts.graph` {object} an instance of [ipld-graph-builder](https://github.com/ipld/js-ipld-graph-builder) alternitvly `opts.dag` can be used |
26 | 25 … | - `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. |
27 | 26 … | |
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 | | - |
41 | 27 … | ## get |
42 | 28 … | |
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") |
44 | 30 … | |
45 | 31 … | gets a value given a key |
46 | 32 … | |
47 | 33 … | **Parameters** |
48 | 34 … | |
49 | 35 … | - `key` **any** |
50 | | -- `decode` |
51 | 36 … | |
52 | 37 … | Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
53 | 38 … | |
54 | 39 … | ## set |
55 | 40 … | |
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") |
57 | 42 … | |
58 | 43 … | stores a value at a given key |
59 | 44 … | |
60 | 45 … | **Parameters** |
65 | 50 … | Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
66 | 51 … | |
67 | 52 … | ## delete |
68 | 53 … | |
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") |
70 | 55 … | |
71 | 56 … | deletes a value at a given key |
72 | 57 … | |
73 | 58 … | **Parameters** |
77 | 62 … | Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
78 | 63 … | |
79 | 64 … | ## done |
|
80 | 65 … | |
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") |
82 | 67 … | |
83 | 68 … | returns a promise that resolve when the tree is done with all of its writes |
84 | 69 … | |
85 | 70 … | Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
86 | 71 … | |
87 | 72 … | ## flush |
88 | 73 … | |
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") |
90 | 75 … | |
91 | 76 … | creates a merkle root for the current tree and stores the data perstantly |
92 | 77 … | |
93 | 78 … | Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
94 | 79 … | |
95 | 80 … | ## emptyTreeState |
96 | 81 … | |
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") |
98 | 83 … | |
99 | 84 … | returns the state of an empty tree |
100 | 85 … | |
101 | 86 … | ## ArrayConstructor |
102 | 87 … | |
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") |
104 | 89 … | |
105 | 90 … | returns an Uint1Array constructir which is used to repersent keys |
106 | 91 … | |
107 | 92 … | Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** |
108 | 93 … | |
109 | 94 … | ## getMerkleLink |
110 | 95 … | |
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") |
112 | 97 … | |
113 | 98 … | returns a merkle link for some given data |
114 | 99 … | |
115 | 100 … | **Parameters** |