Closed gennyble closed 1 year ago
Current though: "No. Well, kind of"
I think what I dislike the most is how information makes it from saild to sail. Sail is the connection handler, right? So the daemon waits for connections and then hands Sail the AsyncRead like Sail::new(client)
or something.
I did not realize that it kind of already is. I should rename Policy
to Service
maybe. I mostly like the trait, but I think we can improve it. We can probably collapse forward_path_is_local
and path_is_valid
into check_path
and have it return an enum. (or, well, only saild checks forward_path_is_local
, so maybe we can drop it altogether. but it would be useful to know still).
I'll drop it until we need it I guess. New trait looks like:
primary_host
check_path
message_received(&mut self, message: Envelope) -> Response
yelling at myself in github issues
check_path
is a bad name and should be path_is_valid
, probably, which we already have anyway.
Messages for postmaster
are not checked against path_is_valid
and are accepted outright.
No, we can't give it an AsyncRead
and AsyncWrite
. It doesn't care about the io at all right now and that's adorable. Well, I tried.
Like how hyper has a MakeService and Service. We might not need MakeService, but also we might need it? Because connections can have multiple transactions.
Hyper uses
tower-service
(crates).It might help clean things up? But, thinking about it now, we need to respond to things other than flat messages. VRFY, things like that. Maybe an event based framework? That's kind of what we are now? I don't know, but I'm not greatly pleased with the structure of sail as is.