summaryrefslogtreecommitdiff
path: root/include/mbgl/storage
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/storage')
-rw-r--r--include/mbgl/storage/default_file_source.hpp17
-rw-r--r--include/mbgl/storage/resource_options.hpp15
2 files changed, 20 insertions, 12 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp
index f46f41771e..4f4c7136c6 100644
--- a/include/mbgl/storage/default_file_source.hpp
+++ b/include/mbgl/storage/default_file_source.hpp
@@ -23,20 +23,11 @@ using PathChangeCallback = std::function<void ()>;
class DefaultFileSource : public FileSource {
public:
- /*
- * The maximumCacheSize parameter is a limit applied to non-offline resources only,
- * i.e. resources added to the database for the "ambient use" caching functionality.
- * There is no size limit for offline resources. If a user never creates any offline
- * regions, we want the database to remain fairly small (order tens or low hundreds
- * of megabytes).
- */
- DefaultFileSource(const std::string& cachePath, const std::string& assetPath);
- DefaultFileSource(const std::string& cachePath, std::unique_ptr<FileSource>&& assetFileSource);
+ DefaultFileSource(const std::string& cachePath, const std::string& assetPath, bool supportCacheOnlyRequests = true);
+ DefaultFileSource(const std::string& cachePath, std::unique_ptr<FileSource>&& assetFileSource, bool supportCacheOnlyRequests = true);
~DefaultFileSource() override;
- bool supportsCacheOnlyRequests() const override {
- return true;
- }
+ bool supportsCacheOnlyRequests() const override;
void setAPIBaseURL(const std::string&);
std::string getAPIBaseURL();
@@ -253,6 +244,8 @@ private:
std::mutex cachedAccessTokenMutex;
std::string cachedAccessToken;
+
+ const bool supportCacheOnlyRequests;
};
} // namespace mbgl
diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp
index 6d603b8cca..53350f55c2 100644
--- a/include/mbgl/storage/resource_options.hpp
+++ b/include/mbgl/storage/resource_options.hpp
@@ -97,6 +97,21 @@ public:
uint64_t maximumCacheSize() const;
/**
+ * @brief Sets whether to support cache-only requests.
+ *
+ * @return Whether or not cache-only requests are supported.
+ */
+ bool supportsCacheOnlyRequests() const;
+
+ /**
+ * @brief Gets the previously set (or default) support for cache-only requests.
+ *
+ * @param Whether or not cache-only requests are supported.
+ * @return reference to ResourceOptions for chaining options together.
+ */
+ ResourceOptions& withCacheOnlyRequestsSupport(bool);
+
+ /**
* @brief Sets the platform context. A platform context is usually an object
* that assists the creation of a file source.
*