Comparing version 1.0.2 to 1.0.3
@@ -184,2 +184,3 @@ 'use strict'; | ||
return Lazy(log.items) | ||
.reverse() | ||
.filter((f) => !Log.isReferencedInChain(log, f)) | ||
@@ -190,3 +191,3 @@ .toArray(); | ||
static isReferencedInChain(log, item) { | ||
return Lazy(log.items).find((e) => e.hasChild(item)) !== undefined; | ||
return Lazy(log.items).reverse().find((e) => e.hasChild(item)) !== undefined; | ||
} | ||
@@ -193,0 +194,0 @@ |
{ | ||
"name": "ipfs-log", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Append-only log for IPFS", | ||
@@ -5,0 +5,0 @@ "main": "lib/log.js", |
@@ -1,50 +0,50 @@ | ||
'use strict'; | ||
// 'use strict'; | ||
const _ = require('lodash'); | ||
const assert = require('assert'); | ||
const async = require('asyncawait/async'); | ||
const await = require('asyncawait/await'); | ||
const ipfsd = require('ipfsd-ctl'); | ||
const Log = require('../lib/log'); | ||
const Node = require('../lib/node'); | ||
// const _ = require('lodash'); | ||
// const assert = require('assert'); | ||
// const async = require('asyncawait/async'); | ||
// const await = require('asyncawait/await'); | ||
// const ipfsd = require('ipfsd-ctl'); | ||
// const Log = require('../lib/log'); | ||
// const Node = require('../lib/node'); | ||
let ipfs; | ||
// let ipfs; | ||
const startIpfs = () => { | ||
return new Promise((resolve, reject) => { | ||
ipfsd.disposableApi((err, ipfs) => resolve(ipfs)); | ||
}); | ||
}; | ||
// const startIpfs = () => { | ||
// return new Promise((resolve, reject) => { | ||
// ipfsd.disposableApi((err, ipfs) => resolve(ipfs)); | ||
// }); | ||
// }; | ||
describe('ipfs-log - Performance Measurement', async(function() { | ||
this.timeout(60000); | ||
before(async((done) => { | ||
try { | ||
ipfs = await(startIpfs()); | ||
} catch(e) { | ||
console.log(e); | ||
assert.equal(e, null); | ||
} | ||
done(); | ||
})); | ||
// describe('ipfs-log - Performance Measurement', async(function() { | ||
// this.timeout(60000); | ||
// before(async((done) => { | ||
// try { | ||
// ipfs = await(startIpfs()); | ||
// } catch(e) { | ||
// console.log(e); | ||
// assert.equal(e, null); | ||
// } | ||
// done(); | ||
// })); | ||
it.only('add', async((done) => { | ||
let ms = 0; | ||
// it.only('add', async((done) => { | ||
// let ms = 0; | ||
for(let t = 100; t <= 1000; t += 300) { | ||
const log = await(Log.create(ipfs, 'A')); | ||
const startTime = new Date().getTime(); | ||
// for(let t = 100; t <= 1000; t += 300) { | ||
// const log = await(Log.create(ipfs, 'A')); | ||
// const startTime = new Date().getTime(); | ||
for(let i = 0; i < t; i ++) { | ||
await(log.add("hello" + i)); | ||
} | ||
// for(let i = 0; i < t; i ++) { | ||
// await(log.add("hello" + i)); | ||
// } | ||
const endTime = new Date().getTime(); | ||
console.log(` > ${t} took ${(endTime - startTime)} ms`) | ||
} | ||
// const endTime = new Date().getTime(); | ||
// console.log(` > ${t} took ${(endTime - startTime)} ms`) | ||
// } | ||
assert.equal(true, true); | ||
done(); | ||
})); | ||
// assert.equal(true, true); | ||
// done(); | ||
// })); | ||
})); | ||
// })); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48853
1190