-
Notifications
You must be signed in to change notification settings - Fork 41
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:
TileCollector
interacts with the view-model with two channels:
- one to receive
TileSpec
s (a [ReceiveChannel]) - one to send
Tile
s (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.