release(core): tines-core 1.0.0
This commit is contained in:
@@ -10,6 +10,7 @@ use crate::observation::{NodeId, Observation};
|
||||
|
||||
/// Reduces an ordered stream of observations to a single accumulated belief.
|
||||
pub trait BeliefPolicy {
|
||||
/// The accumulated belief this policy folds into.
|
||||
type Belief;
|
||||
/// Streaming fold: called once per matching observation (already
|
||||
/// age-adjusted to `now`), in no particular order. `acc` is `None` before
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! tines-core: content-defined Observation identity and shared-memory core.
|
||||
#![no_std]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
extern crate alloc;
|
||||
|
||||
@@ -42,7 +42,9 @@ pub struct Dest {
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Observation {
|
||||
/// The node that published this observation.
|
||||
pub observer: NodeId,
|
||||
/// The observer's per-observation sequence number.
|
||||
pub seq: u64,
|
||||
/// The observer's elapsed time for this observation, in ms.
|
||||
///
|
||||
@@ -56,7 +58,9 @@ pub struct Observation {
|
||||
/// this observation was published, or `None` if the observer has no
|
||||
/// trusted clock. Set once at construction and never changed by a relay.
|
||||
pub observed_at: Option<u64>,
|
||||
/// The topic this observation is published under.
|
||||
pub topic: Topic,
|
||||
/// The observation's content.
|
||||
pub payload: Payload,
|
||||
/// Addressing: `None` is a broadcast, `Some(dest)` is addressed to
|
||||
/// `dest.to` and expires per `dest.lifetime_ms`.
|
||||
|
||||
+20
-1
@@ -21,24 +21,40 @@ use serde::{Deserialize, Serialize};
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Frame {
|
||||
/// A broadcast bloom summary of a node's observation-id set.
|
||||
Summary {
|
||||
/// The sending node.
|
||||
from: NodeId,
|
||||
/// The bloom salt the bits were hashed with.
|
||||
salt: u32,
|
||||
/// The broadcast bloom bits (the summary body).
|
||||
bits: Vec<u8, { consts::SUMMARY_BYTES }>,
|
||||
},
|
||||
/// A single observation, broadcast or addressed (see [`Observation::dest`]).
|
||||
Obs {
|
||||
/// The sending (relaying or originating) node.
|
||||
from: NodeId,
|
||||
/// The carried observation.
|
||||
obs: Observation,
|
||||
},
|
||||
/// One fragment of a large addressed observation (reassembly by `id`).
|
||||
Frag {
|
||||
/// The sending node.
|
||||
from: NodeId,
|
||||
/// The observation this fragment belongs to.
|
||||
id: ObservationId,
|
||||
/// This fragment's 0-based position in the reassembly.
|
||||
index: u8,
|
||||
/// The total number of fragments for `id`.
|
||||
count: u8,
|
||||
/// The fragment payload bytes.
|
||||
data: Vec<u8, { consts::MAX_FRAME }>,
|
||||
},
|
||||
/// An acknowledgement of stored observation ids (custody-chain release).
|
||||
Ack {
|
||||
/// The acknowledging node.
|
||||
from: NodeId,
|
||||
/// The observation ids being acknowledged.
|
||||
ids: Vec<ObservationId, { consts::ACK_IDS_CAP }>,
|
||||
},
|
||||
}
|
||||
@@ -139,7 +155,10 @@ pub enum WireError {
|
||||
/// The input bytes were malformed, truncated, or not a valid `Frame`.
|
||||
Malformed,
|
||||
/// The frame's leading `WIRE_VERSION` byte did not match `consts::WIRE_VERSION`.
|
||||
VersionMismatch { version: u8 },
|
||||
VersionMismatch {
|
||||
/// The version byte read off the wire.
|
||||
version: u8,
|
||||
},
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user