Implements a Thread<>::invoke interface that only permits calling member functions with bound arguments. Also introduce invokeWithResult, which accepts a callback and invokes it, passing the result, on the invoking thread's RunLoop. This closes the loop of two evented threads doing message passing.
40 lines
904 B
C++
40 lines
904 B
C++
#ifndef MBGL_STORAGE_DEFAULT_SQLITE_CACHE_IMPL
|
|
#define MBGL_STORAGE_DEFAULT_SQLITE_CACHE_IMPL
|
|
|
|
#include <mbgl/storage/sqlite_cache.hpp>
|
|
|
|
namespace mapbox {
|
|
namespace sqlite {
|
|
class Database;
|
|
class Statement;
|
|
}
|
|
}
|
|
|
|
namespace mbgl {
|
|
|
|
class SQLiteCache::Impl {
|
|
public:
|
|
Impl(const std::string &path = ":memory:");
|
|
~Impl();
|
|
|
|
std::unique_ptr<Response> processGet(const Resource&);
|
|
void processPut(const Resource& resource, std::shared_ptr<const Response> response);
|
|
void processRefresh(const Resource& resource, int64_t expires);
|
|
|
|
private:
|
|
void createDatabase();
|
|
void createSchema();
|
|
|
|
const std::string path;
|
|
std::unique_ptr<::mapbox::sqlite::Database> db;
|
|
std::unique_ptr<::mapbox::sqlite::Statement> getStmt;
|
|
std::unique_ptr<::mapbox::sqlite::Statement> putStmt;
|
|
std::unique_ptr<::mapbox::sqlite::Statement> refreshStmt;
|
|
bool schema = false;
|
|
};
|
|
|
|
|
|
}
|
|
|
|
#endif
|