diff options
Diffstat (limited to 'src/remake/api.rs')
| -rw-r--r-- | src/remake/api.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/remake/api.rs b/src/remake/api.rs index 9c8a88a..ed45613 100644 --- a/src/remake/api.rs +++ b/src/remake/api.rs @@ -20,6 +20,10 @@ //! "replayWindow": {"epochs": 1, "seconds": 604800}, //! "archiveRetention": {"epochs": 2, "seconds": 2592000}, //! "settleSecs": 480 }` +//! +//! `kind` is `compact` (no spec) or `replace`, whose spec is +//! `{ "document": {…store root…}, "rules": [{"from": "a", "to": "b"}, {"from": "c", "drop": true}] }` +//! (see `kind::Replace`). Reports leave the replacement document out (`contentBytes`). use std::time::Duration; @@ -83,6 +87,10 @@ struct Report { phase: Phase, #[serde(flatten)] record: Record, + /// Size of the kind's build input (e.g. a replacement document), which reports + /// leave out. + #[serde(skip_serializing_if = "Option::is_none")] + content_bytes: Option<usize>, /// What happened to this remake on the node answering the request. #[serde(skip_serializing_if = "Option::is_none")] local: Option<LocalStatus>, @@ -114,10 +122,12 @@ fn grace<H: Host>(host: &H) -> u64 { host.dormant_after().as_millis() as u64 } -fn report<H: Host>(host: &H, id: String, record: Record) -> Report { +fn report<H: Host>(host: &H, id: String, mut record: Record) -> Report { + let content = std::mem::take(&mut record.proposal.content); Report { phase: record.phase(unix_millis(), grace(host)), local: host.remake().status(&id), + content_bytes: (!content.is_null()).then(|| content.to_string().len()), id, record, } |
