nl_tokens: Initialize ArangoStore with the given options . Optional calls readyCallback when db connection is ready ( mainly for testing purposes ) .
pl_tokens: function ArangoStore ( options , readyCallback ) { <mask> = options || { } ; if ( options . hash ) { var defaultSalt = "connect-arango" ; var defaultAlgorithm = "sha1" ; this . hash = { } ; this . hash . salt = options . hash . salt ? options . hash . salt : defaultSalt ; this . hash . algorithm = options . hash . algorithm ? options . hash . algorithm : defaultAlgorithm ; } Store . call ( this , options ) ; if ( ! options . db ) { throw new Error ( 'Required ArangoStore option `db` missing' ) ; } this . db_collection_name = options . collection || defaultOptions . collection ; if ( options . stringify || ( ! ( 'stringify' in options ) && ! ( 'serialize' in options ) && ! ( 'unserialize' in options ) ) ) { this . _serialize_session = JSON . stringify ; this . _unserialize_session = JSON . parse ; } else { this . _serialize_session = options . serialize || defaultSerializer ; this . _unserialize_session = options . unserialize || identity ; } var self = this ; var host = options . host || defaultOptions . host ; var port = options . port || defaultOptions . port ; if ( typeof options . db === 'object' ) { this . dbHelper = new DatabaseHelper ( options . db , self . db_collection_name ) ; } else { this . dbHelper = new DatabaseHelper ( { host : host , port : port , username : options . username , password : options . password } ) ; self . dbHelper . use ( options . db ) ; } self . dbHelper . ensureCollection ( self . db_collection_name , function ( err , db ) { if ( err ) { if ( readyCallback ) { readyCallback ( err ) ; } else { throw e ; } } else { db . index . createSkipListIndex ( self . db_collection_name , [ "expires" ] , false ) . then ( function ( res ) { if ( readyCallback ) { readyCallback ( ) ; } } , function ( err ) { debug ( "Unable to create skip-list" ) ; if ( readyCallback ) { readyCallback ( err ) ; } } ) . catch ( function ( e ) { throw e ; } ) ; } } ) ; this . db_clear_expires_time = 0 ; this . db_clear_expires_interval = options . clear_interval || defaultOptions . clear_interval ; }