Remove _commit

This commit is contained in:
haad 2016-03-04 22:41:03 +01:00
parent d9101c188a
commit 989bbba7a2

View File

@ -25,7 +25,7 @@ class OrbitList extends List {
const heads = List.findHeads(this.items); const heads = List.findHeads(this.items);
const node = new Node(this._ipfs, this.id, this.seq, this.ver, data, heads); const node = new Node(this._ipfs, this.id, this.seq, this.ver, data, heads);
node._commit(); // TODO: obsolete? // node._commit(); // TODO: obsolete?
this._currentBatch.push(node); this._currentBatch.push(node);
this.ver ++; this.ver ++;
} }
@ -105,15 +105,12 @@ class OrbitList extends List {
return _findFrom(list.reverse(), hash, amount, opts.lte || !opts.lt).reverse().toArray(); return _findFrom(list.reverse(), hash, amount, opts.lte || !opts.lt).reverse().toArray();
} }
_commit() { /* Private methods */
const current = Lazy(this._currentBatch).difference(this._items).toArray(); // Store to IPFS
this._items = this._items.concat(current);
this._currentBatch = [];
this.ver = 0;
this.seq ++;
}
/* Properties */
get ipfsHash() { get ipfsHash() {
// await(this._commit());
const toIpfs = async(() => { const toIpfs = async(() => {
return new Promise(async((resolve, reject) => { return new Promise(async((resolve, reject) => {
var data = await(this.asJson) var data = await(this.asJson)
@ -121,7 +118,8 @@ class OrbitList extends List {
resolve(list.Hash); resolve(list.Hash);
})); }));
}); });
return await(toIpfs()); this.hash = await(toIpfs());
return this.hash;
} }
get asJson() { get asJson() {