pub struct IngestReport {
pub accepted: u64,
pub duplicate: u64,
pub pending: u64,
pub rejected: BTreeMap<Rejection, u64>,
}Expand description
What one ingest did: how many events were stored, how many were deliveries of something already held, how many are waiting for a gap ahead of them, and what was refused and why. Every event handed in is accounted for in exactly one of those, which is what makes a sync round auditable — a peer that sends ten events and is told about ten knows nothing went missing between the wire and the store.
use std::sync::Arc;
use majordomus_cli::mesh::identity::NodeIdentity;
use majordomus_cli::mesh::journal::{EventBody, IngestReport, Journal, SessionInfo};
let a = Journal::open(Arc::new(NodeIdentity::ephemeral().unwrap()), "0000000000000001",
"repo".into(), None).unwrap();
let b = Journal::open(Arc::new(NodeIdentity::ephemeral().unwrap()), "0000000000000002",
"repo".into(), None).unwrap();
a.append_own(EventBody::SessionOpened { info: SessionInfo::named("s1", "cli") }).unwrap();
let events = a.missing_for(&b.marks(), 1 << 20);
let first: IngestReport = b.ingest(&events, &|_| Ok(()));
assert_eq!((first.accepted, first.duplicate, first.rejected_total()), (1, 0, 0));
// at-least-once delivery: the same event again is absorbed, and changes nothing
let second = b.ingest(&events, &|_| Ok(()));
assert_eq!((second.accepted, second.duplicate), (0, 1));Fields§
§accepted: u64Newly stored and applied, in stream order.
duplicate: u64Already held: at-least-once delivery, absorbed.
pending: u64Held back until the gap before them arrives.
rejected: BTreeMap<Rejection, u64>Refused, by reason.
Implementations§
Source§impl IngestReport
impl IngestReport
Sourcepub fn rejected_total(&self) -> u64
pub fn rejected_total(&self) -> u64
Every refused event, summed over reasons.
Trait Implementations§
Source§impl Clone for IngestReport
impl Clone for IngestReport
Source§fn clone(&self) -> IngestReport
fn clone(&self) -> IngestReport
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IngestReport
impl Debug for IngestReport
Source§impl Default for IngestReport
impl Default for IngestReport
Source§fn default() -> IngestReport
fn default() -> IngestReport
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for IngestReport
impl<'de> Deserialize<'de> for IngestReport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for IngestReport
Source§impl JsonSchema for IngestReport
impl JsonSchema for IngestReport
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for IngestReport
impl PartialEq for IngestReport
Source§fn eq(&self, other: &IngestReport) -> bool
fn eq(&self, other: &IngestReport) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for IngestReport
impl Serialize for IngestReport
impl StructuralPartialEq for IngestReport
Auto Trait Implementations§
impl Freeze for IngestReport
impl RefUnwindSafe for IngestReport
impl Send for IngestReport
impl Sync for IngestReport
impl Unpin for IngestReport
impl UnsafeUnpin for IngestReport
impl UnwindSafe for IngestReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.