summaryrefslogtreecommitdiff
path: root/include/mbgl/storage/file_source.hpp
blob: 3b19e00788ca52a2aff6f8787c91993cec23853a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef MBGL_STORAGE_FILE_SOURCE
#define MBGL_STORAGE_FILE_SOURCE

#include "response.hpp"
#include "resource.hpp"

#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/util.hpp>

#include <functional>

typedef struct uv_loop_s uv_loop_t;

namespace mbgl {

class Request;

class FileSource : private util::noncopyable {
protected:
    MBGL_STORE_THREAD(tid)

public:
    virtual ~FileSource() = default;

    using Callback = std::function<void(const Response &)>;

    // These can be called from any thread. The callback will be invoked in the loop.
    // You can only cancel a request from the same thread it was created in.
    virtual Request* request(const Resource&, uv_loop_t*, Callback) = 0;
    virtual void cancel(Request*) = 0;
};

}

#endif