I want to understand how I should be sharing actors within a gleam project. It looks like I have a few options:
- pass around the actor itself(I am not even sure what the move semantics of gleam are but I assume this doesnt work if I also want it supervised?)
- Pass around a subject for the actor
- Named actors? (Still trying to understand what this means, do I need a registry for this?)
- Registry - use this to request a subject for the actor I want?
I am playing around with wisp and I have:
let assert Ok(cache_supervisor) =
supervisor.new(supervisor.OneForOne)
|> supervisor.add(cache.supervised())
|> supervisor.start
let assert Ok(cache) = cache.new()
let context = context.Context(cache)
let handler = handle_request(_, context)
The supervision tree is what I think I need and I need to replace the cache.new() call with what I should be doing to use a supervised cache.
New to this whole ecosystem and trying to wrap my head around the gleam way to do it.