-
Notifications
You must be signed in to change notification settings - Fork 13
refactor: Lightweight watcher #101
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
base: entity-manager
Are you sure you want to change the base?
Conversation
Since we are guaranteed to be single threaded within the handler fns for a single hash, we can use a much more lightweight watcher impl. Also, tokio::sync::watch is optimized for the case where there are a lot of parallel watchers, using a giant BigNotify internally. We want to optimize for the case where there are just 0 or a few watchers, so we are not that much concerned with the thundering herd problem.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-blobs/pr/101/docs/iroh_blobs/ Last updated: 2025-07-11T06:43:43Z |
_state: entity_manager::ActiveEntityState<Self>, | ||
_cause: entity_manager::ShutdownCause, | ||
) { | ||
async fn on_shutdown(state: HashContext, cause: ShutdownCause) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated change!
Did a very superficial bench with the linux kernel. Doesn't seem to make perf worse, but also not better (not that I expected that...) |
Description
In the current blobs I am using tokio::sync::watch for notifying the observers when the state for a hash has changed. This works, but is way more heavy than needed.
Breaking Changes
None
Notes & open questions
Change checklist