1 | ;
|
2 | var util = require('util')
|
3 | /**
|
4 | * Constructor which sets up the driver
|
5 | * @param options
|
6 | * @constructor
|
7 | */
|
8 | var StorageDriver = function(options){
|
9 | if('object' !== typeof options) options = {}
|
10 | if('function' !== typeof options.ready){
|
11 | options.ready = function(err){
|
12 | if(err) throw err
|
13 | }
|
14 | }
|
15 | this.setup(options,function(err){
|
16 | options.ready(err)
|
17 | })
|
18 | }
|
19 | /**
|
20 | * Create a StorageDriver extension and inherit
|
21 | * @param name
|
22 | * @returns {Function}
|
23 | */
|
24 | StorageDriver.create = function(name){
|
25 | var obj = function(options){
|
26 | StorageDriver.call(this,options)
|
27 | }
|
28 | util.inherits(obj,StorageDriver)
|
29 | obj.prototype.name = name
|
30 | return obj
|
31 | }
|
32 | /**
|
33 | * Driver name
|
34 | * @type {null}
|
35 | */
|
36 | StorageDriver.prototype.name = 'driver'
|
37 | /**
|
38 | * Handle for instance control of connections
|
39 | * @type {null}
|
40 | */
|
41 | StorageDriver.prototype.handle = null
|
42 | /**
|
43 | * Driver setup method
|
44 | * @type {null}
|
45 | */
|
46 | StorageDriver.prototype.setup = function(options,cb){
|
47 | cb()
|
48 | }
|
49 | /**
|
50 | * Driver save method
|
51 | * @type {null}
|
52 | */
|
53 | //StorageDriver.prototype.save = function(handle,data,next){next()}
|
54 | /**
|
55 | * Driver restore method
|
56 | * @type {null}
|
57 | */
|
58 | //StorageDriver.prototype.restore = function(handle,next){next(null,{})}
|
59 | /**
|
60 | * Driver flush method
|
61 | * @type {null}
|
62 | */
|
63 | //StorageDriver.prototype.flush = function(handle,next){next()}
|
64 |
|
65 | module.exports = exports = StorageDriver |
\ | No newline at end of file |