-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Add style::Source::setVolatile()/isVolatile() API #16422
Conversation
@@ -179,6 +179,8 @@ std::unique_ptr<AsyncRequest> DatabaseFileSource::request(const Resource& resour | |||
} | |||
|
|||
void DatabaseFileSource::forward(const Resource& res, const Response& response, std::function<void()> callback) { | |||
if (res.storagePolicy == Resource::StoragePolicy::Volatile) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also have something like this when requesting volatile resources from the offline database. If they are never stored there is no point in querying for them.
Kudos, this was very clean! Looks like the bots got stuck because of the GitHub outage. :-/ |
@@ -66,12 +66,14 @@ class Source { | |||
std::string getID() const; | |||
optional<std::string> getAttribution() const; | |||
|
|||
// The data from the volatile sources are not stored in a persistent storage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pozdnyakov thanks for the quick turnaround on this. Implementation looks great. Do we know how likely we are to introduce additional storage options for sources in the future?
From an API extensibility perspective, I'm wondering if it would be better to introduce smth like Source::getStoragePolicy
and Source::setStoragePolicy
. If we were to introduce new storage types alongside volatile
and permanent
in the future, we wouldn't need to create new APIs and the boolean flags wouldn't need to be deprecated.
cc @tmpsantos @alexshalamov @LukasPaczos @tobrun @1ec5 @julianrex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chloekraw the Carbon API for sources uses generic parameters, so changing from a boolean flag to a enumeration type in future shall be painless 🙂
69ca9d2
to
b4fa87b
Compare
b4fa87b
to
784d569
Compare
… resources The `DatabaseFileSource.VolatileResource` test is included.
784d569
to
f01e2f4
Compare
f01e2f4
to
c192126
Compare
The tile data from the volatile sources are not stored in local storage, i.e. they are not cached.
Fixes https://github.com/mapbox/mapbox-gl-native-team/issues/335