lib/cache.js
function Cache(opts) {
    assert.object(opts, 'options');
    // assert.number(opts.dirty, 'options.dirty');
    assert.object(opts.log, 'options.log');
    assert.string(opts.location, 'options.location');
    assert.number(opts.size, 'options.size');
    assert.number(opts.ttl, 'options.ttl');
    assert.number(opts.wbtime, 'options.wbtime');
    assert.number(opts.num_par, 'options.num_par');

    events.EventEmitter.call(this, opts);

    // no maxAge means entries never age out on their own
    this.cache = LRU({
        max: Infinity // hacky - but we just want LRU bookeeping
    });

    this.current_size = 0;
    this.db = null;
    this.log = opts.log.child({
        component: 'MantaFsCache',
        location: path.normalize(opts.location)
    }, true);
    this.location = path.normalize(opts.location);
    this.max_size = opts.size;
    this.curr_size = 0;
    this.ttl_ms = opts.ttl * 1000;
    this.wbtime = opts.wbtime;
    this.num_par = opts.num_par;
    this.manta = opts.manta;

    this._mantafs_cache = true; // MDB flag

    // When we first startup we'll process any dirty files that might be left
    // in our cache during the open() function.
    this.open();
}
function Cache(opts) {
    assert.object(opts, 'options');
    // assert.number(opts.dirty, 'options.dirty');
    assert.object(opts.log, 'options.log');
    assert.string(opts.location, 'options.location');
    assert.number(opts.size, 'options.size');
    assert.number(opts.ttl, 'options.ttl');
    assert.number(opts.wbtime, 'options.wbtime');
    assert.number(opts.num_par, 'options.num_par');

    events.EventEmitter.call(this, opts);

    // no maxAge means entries never age out on their own
    this.cache = LRU({
        max: Infinity // hacky - but we just want LRU bookeeping
    });

    this.current_size = 0;
    this.db = null;
    this.log = opts.log.child({
        component: 'MantaFsCache',
        location: path.normalize(opts.location)
    }, true);
    this.location = path.normalize(opts.location);
    this.max_size = opts.size;
    this.curr_size = 0;
    this.ttl_ms = opts.ttl * 1000;
    this.wbtime = opts.wbtime;
    this.num_par = opts.num_par;
    this.manta = opts.manta;

    this._mantafs_cache = true; // MDB flag

    // When we first startup we'll process any dirty files that might be left
    // in our cache during the open() function.
    this.open();
}
function Cache ( opts ) { assert . object ( opts , 'options' ) ; // assert.number(opts.dirty, 'options.dirty'); assert . object ( opts . log , 'options.log' ) ; assert . string ( opts . location , 'options.location' ) ; assert . number ( opts . size , 'options.size' ) ; assert . number ( opts . ttl , 'options.ttl' ) ; assert . number ( opts . wbtime , 'options.wbtime' ) ; assert . number ( opts . num_par , 'options.num_par' ) ; events . EventEmitter . call ( this , opts ) ; // no maxAge means entries never age out on their own this . cache = LRU ( { max : Infinity // hacky - but we just want LRU bookeeping } ) ; this . current_size = 0 ; this . db = null ; this . log = opts . log . child ( { component : 'MantaFsCache' , location : path . normalize ( opts . location ) } , true ) ; this . location = path . normalize ( opts . location ) ; this . max_size = opts . size ; this . curr_size = 0 ; this . ttl_ms = opts . ttl * 1000 ; this . wbtime = opts . wbtime ; this . num_par = opts . num_par ; this . manta = opts . manta ; this . _mantafs_cache = true ; // MDB flag // When we first startup we'll process any dirty files that might be left // in our cache during the open() function. this . open ( ) ; }
/--- API
/ --- API