Skip to content
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

Refactor service and remove clients-? features #194

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

robin-nitrokey
Copy link
Member

This PR refactors the Service setup:

  • The Service no longer stores the ServiceEndpoints. Instead they are passed by the runner to Service::process. This decouples the different Trussed components and removes the need for knowing the number of clients in Service.
  • The interchange::Channels are now provided by the runner, removing the need for TrussedInterchange with a fixed number of clients.
  • This also allows to add support for non-static channels, e. g. for tests.
  • With these changes, we no longer need to know the number of clients at compile time and can get rid of the clients-? features.
  • ClientBuilder is also removed as it just adds complexity by combining different requirements into one type.

Trussed is intended to be executed in a separate task.  Implementing
Syscall for Service directly should not be necessary and makes the types
more complex.  Instead, hardware runners should use interrupts and
software runners should use channels (like in trussed::virt) to
communicate with the service.  If necessary, a wrapper struct can be
used for the old behavior.
It is easier to construct the required components separately than to use
a helper struct that tries to combine all requirements into one type.
This patch decouples the Service from the ServiceEndpoint instances.
This gives us more flexibility when constructing the clients and removes
the need for the hard-coded client count in Service.
As the Service no longer owns the ServiceEndpoints, we can allow
arbitrary lifetimes for the channels.  This also removes the need for the
global interchange so it is removed from the crate.
As the Service no longer stores the endpoints itself and the
TrussedInterchange is no longer needed, we don’t need the client count
anymore in Trussed.  This means we can remove the client-? features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants