summaryrefslogtreecommitdiffstats
path: root/src/remake/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-24 07:11:29 +0200
committertv <tv@krebsco.de>2026-10-24 07:11:29 +0200
commit8384572353fc8543b1e1f46467fa98317e3504cc (patch)
tree9dbb18d925e1858a5fae717097f77fc8c2b3cc9c /src/remake/mod.rs
parente163a8c9f64a2066350bd77e70c9c74202ca22df (diff)
add the import kind of remake
Diffstat (limited to 'src/remake/mod.rs')
-rw-r--r--src/remake/mod.rs10
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>))