Skip to content

TileCollector design

peterLaurence edited this page Jul 28, 2019 · 3 revisions

The core design of MapView is the TileCollector. This is the component responsible for asynchronously load tiles. It uses Kotlin coroutines, Channels and Flow.

This is the architecture:

MapView

TileCollector interacts with the view-model with two channels:

  • one to receive TileSpecs (a [ReceiveChannel])
  • one to send Tiles (a [SendChannel])

Internally, the "Collector kernel" process incoming TileSpec objects and check whether or not the same request was made recently and is currently in progress. In the case some tiles being fetched aren't needed anymore, the "Collector kernel" can cancel them, using a volatile property of the corresponding TileStatus. It also receives TileStatus from the workers, which send back those objects when a tile was successfully fetched.

Clone this wiki locally