-
Notifications
You must be signed in to change notification settings - Fork 2
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
Improve sharing of configuration context #64
Comments
This could be tackled after #63 is complete. |
This is the approach taken by The |
Something to consider: we may want mutability for some aspects of the shared state. I'm thinking in particular about an address book, the likes of which currently lives in the Solution: use an |
Right now we have a clumsy hybrid of configuration values which are passed down to actors and other functions (starting in
src/node.rs
) and those which are set and retrieved fromOnceCell
s.The
OnceCell
pattern generally makes it easier to deal with the situation where we have to pass a value into an actor in a loop. Generally these values do not implement theCopy
trait and are therefore only able to be moved once before the compiler complains:^^^^^^^ value moved here, in previous iteration of loop
The following values are currently set via
OnceCell
:One option is simply to chuck the whole
ApplicationConfig
instance into aOnceCell
and avoid passing down config values entirely. Such a "global store" is generally discouraged in Rust.Another option is to create a context which can be shared with all actors. Each actor is then able to access config values from the context.
The text was updated successfully, but these errors were encountered: