tosc-rs / mnemos

An Operating System for Building Small Computers
https://mnemos.dev
Apache License 2.0
260 stars 18 forks source link

Service interface could decouple "connecting to a service" and "sending a hello" #317

Open hawkw opened 7 months ago

hawkw commented 7 months ago

so i kind of feel like i have some concerns about our current design for the registry and connection: we currently kind of couple "looking up a service in the registry and allocating client channels" with "actually sending the service a Hello message" and I'm not sure if i actually like that

right now, for example, our I2C driver service has a Hello = (), and then it has aStartTransaction` request that takes the I2C addr you want to talk to, and then the response to that is "here's a channel to actually send read/write operations as part of that transaction"

this doesn't play nice with MGNP since if we want to do serdes based interfaces with tricky-pipe, there's no way to send the client another channel

so it seems like a better design would be one where the Hello was the "start transaction with addr" message, and then every request/response on the connection channel was the "hi please read/write these bytes" request and the "here is your buffer back" response

but, with the current design for service connection and Hello-ing, that means we would be doing the I2C service registry lookup and allocation of client channels for every i2c transaction. which i dislike.

MGNP should fix this by decoupling "hello"-ing from connecting, i think. which it doesn't currently do.