summaryrefslogtreecommitdiffstats
path: root/src/remake/mod.rs
diff options
context:
space:
mode:
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>))