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

Using PkvStore from IoTaskPool #50

Open
bonsairobo opened this issue Feb 16, 2024 · 0 comments
Open

Using PkvStore from IoTaskPool #50

bonsairobo opened this issue Feb 16, 2024 · 0 comments

Comments

@bonsairobo
Copy link

bonsairobo commented Feb 16, 2024

The pattern of keeping PkvStore as a resource is not compatible with offloading usage onto a task pool, because PkvStore cannot be cloned.

Is the intended usage to create a new PkvStore for tasks?

I don't think wrapping PkvStore in Arc<RwLock<_>> is a good solution because most (all?) storage backends do not require this extra layer of synchronization.

It seems like it would also be possible to change the StoreImpl trait to use &self instead of &mut self and rely on the interior mutability/synchronization of the database implementations. Then we could actually have a lazy-initialized static global database handle which can be used from anywhere. Or we could only wrap PkvStore in Arc and clone it out of the resource for tasks.

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

No branches or pull requests

1 participant