-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make tileset sources and targets asynchronous #167
Conversation
It would be nice if this was not necessary, but in some cases, knowledge about the tileset that a tile belongs to is required.
This is now part of this PR (mainly done in e1afcb4 ). This means that for the existing functions (like There are no additional implementations of these interfaces yet. But future implementations now can be asynchronous, and that was the main point here. |
Addresses #156
The main part of the changes here is purely syntactical: Just add that
async
to each function in theTilesetSource
andTilesetTarget
, and the correspondingawait
... everywhere (which explains the many "Changed files").There are also some smaller cleanups and utility functions. Some "slightly larger" changes are in the
Iterables
class: This provides various utility functions forIterable
objects. Many of them had to be extended/generalized toAsyncIterable
, because things like thetilesetSource.getKeys()
function now returns anAsyncIterable
. Some further refactoring may happen there. Maybe all this can be replaced by some nice library. Further thoughts are in #159Another addition was to bring "iteration" and "traversal" closer together: The
TilesetTraversers
class now offers a few functions to createAsyncIterable
objects over the traversed tiles. (There are a few degrees of freedom and ways to extend or generalize this, but the current state is a baseline).One thing that is ... somewhat unrelated to the core of the PR, and where I'm not sure whether it should be included here or added in a dedicated PR: Many of the functions that operate on tilesets receive the
tilesetSourceName
andtilesetTargetName
(e.g."C:/example/tileset.json"
). This is intentional, and offers convenience for most use-cases. But internally, most of these functions are doing the same thing: They are creating aTilesetSource
/TilesetTarget
from the given names, and then do their job on these objects. In order to allow clients to use custom implementations of these interface, there will have to be functions that do not accept strings (i.e. not the names), but theTilesetSource
/TilesetTarget
objects directly.