Repository navigation
Offline terminology #4250
Description
For offline, we are inventing a lot of new terminology. For prior SDK features, we've taken cues from existing mapping SDKs, which in many cases leads to divergence of terminology between our iOS and Android SDKs. But offline is a feature other SDKs don't have, and I think it would be to the long term benefit of our customers and support staff to use consistent terminology for offline concepts -- consistent both between the iOS and Android offline APIs, and the words we use when talking about offline in prose.
A proposal follows. The terms are different that what we've been using, but don't panic: I don't think renaming will be a huge undertaking, provided we do it now, before these APIs have been formally released and we've written more than one piece of documentation about them.
offline resource collection
Type names: {mbgl::,MGL,com.com.mapbox.mapboxsdk.offline.}OfflineResourceCollection.
An offline resource collection is the basic unit of offline. You can create them, list them, start and stop their downloads, and delete them. Each resource collection has a region, and may have some additional application-supplied data. (Former core/Android name: OfflineRegion.)
offline region
Type names: {mbgl::,MGL,com.com.mapbox.mapboxsdk.offline.}OfflineRegion, {mbgl::,MGL,com.com.mapbox.mapboxsdk.offline.}OfflineTilePyramidRegion
The geographic extent of a resource collection -- which part of the world it covers -- is defined by its region. We plan eventually to support region types, but for now there is only a single type: a tile pyramid. (Former core/Android name: OfflineRegionDefinition / OfflineRegionTilePyramidDefinition.)
application-supplied data
Here the terminology follows established platform-specific conventions: on Android, application-supplied data is called "metadata". On iOS, it's called "context". Both use preexisting platform types.
offline download status / offline download progress
The current revision of the iOS bindings separates these into two concepts. The core API and Android bindings have a single concept combining both. TBD.
resource database
Type names: {mbgl::,MGL,com.com.mapbox.mapboxsdk.offline.}ResourceDatabase.
The top level thing that you ask to create an offline resource collection, or give you the list of existing ones. In mbgl core this is DefaultFileSource, but that name is an odd implementation detail that probably won't stick. Currently Android uses OfflineManager and iOS uses MGLOfflineStorage. I propose ResourceDatabase. I'm omitting Offline from this name because the database is also used for ambient caching. I'm including Database because it is in fact a database, and we'll likely eventually publicly document the schema.
Activity
1ec5 commentedon Mar 8, 2016
I separated these two concepts because an offline region always has a state, but it doesn’t have a progress when it’s invalid. The invalid state is unique to the iOS implementation and ensures that the region can’t be used after it’s removed.
If the region becomes responsible for destroying itself, then having separate state and progress becomes less important.I had also considered customizing the state’s setter so that setting the state could pause or resume a download; the progress would remain read-only to consumers.Edit: Actually, we’ll always have to make a distinction between unregistering (removing) a region and deleting the Objective-C object that represents the region – we’d want region removal to be explicit and not depend on nilling out all strong references to the object. So the invalidation pattern is still necessary.
zugaldia commentedon Mar 9, 2016
/cc: @twbell
zugaldia commentedon Mar 9, 2016
Not a big fan of this one. In Java, you'd expect a collection to be a list of items, an iterable, which isn’t the case here.
1ec5 commentedon Mar 9, 2016
That's the kind of conflict we're trying to avoid with this renaming. "Bundle", "package", and "archive" all have similar conflicts on one platform or another.
How about
ResourcePack? It sounds good in prose, apparently doesn't conflict with any existing platform or language conventions, and carries the meaning we want to convey.zugaldia commentedon Mar 9, 2016
Why not simply
OfflineResource?The
ResourceDatabasecontains a list ofOfflineResources, that are defined by anOfflineRegionand their metadata/context.1ec5 commentedon Mar 9, 2016
The term "resource" is already used all over mbgl for individual images, sprite sheets, stylesheets, etc. Put another way, this class represents a collection (in the informal sense) of things that must be downloaded for a region (in the geographic sense) to be usable offline. So what's currently called the "offline region definition" is like a bill of materials and the "offline region" acts as a container for those materials. Among the other names we considered for this type are
OfflineRepositoryandOfflineRecord.1ec5 commentedon Mar 9, 2016
Regarding the original premise, @danswick @friedbunny, do you see any downside to having different naming schemes across platforms? I've always imagined that we would maintain separate offline documentation and examples for iOS and Android. Are there situations where you would find the need to talk about what we're currently calling an "offline region" across platforms simultaneously?
friedbunny commentedon Mar 9, 2016
For our own purposes, having consistent naming would be great. For SDK consumers, having platform-specific names that diverge slightly from each other doesn’t strike me as a problem — most developers don’t do both platforms themselves and making our APIs mesh with platform conventions would be more helpful.
And yes, I expect that iOS and Android documentation will eventually separate.
jfirebaugh commentedon Mar 9, 2016
Ok, let's continue to call them "offline regions" in prose, core mbgl, and Android bindings. iOS will deviate from this for platform reasons, and we'll just deal with it.
1ec5 commentedon Feb 20, 2017
Per #8084 (comment), we’d like to rename these classes at least at the SDK level. Now that the offline manager (or whatever it’s called at the SDK level) also handles URL request transformations while online, we need a naming strategy that doesn’t emphasize offline maps quite as much.
1ec5 commentedon Feb 20, 2017
Here’s a possibility for iOS/macOS that deemphasizes “offline”, even though that remains the primary intent of the API:
The downside is that our offline map functionality becomes harder to find. On the other hand, this scheme would set us up for any caching APIs that aren’t strictly for offline usage.
jfirebaugh commentedon Feb 20, 2017
I vote for MGLOfflineStorage → MGLMapStorage but no other changes. "Offline" is still a perfectly good term to use in class names, and it's only the top-level concept that's broadening.
zugaldia commentedon Feb 20, 2017
As suggested by @kkaefer in #8084 (comment), on Android this translates as renaming
OfflineManagertoStorageManager. Also, we might want to change the package that contains the renamedStorageManagerfromcom.mapbox.mapboxsdk.offlinetocom.mapbox.mapboxsdk.storage(already existing).kkaefer commentedon Feb 21, 2017
For the record, we've been using the
MGLOfflineStorageobject before as well to initialize the map object with theDefaultFileSourceobject it contains, so it was always doing more than advertised through its name.stale commentedon Nov 25, 2018
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.