alaCarte Maps
Renderer for OpenStreetMap tiles
RequestManager Class Reference

#include <request_manager.hpp>

Inheritance diagram for RequestManager:

Classes

class  RunningQueue
 This file is part of alaCarte. More...
 

Public Member Functions

 RequestManager (const shared_ptr< Configuration > &config, const shared_ptr< Geodata > &data, const shared_ptr< Renderer > &renderer, const shared_ptr< Cache > &cache, const shared_ptr< StylesheetManager > &ssm)
 Constructs a new RequestManager with the given parameters. More...
 
 ~RequestManager ()
 Stops the io_service, joins all Threads and destructs the RequestManager. More...
 
void stop ()
 stops all jobs More...
 
TESTABLE void enqueue (const shared_ptr< HttpRequest > &r)
 Enqueues the HttpRequest. More...
 
TESTABLE void enqueue (const shared_ptr< MetaIdentifier > &ti)
 Enqueues the TileIdentifier. More...
 
TESTABLE shared_ptr< GeodatagetGeodata () const
 Returns the Geodata. More...
 
TESTABLE shared_ptr< StylesheetManagergetStylesheetManager () const
 Returns the StylesheetManager. More...
 
TESTABLE shared_ptr< CachegetCache () const
 Returns the Cache. More...
 
TESTABLE shared_ptr< RenderergetRenderer () const
 Returns the Renderer. More...
 

Private Member Functions

void processNextRequest ()
 Selects the next Job and runs it process Method. More...
 
bool nextUserRequest ()
 Selects the next Job and runs it process Method. More...
 
bool nextPreRenderRequest ()
 

Private Attributes

shared_ptr< Geodatadata
 
shared_ptr< Rendererrenderer
 
shared_ptr< Cachecache
 
shared_ptr< StylesheetManagerssm
 
shared_ptr< Configurationconfig
 
boost::asio::io_service jobPool
 
boost::asio::io_service::work preventStop
 
std::vector< shared_ptr< boost::thread > > workers
 
std::queue< shared_ptr< RenderCanvasFactory > > factories
 
boost::mutex factoriesMutex
 
boost::mutex userRJMutex
 
boost::mutex preRJMutex
 
std::queue< shared_ptr< HttpRequest > > userRequests
 
std::queue< shared_ptr< MetaIdentifier > > preRenderRequests
 
scoped_ptr< RunningQueuerunning
 
unsigned int currentPrerenderingThreads
 
std::chrono::system_clock::time_point prerender_start
 
std::chrono::system_clock::time_point prerender_stop
 

Detailed Description

Definition at line 42 of file request_manager.hpp.

Constructor & Destructor Documentation

RequestManager::RequestManager ( const shared_ptr< Configuration > &  config,
const shared_ptr< Geodata > &  data,
const shared_ptr< Renderer > &  renderer,
const shared_ptr< Cache > &  cache,
const shared_ptr< StylesheetManager > &  ssm 
)

Constructs a new RequestManager with the given parameters.

And creates worker Threads.

Parameters
configThe Configuration, e.g. for the amount of threads.
dataThe Geodata
rendererThe Renderer
cacheThe Cache
ssmThe StylesheetManager

Definition at line 83 of file request_manager.cpp.

RequestManager::~RequestManager ( )

Stops the io_service, joins all Threads and destructs the RequestManager.

Definition at line 114 of file request_manager.cpp.

Member Function Documentation

void RequestManager::enqueue ( const shared_ptr< HttpRequest > &  r)

Enqueues the HttpRequest.

Parameters
rThe HttpRequest which should be processed.

Definition at line 138 of file request_manager.cpp.

void RequestManager::enqueue ( const shared_ptr< MetaIdentifier > &  ti)

Enqueues the TileIdentifier.

Parameters
tiThe MetaIdentifier which identifies the Tile which should be renderer.

Definition at line 157 of file request_manager.cpp.

shared_ptr< Cache > RequestManager::getCache ( ) const

Returns the Cache.

Returns
The Cache

Definition at line 325 of file request_manager.cpp.

shared_ptr< Geodata > RequestManager::getGeodata ( ) const

Returns the Geodata.

Returns
The Geodata

Definition at line 303 of file request_manager.cpp.

shared_ptr< Renderer > RequestManager::getRenderer ( ) const

Returns the Renderer.

Returns
The Renderer

Definition at line 336 of file request_manager.cpp.

shared_ptr< StylesheetManager > RequestManager::getStylesheetManager ( ) const

Returns the StylesheetManager.

Returns
The StylesheetManager

Definition at line 314 of file request_manager.cpp.

bool RequestManager::nextPreRenderRequest ( )
private

Definition at line 242 of file request_manager.cpp.

bool RequestManager::nextUserRequest ( )
private

Selects the next Job and runs it process Method.

Returns
true if a request was processed

Definition at line 180 of file request_manager.cpp.

void RequestManager::processNextRequest ( )
private

Selects the next Job and runs it process Method.

Definition at line 169 of file request_manager.cpp.

void RequestManager::stop ( )

stops all jobs

Definition at line 123 of file request_manager.cpp.

Member Data Documentation

shared_ptr<Cache> RequestManager::cache
private

Definition at line 65 of file request_manager.hpp.

shared_ptr<Configuration> RequestManager::config
private

Definition at line 67 of file request_manager.hpp.

unsigned int RequestManager::currentPrerenderingThreads
private

Definition at line 85 of file request_manager.hpp.

shared_ptr<Geodata> RequestManager::data
private

Definition at line 63 of file request_manager.hpp.

std::queue<shared_ptr<RenderCanvasFactory> > RequestManager::factories
private

Definition at line 73 of file request_manager.hpp.

boost::mutex RequestManager::factoriesMutex
private

Definition at line 74 of file request_manager.hpp.

boost::asio::io_service RequestManager::jobPool
private

Definition at line 69 of file request_manager.hpp.

std::chrono::system_clock::time_point RequestManager::prerender_start
private

Definition at line 87 of file request_manager.hpp.

std::chrono::system_clock::time_point RequestManager::prerender_stop
private

Definition at line 87 of file request_manager.hpp.

std::queue< shared_ptr<MetaIdentifier> > RequestManager::preRenderRequests
private

Definition at line 79 of file request_manager.hpp.

boost::mutex RequestManager::preRJMutex
private

Definition at line 77 of file request_manager.hpp.

boost::asio::io_service::work RequestManager::preventStop
private

Definition at line 70 of file request_manager.hpp.

shared_ptr<Renderer> RequestManager::renderer
private

Definition at line 64 of file request_manager.hpp.

scoped_ptr<RunningQueue> RequestManager::running
private

Definition at line 82 of file request_manager.hpp.

shared_ptr<StylesheetManager> RequestManager::ssm
private

Definition at line 66 of file request_manager.hpp.

std::queue< shared_ptr<HttpRequest> > RequestManager::userRequests
private

Definition at line 78 of file request_manager.hpp.

boost::mutex RequestManager::userRJMutex
private

Definition at line 76 of file request_manager.hpp.

std::vector< shared_ptr<boost::thread> > RequestManager::workers
private

Definition at line 71 of file request_manager.hpp.


The documentation for this class was generated from the following files: