From 8384572353fc8543b1e1f46467fa98317e3504cc Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 24 Oct 2026 07:11:29 +0200 Subject: add the import kind of remake --- src/remake/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/remake/mod.rs') 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() -> Router { Router::new() .route( "/admin/remakes", get(api::list::) .post(api::start::) - .delete(api::abort_current::), + .delete(api::abort_current::) + // 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::)) -- cgit v1.3.1