sdk/rust: escape hatch for cacheless mode #3244
Open
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.
Description of Changes
These changes allow SDK consumers to register a
tokio::sync::mpsc::UnboundedSender<DbUpdate>
for aDbConnection
that directly receives all database updates instead of theClientCache
.Rationale
For writing tooling the current client cache feels very inefficient - these changes allowed us to reduce memory consumption by around a factor of 8, from being able to run the tooling for one region of BitCraft Online to all of them. Batch processing all rows in a database update as well as processing them in a different thread also lead to increased performance.
Expected complexity level and risk
1 - for complexity i believe this is a fairly minor change, although not completely aware of your scale.
? - for risk.
Behavioral changes only exist if the channel is registered via
DbConnectionBuilder::with_update_channel
, currently hidden from the docs. Risk may increase significantly ifDbUpdate
/TableUpdate
channels are not meant to be public API and are in flux.Testing
I do not have any tests for these changes, but have run a patched SDK with these changes for a while in bitcraft tooling such as https://github.com/vis-eyth/bitcraft-nodeindex.