diff options
| author | tv <tv@krebsco.de> | 2026-10-24 07:11:29 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-24 07:11:29 +0200 |
| commit | a0366110be066b2524aa62251e4ccc1bc8bb8d77 (patch) | |
| tree | 50d02ab898f6e5edaa92dc722dc1181a4712eacf /src/remake/mod.rs | |
| parent | 6aececaf6fa9892bb48bb7b2cee96c8ed73e98e7 (diff) | |
add the import kind of remake
Diffstat (limited to 'src/remake/mod.rs')
| -rw-r--r-- | src/remake/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/remake/mod.rs b/src/remake/mod.rs index 2429ad7..6a9c6f9 100644 --- a/src/remake/mod.rs +++ b/src/remake/mod.rs @@ -38,6 +38,7 @@ use std::time::Duration; use automerge::AutoCommit; use axum::{ Router, + extract::DefaultBodyLimit, routing::{get, post}, }; use tokio::sync::broadcast; @@ -122,13 +123,20 @@ pub(crate) struct PeerSummary { } /// Admin routes. Merged into the authenticated part of the node's router. +/// Largest remake request (bytes). The proposal carries the new document to every +/// node in one sync message, which Mycelium must deliver within its deadline, so +/// documents near this size are already a stretch. +const REMAKE_REQUEST_LIMIT: usize = 64 * 1024 * 1024; + pub(crate) fn router<H: Host>() -> Router<H> { Router::new() .route( "/admin/remakes", get(api::list::<H>) .post(api::start::<H>) - .delete(api::abort_current::<H>), + .delete(api::abort_current::<H>) + // A replace or import request carries a whole document. + .layer(DefaultBodyLimit::max(REMAKE_REQUEST_LIMIT)), ) // The original endpoint, kept as a shortcut for a compacting remake. .route("/admin/compaction", post(api::start_compaction::<H>)) |
