// Limited driver used purely to compute and emit computed values in separate process

'use strict';

var toArray          = require('es5-ext/array/to-array')
  , ensureIterable   = require('es5-ext/iterable/validate-object')
  , normalizeOptions = require('es5-ext/object/normalize-options')
  , setPrototypeOf   = require('es5-ext/object/set-prototype-of')
  , d                = require('d')
  , deferred         = require('deferred')
  , ensureDatabase   = require('dbjs/valid-dbjs')
  , Driver           = require('../../driver')
  , Storage          = require('./storage')
  , ReducedStorage   = require('./reduced-storage')

  , resolved = deferred(undefined);

var RecomputeDatabase = module.exports = Object.defineProperties(function (database/*, options*/) {
	if (!(this instanceof RecomputeDatabase)) return new RecomputeDatabase(database, arguments[1]);
	ensureDatabase(database);
	Driver.call(this, normalizeOptions(arguments[1], { database: database }));
}, {
	storageClass: d(Storage),
	reducedStorageClass: d(ReducedStorage)
});
setPrototypeOf(RecomputeDatabase, Driver);

RecomputeDatabase.prototype = Object.create(Driver.prototype, {
	constructor: d(RecomputeDatabase),
	name: d('recomputeSlave'),
	loadRawEvents: d(function (events) {
		this.database._postponed_ += 1;
		toArray(ensureIterable(events)).forEach(function (data) {
			this._load(data.id, data.data.value, data.data.stamp);
		}, this);
		this.database._postponed_ -= 1;
	}),

	// Connection related
	__close: d(function () { return resolved; }) // Nothing to close
});

@@ -676,23 +676,21 @@
 computeD
-atabase
+river
  = modul
@@ -793,23 +793,21 @@
 computeD
-atabase
+river
 )) retur
@@ -822,23 +822,21 @@
 computeD
-atabase
+river
 (databas
@@ -1057,23 +1057,21 @@
 computeD
-atabase
+river
 , Driver
@@ -1084,23 +1084,21 @@
 computeD
-atabase
+river
 .prototy
@@ -1162,23 +1162,21 @@
 computeD
-atabase
+river
 ),%0A%09name

Fix constructor name