docs/index.mdView |
---|
6 | 6 … | - [get](#get) |
7 | 7 … | - [set](#set) |
8 | 8 … | - [delete](#delete) |
9 | 9 … | - [flush](#flush) |
| 10 … | +- [emptyTreeState](#emptytreestate) |
10 | 11 … | - [ArrayConstructor](#arrayconstructor) |
11 | | -- [toTypedArray](#totypedarray) |
12 | 12 … | |
13 | 13 … | ## constructor |
14 | 14 … | |
15 | | -[index.js:20-23](https://github.com/wanderer/merkle-radix-tree/blob/c05ecac437698d9d42b13f01e4931e3d7469affe/index.js#L20-L23 "Source code on GitHub") |
| 15 … | +[index.js:17-24](https://github.com/wanderer/js-dfinity-radix-tree/blob/24407d385e0f7cc8eed70abe5a5e927a092ebe60/index.js#L17-L24 "Source code on GitHub") |
16 | 16 … | |
17 | 17 … | **Parameters** |
18 | 18 … | |
19 | 19 … | - `opts` |
20 | 20 … | - `opts.root` {object} a merkle root to a radix tree. If none, RadixTree will create an new root. |
| 21 … | + - `opts.db` {object} a level db instance alternitly `opts.graph` can be used |
21 | 22 … | - `opts.graph` {object} an instance of [ipld-graph-builder](https://github.com/ipld/js-ipld-graph-builder) alternitvly `opts.dag` can be used |
22 | 23 … | - `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. |
23 | 24 … | |
24 | 25 … | ## get |
25 | 26 … | |
26 | | -[index.js:112-116](https://github.com/wanderer/merkle-radix-tree/blob/c05ecac437698d9d42b13f01e4931e3d7469affe/index.js#L112-L116 "Source code on GitHub") |
| 27 … | +[index.js:102-106](https://github.com/wanderer/js-dfinity-radix-tree/blob/24407d385e0f7cc8eed70abe5a5e927a092ebe60/index.js#L102-L106 "Source code on GitHub") |
27 | 28 … | |
28 | 29 … | gets a value given a key |
29 | 30 … | |
30 | 31 … | **Parameters** |
34 | 35 … | Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
35 | 36 … | |
36 | 37 … | ## set |
37 | 38 … | |
38 | | -[index.js:123-166](https://github.com/wanderer/merkle-radix-tree/blob/c05ecac437698d9d42b13f01e4931e3d7469affe/index.js#L123-L166 "Source code on GitHub") |
| 39 … | +[index.js:113-149](https://github.com/wanderer/js-dfinity-radix-tree/blob/24407d385e0f7cc8eed70abe5a5e927a092ebe60/index.js#L113-L149 "Source code on GitHub") |
39 | 40 … | |
40 | 41 … | stores a value at a given key |
41 | 42 … | |
42 | 43 … | **Parameters** |
47 | 48 … | Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
48 | 49 … | |
49 | 50 … | ## delete |
|
50 | 51 … | |
51 | | -[index.js:173-224](https://github.com/wanderer/merkle-radix-tree/blob/c05ecac437698d9d42b13f01e4931e3d7469affe/index.js#L173-L224 "Source code on GitHub") |
| 52 … | +[index.js:156-208](https://github.com/wanderer/js-dfinity-radix-tree/blob/24407d385e0f7cc8eed70abe5a5e927a092ebe60/index.js#L156-L208 "Source code on GitHub") |
52 | 53 … | |
53 | 54 … | deletes a value at a given key |
54 | 55 … | |
55 | 56 … | **Parameters** |
59 | 60 … | Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
60 | 61 … | |
61 | 62 … | ## flush |
62 | 63 … | |
63 | | -[index.js:230-232](https://github.com/wanderer/merkle-radix-tree/blob/c05ecac437698d9d42b13f01e4931e3d7469affe/index.js#L230-L232 "Source code on GitHub") |
| 64 … | +[index.js:214-216](https://github.com/wanderer/js-dfinity-radix-tree/blob/24407d385e0f7cc8eed70abe5a5e927a092ebe60/index.js#L214-L216 "Source code on GitHub") |
64 | 65 … | |
65 | 66 … | creates a merkle root for the current tree and stores the data perstantly |
66 | 67 … | |
67 | 68 … | Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** |
68 | 69 … | |
| 70 … | +## emptyTreeState |
| 71 … | + |
| 72 … | +[index.js:29-31](https://github.com/wanderer/js-dfinity-radix-tree/blob/24407d385e0f7cc8eed70abe5a5e927a092ebe60/index.js#L29-L31 "Source code on GitHub") |
| 73 … | + |
| 74 … | +returns the state of an empty tree |
| 75 … | + |
69 | 76 … | ## ArrayConstructor |
70 | 77 … | |
71 | | -[index.js:29-31](https://github.com/wanderer/merkle-radix-tree/blob/c05ecac437698d9d42b13f01e4931e3d7469affe/index.js#L29-L31 "Source code on GitHub") |
| 78 … | +[index.js:37-39](https://github.com/wanderer/js-dfinity-radix-tree/blob/24407d385e0f7cc8eed70abe5a5e927a092ebe60/index.js#L37-L39 "Source code on GitHub") |
72 | 79 … | |
73 | 80 … | returns an Uint1Array constructir which is used to repersent keys |
74 | 81 … | |
75 | 82 … | Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** |
76 | | - |
77 | | -## toTypedArray |
78 | | - |
79 | | -[index.js:38-40](https://github.com/wanderer/merkle-radix-tree/blob/c05ecac437698d9d42b13f01e4931e3d7469affe/index.js#L38-L40 "Source code on GitHub") |
80 | | - |
81 | | -converts a TypedArray or Buffer to an Uint1Array |
82 | | - |
83 | | -**Parameters** |
84 | | - |
85 | | -- `array` **[TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)** the array to convert |
86 | | - |
87 | | -Returns **[TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)** |