2013-04-10 17:55:13 +00:00
|
|
|
/**
|
|
|
|
* Expose `Connection`.
|
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = Connection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module dependencies.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var AsteroidModule = require('asteroid-module')
|
|
|
|
, debug = require('debug')('connection')
|
|
|
|
, util = require('util')
|
|
|
|
, inherits = util.inherits
|
|
|
|
, assert = require('assert');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new `Connection` with the given `options`.
|
|
|
|
*
|
|
|
|
* @param {Object} options
|
|
|
|
* @return {Connection}
|
|
|
|
*/
|
|
|
|
|
|
|
|
function Connection(options) {
|
|
|
|
AsteroidModule.apply(this, arguments);
|
|
|
|
this.options = options;
|
|
|
|
|
2013-04-15 19:36:37 +00:00
|
|
|
// inheriting connections must provide an adapter
|
|
|
|
// otherwise throw when this connection's adapter
|
|
|
|
// is used...
|
|
|
|
this.adapter = function () {
|
|
|
|
throw new Error('connection has not provided an adapter!');
|
|
|
|
}
|
|
|
|
|
2013-04-10 17:55:13 +00:00
|
|
|
debug('created with options', options);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inherit from `AsteroidModule`.
|
|
|
|
*/
|
|
|
|
|
|
|
|
inherits(Connection, AsteroidModule);
|