summaryrefslogtreecommitdiff
path: root/include/mbgl/storage/file_source.hpp
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2014-11-25 14:18:47 -0500
committerMike Morris <michael.patrick.morris@gmail.com>2014-12-03 12:25:11 -0500
commitdac76a0f9269a580706e52b730a98f9b1430bcdf (patch)
treeb7c592b648a443ef456479ddd2e21fe66d22abad /include/mbgl/storage/file_source.hpp
parentd3ab8951530b760afb19e685078b1480babc2209 (diff)
downloadqtlocation-mapboxgl-dac76a0f9269a580706e52b730a98f9b1430bcdf.tar.gz
break out FileSource as an abstract class
add CachingHTTPFileSource implementation
Diffstat (limited to 'include/mbgl/storage/file_source.hpp')
-rw-r--r--include/mbgl/storage/file_source.hpp37
1 files changed, 7 insertions, 30 deletions
diff --git a/include/mbgl/storage/file_source.hpp b/include/mbgl/storage/file_source.hpp
index 3839ae22e1..9c5182397d 100644
--- a/include/mbgl/storage/file_source.hpp
+++ b/include/mbgl/storage/file_source.hpp
@@ -1,48 +1,25 @@
#ifndef MBGL_STORAGE_FILE_SOURCE
#define MBGL_STORAGE_FILE_SOURCE
+#include <mbgl/util/noncopyable.hpp>
#include <mbgl/storage/resource_type.hpp>
#include <mbgl/storage/request.hpp>
-#include <mbgl/util/noncopyable.hpp>
#include <string>
-#include <unordered_map>
#include <functional>
typedef struct uv_loop_s uv_loop_t;
-typedef struct uv_messenger_s uv_messenger_t;
namespace mbgl {
-class BaseRequest;
-class SQLiteStore;
-
class FileSource : public util::noncopyable {
-private:
public:
- FileSource(uv_loop_t *loop, const std::string &path);
- ~FileSource();
-
- // Stores and retrieves the base path/URL for relative requests
- void setBase(const std::string &value);
- const std::string &getBase() const;
-
- std::unique_ptr<Request> request(ResourceType type, const std::string &url);
-
- void prepare(std::function<void()> fn);
-
- void retryAllPending();
-
-private:
- const unsigned long thread_id;
-
- // Stores a URL that is used as a base for loading resources with relative path.
- std::string base;
-
- std::unordered_map<std::string, std::weak_ptr<BaseRequest>> pending;
- util::ptr<SQLiteStore> store;
- uv_loop_t *loop = nullptr;
- uv_messenger_t *queue = nullptr;
+ virtual void setLoop(uv_loop_t*) = 0;
+ virtual bool hasLoop() = 0;
+ virtual void setBase(const std::string &value) = 0;
+ virtual std::unique_ptr<Request> request(ResourceType type, const std::string &url) = 0;
+ virtual void prepare(std::function<void()> fn) = 0;
+ virtual void retryAllPending() = 0;
};
}