[core] Add style::Source::setVolatile()/isVolatile() API#16422
[core] Add style::Source::setVolatile()/isVolatile() API#16422pozdnyakov merged 8 commits intomasterfrom
Conversation
| } | ||
|
|
||
| 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.
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. :-/ |
| 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.
@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.
@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