[relay] Wake-up: a push endpoint per mailbox, and a constant wake to it when a blob arrives
ci / check (pull_request) Has been cancelled

This commit is contained in:
2026-11-20 12:04:55 +01:00
parent f075fae0e3
commit f852b1a6d1
21 changed files with 1606 additions and 40 deletions
+12 -4
View File
@@ -63,10 +63,7 @@ impl Relay {
let now = Arc::new(AtomicI64::new(T0));
let n = Arc::clone(&now);
let clock: Clock = Arc::new(move || n.load(Ordering::SeqCst));
let app = router(AppState {
store: Arc::clone(&store),
clock,
});
let app = router(AppState::new(Arc::clone(&store), clock));
Self { app, store, now }
}
fn advance(&self, secs: i64) {
@@ -168,6 +165,8 @@ fn schema_is_exactly_protocol_section_5() {
"created_day".into(),
],
),
// Wake-up (`.agents/features/wake-up.md` §2.3), only for a mailbox whose owner opted in.
("push".into(), vec!["mailbox_id".into(), "endpoint".into()]),
];
assert_eq!(
live, expected,
@@ -628,6 +627,15 @@ fn the_relay_listens_on_loopback_unless_told_otherwise() {
let args = parse_args(Vec::<String>::new()).expect("defaults");
assert_eq!(args.listen.to_string(), DEFAULT_LISTEN);
assert!(args.listen.ip().is_loopback());
assert!(
!args.push_loopback,
"loopback push endpoints only when asked for"
);
assert!(
parse_args(["--push-loopback".to_string()])
.expect("flag")
.push_loopback
);
assert!(parse_args(["--listen".to_string()]).is_err());
assert!(parse_args(["--verbose".to_string()]).is_err());
}