git ssb

0+

wanderer🌟 / js-dfinity-radix-tree



Commit 588bfeefe36f73792935e70a42db416f2a0d838c

fixed flush

wanderer committed on 3/22/2018, 11:56:28 PM
Parent: 1fc94adc199518c16723617727d7d19d75724d5b

Files changed

index.jschanged
index.jsView
@@ -15,11 +15,10 @@
1515 * @param 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.
1616 * @param opts.decoder {object} a cbor decoder
1717 */
1818 constructor (opts) {
19- this._root = opts.root || {
20- '/': RadixTree.emptyTreeState
21- }
19+ this._root = {}
20+ this.root = opts.root || RadixTree.emptyTreeState
2221
2322 this.dag = opts.dag || new DataStore(opts.db, opts.decoder)
2423 this.graph = opts.graph || new Graph(this.dag)
2524 this._setting = Promise.resolve()
@@ -233,9 +232,10 @@
233232 * @returns {Promise}
234233 */
235234 async flush () {
236235 await this.done()
237- return this.graph.flush(this._root)
236+ await this.graph.flush(this._root)
237+ return this.root
238238 }
239239
240240 formatKey (key) {
241241 key = RadixTree.formatKey(key)

Built with git-ssb-web