function Sevnup()

in index.js [28:54]


function Sevnup(params) {
    this.hashRing = params.hashRing;
    this.hashRingLookup = params.hashRingLookup || this.hashRing.lookup.bind(this.hashRing);
    this.store = new CacheStore(params.store);
    this.recoverKeyCallback = params.recoverKey;
    this.releaseKeyCallback = params.releaseKey;
    this.totalVNodes = params.totalVNodes || DEFAULT_TOTAL_VNODES;
    this.logger = params.logger;
    this.statsd = params.statsd;
    this.calmThreshold = params.calmThreshold || DEFAULT_CALM_THRESHOLD;
    this.calmTimeout = null;
    this.watchMode = params.watchMode;
    this.running = true;
    this.retryIntervalMs = params.retryIntervalMs || DEFAULT_RETRY_INTERVAL_MS;
    this.maxConcurrencyLevel = params.maxConcurrencyLevel || DEFAULT_MAX_PARALLEL_TASKS;
    this.retryRecoverOnFailure = params.retryRecoverOnFailure || false;

    this.ownedVNodes = [];

    this.stateChangeQueue = async.queue(this._handleRingStateChange.bind(this), 1);
    // Separate the two task types such that a bad key wont prevent a key from being recovered
    this.keyRetryQueue = async.queue(this._retryInQueue.bind(this), 1);
    this.loadKeyRetryQueue = async.queue(this._retryInQueue.bind(this), 1);

    this.eventHandler = this._onRingStateChange.bind(this);
    this._attachToRing(params.addOnLookup);
}