-
Notifications
You must be signed in to change notification settings - Fork 15
engineering: Add gRPC server base #412
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds foundational gRPC server infrastructure to support servicing operations in Trident, including activity tracking, connection management, log forwarding, and systemd socket activation support.
Key changes:
- Implements
TridentHarpoonServerwith servicing request handling and lock-based concurrency control - Adds
ActivityTrackerto monitor connections and servicing operations with automatic shutdown on inactivity - Introduces systemd socket activation support with Unix domain socket handling
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/trident/src/server/tridentserver/servicingmgr.rs | Manages servicing locks and spawns blocking servicing tasks with activity tracking |
| crates/trident/src/server/tridentserver/mod.rs | Implements gRPC TridentService with stub methods, request handlers, and log forwarding |
| crates/trident/src/server/support/stream.rs | Provides StreamWithLock wrapper for managing gRPC streams with associated lock guards |
| crates/trident/src/server/support/fds.rs | Handles systemd socket activation and Unix socket file descriptor management |
| crates/trident/src/server/mod.rs | Main server entry point with listener setup and signal handling |
| crates/trident/src/server/activitytracker/tracker.rs | Tracks active connections and servicing with configurable inactivity timeout |
| crates/trident/src/server/activitytracker/timer.rs | Simple timer implementation with cancellation support for inactivity tracking |
| crates/trident/src/server/activitytracker/middleware.rs | Tonic middleware for automatic connection tracking via request/response lifecycle |
| crates/trident/src/lib.rs | Conditionally includes server module for testing |
| crates/trident/Cargo.toml | Adds gRPC dependencies (tonic, hyper, tokio-stream) and updates nix to 0.30.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
…/trident into user/frhuelsz/grpc/server-base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
ayaegashi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple nits, but otherwise LGTM
🔍 Description
Completes #397.
This PR adds the base infrastructure and behavior of the gRPC server.
Depends on
An attempt to make a mostly accurate arch diagram from all this. I will add a doc with this in the future.
flowchart TD subgraph harpoon [Harpoon Crate] service[TridentService] end subgraph Trident real_main[main] logfwd["Log Forwarder"] real_main-->|creates|logfwd subgraph Server Module main[server_main] listener[Unix Socket Listener] tracker[Activity Tracker] timer[Shutdown Timer] tracker-->|starts/cancels|timer timer-->|stops|tonic middleware[Tracker Middleware] subgraph grpc ["gRPC Server (tonic)"] tonic["Tonic gRPC Server"] middleware[Tracker Middleware] tonic-->|uses|middleware subgraph server[Harpoon Server] rpcs["RPC Methods"] rpcs-->|create| resp[Response<br/>Stream Channel] rpcs-->|spawn|logtask["Log Fwing Task"] logtask-->|sends logs|resp connLock[Connection RWLock] subgraph mgr[Servicing Manager] srvLock[Servicing RW Lock] srvCaller[Servicing Callers] srvCaller<-->|try lock|srvLock srvBlock["Servicing Task (Blocking)"] srvCaller<-->|start|srvBlock end rpcs<-->|try lock|connLock rpcs-->|invoke|srvCaller srvCaller-->|sends result|resp end tonic-->|invokes|rpcs end listener-->|used by|tonic service-->|implemented by|server main-->|creates| listener main-->|creates| tracker tracker-->|creates| middleware middleware-->|notify conn<br/>start/end| tracker main-->|starts| grpc srvCaller-->|notifies servicing<br/>start/end|tracker end logfwd-->|sends to|logtask real_main-->|invokes|main subgraph TridentCore servicing["Servicing action"] end srvBlock<-->|"runs (NOT IMPL YET)"|servicing end