Unify mapstore

This commit is contained in:
Raul Ochoa 2015-07-04 23:18:09 +02:00
parent 5967c5d1d5
commit 9d6d3f96b2

View File

@ -132,7 +132,7 @@ module.exports = function(serverOptions) {
// Extend windshaft with all the elements of the options object
_.extend(app, serverOptions);
var map_store = new windshaft.storage.MapStore({
var mapStore = new windshaft.storage.MapStore({
pool: redisPool,
expire_time: serverOptions.grainstore.default_layergroup_ttl
});
@ -192,11 +192,8 @@ module.exports = function(serverOptions) {
);
}
});
var rendererCache = new windshaft.cache.RendererCache(rendererCacheOpts, map_store, rendererFactory);
// Make map store accessible as part of the app
app.mapStore = map_store;
var mapBackend = new windshaft.backend.Map(rendererCache, map_store);
var rendererCache = new windshaft.cache.RendererCache(rendererCacheOpts, mapStore, rendererFactory);
var mapBackend = new windshaft.backend.Map(rendererCache, mapStore);
var staticMapBackend = new windshaft.backend.StaticMap(rendererCache);
app.findStatusCode = function(err) {
@ -684,13 +681,6 @@ module.exports = function(serverOptions) {
function extractSQL(err) {
assert.ifError(err);
// TODO: cached cache channel for token-based access should
// be constructed at renderer cache creation time
// See http://github.com/CartoDB/Windshaft-cartodb/issues/152
if ( ! app.mapStore ) {
throw new Error('missing channel cache for token ' + req.params.token);
}
var mapStore = app.mapStore;
step(
function loadFromStore() {
mapStore.load(req.params.token, this);