Refactor Source interface to allow/prepare for extensibility #2648
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces #2582
TilePyramid
andSource
dependencies.TilePyramid
now essentially serves as a common wrapper class for dealing with sources.Source
is an object implementing:Various todo's and questions:
Tile
objects are used by various source types to maintain tile-specific state; ideally, this implicit contract betweenTilePyramid
andSource
should be made explicit in the Source interface.serialize()
(see note here)Source.is
is only used in one place: to support passing already-created sources toaddSource
(and prevent the attempt to validate against the spec in that case). What's the best way to do this in the factory function approach, where it's a little weird to rely oninstanceof
?Map
methods (addSource
,getSource
). Related to this and the previous item: is it important to retain the ability to create sources without adding them to the map? If so, it might make the most sense to expose acreateSource
on the map obj, since creation now depends on a reference todispatcher
, which probably shouldn't be exposed.id
property with the correct value.data
yielded byload
should look like. Currently, the only thing I can see being needed by code outside of the particular source isbucketStats
, which the pyramid uses to emit thetile.stats
event.