Need for feedback and road to hydra 1.0.0 stabilization! #9
Replies: 2 comments 3 replies
-
Hey! I love your work on Hydra. I'm migrating four Elixir services to Rust & Hydra and am very happy so far! One thing that I'm still trying to figure out is exposing an HTTP or gRPC service alongside Hydra (that part I can get working by spawning a process) that can also communicate with other processes on the node (I'm getting "cannot access a task-local storage value without setting it first" upon trying to do that). My only feedback thus far is to add an official example for this pattern — or some pointers in the right direction; it might be easier than I think. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi, I love your work on this crate. I really like the dynamic send/recv part. There is quite a few of suggestions, I hope you will find them valuable. Exposing free functionsHave you considered exposing Process functions as e.g. Recv Multiple TypesCurrently you can only recv a single type of messages. This makes it difficult to handle multiple tasks in single actor(because your users have to know all messages you are able to handle atm). I suggest exposing roughly the following function: fn raw_select<T>(selector: FnMut(MessageSlot<'_>) -> Option<T>) -> T;
let value = raw_select(|slot| {
if let Some(item) = slot.get::<MyMsg>() {
// item has type TypedMsgSlot<'_, MyMsg>
if item.x > 0 {
return Some(item.take());
}
}
None
}) And also exposing an Handling system messagesCurrently the user is forced to handle system messages on every receive. On the contrary in erlang, are either handled automatically(e.g. exit, unless trapped), or are just added to the mailbox, and it is the user to decide whether to handle system messages. Although it might seem like a reliability hazard, it works quite well in practice. Type confusion in deserialisationCurrently, if you send a message A, and recv a message B it might succeed, because the message is serialised as MessagePack, and does not have any type tag. #[derive(Clone, Serialize, Deserialize)]
struct CheckDbWal {
db_id: u32,
last_gc: Instant,
}
#[derive(Clone, Serialize, Deserialize)]
struct DropDb {
db_id: u32,
}
// first local replica will check db wal
// all other replicas might drop db...
Process::send(replicas, CheckDbWal { .. }) Incorporating sender pidIn erlang, recv returns not only the message, but also a sender pid. This makes feasible to program without a GenServer. Have you considered incorporating this into core protocol? Error handling differences with erlangIn erlang, send is always successful, and recv just ignores unknown messages. Require Clone for messagesEssentially any Encode+Decode is effectively Clone, so it should be reasonable to require this explicitly. |
Beta Was this translation helpful? Give feedback.
-
Hi All,
We're looking for feedback on the current state of the hydra framework. Hydra is deployed at 4 different companies that I know of operating at a large scale (prior to being open-sourced).
We want to stabilize the API as soon as possible, so any feedback would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions