Skip to content
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

Merged
merged 25 commits into from
Jan 31, 2025
Merged

Conversation

javagl
Copy link
Contributor

@javagl javagl commented Jan 19, 2025

Addresses #156

The main part of the changes here is purely syntactical: Just add that async to each function in the TilesetSource and TilesetTarget, and the corresponding await ... 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 for Iterable objects. Many of them had to be extended/generalized to AsyncIterable, because things like the tilesetSource.getKeys() function now returns an AsyncIterable. Some further refactoring may happen there. Maybe all this can be replaced by some nice library. Further thoughts are in #159

Another addition was to bring "iteration" and "traversal" closer together: The TilesetTraversers class now offers a few functions to create AsyncIterable 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 and tilesetTargetName (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 a TilesetSource/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 the TilesetSource/TilesetTarget objects directly.

@javagl
Copy link
Contributor Author

javagl commented Jan 29, 2025

Many of the functions that operate on tilesets receive the tilesetSourceName and tilesetTargetName [...] 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 the TilesetSource/TilesetTarget objects directly.

This is now part of this PR (mainly done in e1afcb4 ). This means that for the existing functions (like combine, merge, upgrade...) that received the source- and target names (as strings), there are now corresponding functions (combineData, mergeData, upgradeData...) that take the source- and target data (as TilesetSource and TilesetTarget objects) directly.

There are no additional implementations of these interfaces yet. But future implementations now can be asynchronous, and that was the main point here.

@javagl javagl marked this pull request as ready for review January 29, 2025 16:23
@javagl javagl mentioned this pull request Jan 29, 2025
@lilleyse lilleyse merged commit 8aa61b0 into main Jan 31, 2025
2 checks passed
@lilleyse lilleyse deleted the async-source-and-target branch January 31, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants