Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Offline (mbgl-core implementation) #3715

Merged
merged 20 commits into from
Feb 11, 2016
Merged

Offline (mbgl-core implementation) #3715

merged 20 commits into from
Feb 11, 2016

Commits on Feb 10, 2016

  1. [core] Refactor tileCover

    jfirebaugh committed Feb 10, 2016
    Configuration menu
    Copy the full SHA
    7d6c6c0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f3d4107 View commit details
    Browse the repository at this point in the history
  3. [core] Moving caching logic to DefaultFileSource

    This results in OnlineFileSource containing precisely the logic we want for reuse by OfflineFileSource, and no more.
    jfirebaugh committed Feb 10, 2016
    Configuration menu
    Copy the full SHA
    dbb8e58 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    025375a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cdedb66 View commit details
    Browse the repository at this point in the history
  6. [all] Do not set Response data for 404s

    For AssetFileSource and the node FileSource this was already the case; this makes the other implementations consistent.
    jfirebaugh committed Feb 10, 2016
    Configuration menu
    Copy the full SHA
    7eb1a91 View commit details
    Browse the repository at this point in the history
  7. 2 Configuration menu
    Copy the full SHA
    e9302c7 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c3c4c7b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    c91b44b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    4bde1b0 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    96e0e52 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    5d42321 View commit details
    Browse the repository at this point in the history
  13. 4 Configuration menu
    Copy the full SHA
    ff15bd5 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    5910124 View commit details
    Browse the repository at this point in the history
  15. [core] Implement an eviction policy for OfflineDatabase

    When inserting an cached resource, or removing a region, remove least-recently used resources and tiles, not used by offline regions, until the used database size, as calculated by multiplying the number of in-use pages by the page size, is less than the maximum cache size minus 5 times the page size.
    
    In addition, OfflineDatabase may be configured to ignore cache puts of individual resources larger than a certain size.
    
    This policy is similar but not identical to the former SQLiteCache policy:
    
    * It accounts for offline, by exempting resources required by offline regions from eviction.
    * It must delete from two tables (resources and tiles), rather than one. Currently the strategy is naive: evict 50 rows at a time from each table.
    * It makes maximumCacheSize and maximumCacheEntrySize completely independent. The SQLiteCache implementation evicted when `usedSize > maximumCacheSize - 2 * maximumCacheEntrySize`. This evicts when `usedSize > maximumCacheSize - 5 * pageSize`.
    * It uses a non-unlimited default value for maximumCacheSize: 50 MB. We should have always had a limit in place; "a cache without an eviction policy is a resource leak".
    jfirebaugh committed Feb 10, 2016
    Configuration menu
    Copy the full SHA
    db3620c View commit details
    Browse the repository at this point in the history
  16. [core] Eliminate maximumCacheEntrySize

    Instead, the eviction policy accounts for the actual size needed for an incoming put.
    jfirebaugh committed Feb 10, 2016
    Configuration menu
    Copy the full SHA
    a9e0c1b View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    0cf450e View commit details
    Browse the repository at this point in the history
  18. [core] Optimize offline database schema

    * Under the hood, SQLite creates surrogate keys (ROWID) anyway. We may as well take advantage of this and use the surrogates for foreign keys as well, since they are simpler and more efficient than compound foreign keys.
    * Create indexes for efficient eviction queries
    jfirebaugh committed Feb 10, 2016
    Configuration menu
    Copy the full SHA
    40ecdeb View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2016

  1. [core] Eliminate tilesets table

    This results in a ~1% increase in database size, which is worth it for reducing complexity and making the tiles and resources tables more similar in structure.
    jfirebaugh committed Feb 11, 2016
    Configuration menu
    Copy the full SHA
    7e287ca View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    20be32f View commit details
    Browse the repository at this point in the history