2016-11-04 09:03:13 +01:00
|
|
|
'use strict';
|
2016-11-04 09:35:53 +01:00
|
|
|
|
2016-11-05 14:08:47 +01:00
|
|
|
const { createDb } = require('./db-pool');
|
2016-11-05 10:16:48 +01:00
|
|
|
const EventStore = require('./event-store');
|
|
|
|
const FeatureToggleStore = require('./feature-toggle-store');
|
|
|
|
const StrategyStore = require('./strategy-store');
|
2016-11-05 14:08:47 +01:00
|
|
|
const ClientInstanceStore = require('./client-instance-store');
|
2016-11-28 17:11:11 +01:00
|
|
|
const ClientMetricsDb = require('./client-metrics-db');
|
2016-11-05 13:36:44 +01:00
|
|
|
const ClientMetricsStore = require('./client-metrics-store');
|
2016-11-05 14:08:47 +01:00
|
|
|
const ClientStrategyStore = require('./client-strategy-store');
|
2016-11-04 09:03:13 +01:00
|
|
|
|
2016-11-05 14:08:47 +01:00
|
|
|
module.exports.createStores = (config) => {
|
2016-11-13 15:15:33 +01:00
|
|
|
const db = createDb(config);
|
2016-11-05 10:16:48 +01:00
|
|
|
const eventStore = new EventStore(db);
|
2016-11-28 17:11:11 +01:00
|
|
|
const clientMetricsDb = new ClientMetricsDb(db);
|
2016-11-05 10:16:48 +01:00
|
|
|
|
|
|
|
return {
|
2016-11-05 14:08:47 +01:00
|
|
|
db,
|
2016-11-05 10:16:48 +01:00
|
|
|
eventStore,
|
|
|
|
featureToggleStore: new FeatureToggleStore(db, eventStore),
|
|
|
|
strategyStore: new StrategyStore(db, eventStore),
|
2016-11-05 14:08:47 +01:00
|
|
|
clientInstanceStore: new ClientInstanceStore(db),
|
2016-11-28 17:11:11 +01:00
|
|
|
clientMetricsStore: new ClientMetricsStore(clientMetricsDb),
|
2016-11-05 14:08:47 +01:00
|
|
|
clientStrategyStore: new ClientStrategyStore(db),
|
2016-11-05 10:16:48 +01:00
|
|
|
};
|
|
|
|
};
|