aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/records.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 19:51:52 +0100
committertv <tv@krebsco.de>2026-10-31 19:51:52 +0100
commitf4b0a7c5159d418e22682d2bd7d413fb3587ca7f (patch)
tree14a8a240970c43cc06e0042a376c80bd9f7b3418 /src/remake/records.rs
parentc83604d8f82b6c67a64e3cee6f5c012ee4a10fc1 (diff)
store function accept any document
Diffstat (limited to 'src/remake/records.rs')
-rw-r--r--src/remake/records.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/remake/records.rs b/src/remake/records.rs
index 40b563a..fecae4c 100644
--- a/src/remake/records.rs
+++ b/src/remake/records.rs
@@ -38,7 +38,7 @@ use crate::clock::UnixMillis;
use crate::document::meta::{self, REMAKES, VOTES};
use crate::document::replica::Epoch;
use crate::document::store::{self, StoreError};
-use crate::document::{ChangeHash, Document};
+use crate::document::{ChangeHash, Document, Transactable};
/// One day, for retention defaults.
const DAY_MS: u64 = 24 * 60 * 60 * 1000;
@@ -446,7 +446,7 @@ pub(crate) fn load_register(doc: &Document) -> Register {
}
fn write_part<T: Serialize>(
- doc: &mut Document,
+ doc: &mut impl Transactable,
id: &str,
part: &str,
value: &T,
@@ -456,7 +456,7 @@ fn write_part<T: Serialize>(
}
pub(crate) fn write_proposal(
- doc: &mut Document,
+ doc: &mut impl Transactable,
id: &str,
proposal: &Proposal,
) -> Result<(), StoreError> {
@@ -464,7 +464,7 @@ pub(crate) fn write_proposal(
}
pub(crate) fn write_decision(
- doc: &mut Document,
+ doc: &mut impl Transactable,
id: &str,
decision: &Decision,
) -> Result<(), StoreError> {
@@ -472,7 +472,7 @@ pub(crate) fn write_decision(
}
pub(crate) fn write_abort_request(
- doc: &mut Document,
+ doc: &mut impl Transactable,
id: &str,
request: &AbortRequest,
) -> Result<(), StoreError> {
@@ -480,7 +480,11 @@ pub(crate) fn write_abort_request(
}
/// Writes `voter`'s entry in the votes register (replacing its earlier one).
-pub(crate) fn write_vote(doc: &mut Document, voter: &str, vote: &Vote) -> Result<(), StoreError> {
+pub(crate) fn write_vote(
+ doc: &mut impl Transactable,
+ voter: &str,
+ vote: &Vote,
+) -> Result<(), StoreError> {
let json = serde_json::to_value(vote).map_err(anyhow::Error::from)?;
store::write_path(doc, &register_path(voter), &json)
}