diff options
| author | tv <tv@krebsco.de> | 2026-10-31 19:51:52 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 19:51:52 +0100 |
| commit | 8d7adfbdb7798cca9d9783761f290e3bd85d9a3a (patch) | |
| tree | 9efd09632fddfab97b6ff93b0f153c0a8de35c35 /src/remake | |
| parent | e4f801db5d150fb1bf5540d9ba00f491a6129a5c (diff) | |
store function accept any document
Diffstat (limited to 'src/remake')
| -rw-r--r-- | src/remake/records.rs | 16 |
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, ®ister_path(voter), &json) } |
