refactor: rename constructors.

This commit is contained in:
Christopher Jeffrey 2016-10-02 03:11:17 -07:00
parent 76a32feb5d
commit 6dfa47e7f4
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
9 changed files with 11 additions and 11 deletions

View File

@ -196,7 +196,7 @@ function ChainDB(chain) {
// We want to keep the last 5 blocks of unspents in memory. // We want to keep the last 5 blocks of unspents in memory.
this.coinWindow = 25 << 20; this.coinWindow = 25 << 20;
this.coinCache = new LRU.nil(); this.coinCache = new LRU.Nil();
this.cacheHash = new LRU(this.cacheWindow); this.cacheHash = new LRU(this.cacheWindow);
this.cacheHeight = new LRU(this.cacheWindow); this.cacheHeight = new LRU(this.cacheWindow);

View File

@ -91,7 +91,7 @@ function Mempool(options) {
this.coinIndex = new AddressIndex(this); this.coinIndex = new AddressIndex(this);
this.txIndex = new AddressIndex(this); this.txIndex = new AddressIndex(this);
this.rejects = new Bloom.rolling(120000, 0.000001); this.rejects = new Bloom.Rolling(120000, 0.000001);
this.freeCount = 0; this.freeCount = 0;
this.lastTime = 0; this.lastTime = 0;

View File

@ -99,8 +99,8 @@ function Peer(pool, addr, socket) {
this.spvFilter = null; this.spvFilter = null;
this.relay = true; this.relay = true;
this.feeRate = -1; this.feeRate = -1;
this.addrFilter = new Bloom.rolling(5000, 0.001); this.addrFilter = new Bloom.Rolling(5000, 0.001);
this.invFilter = new Bloom.rolling(50000, 0.000001); this.invFilter = new Bloom.Rolling(50000, 0.000001);
this.lastBlock = null; this.lastBlock = null;
this.waiting = 0; this.waiting = 0;
this.syncSent = false; this.syncSent = false;

View File

@ -233,7 +233,7 @@ Pool.prototype._initOptions = function _initOptions() {
this.spvFilter = Bloom.fromRate(10000, 0.001, constants.bloom.NONE); this.spvFilter = Bloom.fromRate(10000, 0.001, constants.bloom.NONE);
if (!this.options.mempool) if (!this.options.mempool)
this.txFilter = new Bloom.rolling(50000, 0.000001); this.txFilter = new Bloom.Rolling(50000, 0.000001);
if (this.options.requestTimeout != null) if (this.options.requestTimeout != null)
this.requestTimeout = this.options.requestTimeout; this.requestTimeout = this.options.requestTimeout;

View File

@ -374,6 +374,6 @@ function write(data, value, off) {
exports = Bloom; exports = Bloom;
exports.murmur3 = murmur3; exports.murmur3 = murmur3;
exports.rolling = RollingFilter; exports.Rolling = RollingFilter;
module.exports = exports; module.exports = exports;

View File

@ -265,6 +265,6 @@ MappedLock.prototype.destroy = function destroy() {
*/ */
exports = Locker; exports = Locker;
exports.mapped = MappedLock; exports.Mapped = MappedLock;
module.exports = exports; module.exports = exports;

View File

@ -361,6 +361,6 @@ NullCache.prototype.toArray = function toArray(key) { return []; };
* Expose * Expose
*/ */
LRU.nil = NullCache; LRU.Nil = NullCache;
module.exports = LRU; module.exports = LRU;

View File

@ -152,7 +152,7 @@ function WalletDB(options) {
// We need one read lock for `get` and `create`. // We need one read lock for `get` and `create`.
// It will hold locks specific to wallet ids. // It will hold locks specific to wallet ids.
this.readLock = new Locker.mapped(); this.readLock = new Locker.Mapped();
this.writeLock = new Locker(); this.writeLock = new Locker();
this.txLock = new Locker(); this.txLock = new Locker();

View File

@ -89,7 +89,7 @@ describe('Bloom', function() {
}); });
it('should handle 1m ops with rolling filter', function() { it('should handle 1m ops with rolling filter', function() {
var filter = new bcoin.bloom.rolling(210000, 0.00001); var filter = new bcoin.bloom.Rolling(210000, 0.00001);
filter.tweak = 0xdeadbeef; filter.tweak = 0xdeadbeef;
// ~1m operations // ~1m operations
for (var i = 0; i < 1000; i++) { for (var i = 0; i < 1000; i++) {
@ -105,7 +105,7 @@ describe('Bloom', function() {
}); });
it('should handle rolling generations', function() { it('should handle rolling generations', function() {
var filter = new bcoin.bloom.rolling(50, 0.00001); var filter = new bcoin.bloom.Rolling(50, 0.00001);
filter.tweak = 0xdeadbeee; filter.tweak = 0xdeadbeee;
for (var i = 0; i < 25; i++) { for (var i = 0; i < 25; i++) {
var str = 'foobar' + i; var str = 'foobar' + i;