Weave documentation
Rust referenceweave-nexus

weave-nexus · ordering

Source declarations, signatures and documentation for ordering.

Source: sigil/weave/models/nexus/src/ordering.rs. SHA-256: a48537d8d16d4331f4a4990aa104cb154fa1bc2f1e1d3aaf38c9b4e272a534eb.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

ordering::UnorderedEntry

Unordered entry from an input strand

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UnorderedEntry {
/// DID of the source agent

pub source_agent: String,
/// Index in the source strand

pub source_index: u64,
/// Entry data

pub data: Vec<u8>,
/// Timestamp

pub timestamp: SystemTime,
/// Additional metadata

pub metadata: Option<serde_json::Value>
}

Source line: 15.

ordering::UnorderedEntry::into_view_entry

Convert to view entry

pub fn into_view_entry(self) -> ViewEntry;

Source line: 34.

ordering::OrderingStrategy

Strategy for ordering entries from multiple strands

#[async_trait]
pub trait OrderingStrategy: Send + Sync {
    /// Order entries from multiple sources
    fn order(&self, entries: Vec<UnorderedEntry>) -> Vec<ViewEntry>;

    /// Update ordering with new entries (for incremental updates)
    fn update(&mut self, new_entries: Vec<UnorderedEntry>) -> Vec<ViewEntry>;

    /// Get strategy name
    fn name(&self) -> &str;
}

Source line: 47.

ordering::TimestampOrdering

Timestamp-based ordering (most common)

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TimestampOrdering {
/// Whether to break ties by agent DID

pub stable_sort: bool
}

Source line: 60.

ordering::TimestampOrdering::new

Create new timestamp ordering

pub fn new() -> Self;

Source line: 71.

ordering::TimestampOrdering::with_stable_sort

Create with stable sort option

pub fn with_stable_sort(stable_sort: bool) -> Self;

Source line: 79.

ordering::CustomOrdering

Custom application-defined ordering

pub struct CustomOrdering<F> {

}

Source line: 143.

ordering::CustomOrdering<F>::new

Create custom ordering with comparison function

pub fn new(name: String, order_fn: F) -> Self;

Source line: 155.

ordering::IndexOrdering

Index-based ordering (preserves strand order)

#[derive(Debug, Clone, Default)]
#[allow(dead_code)]
pub struct IndexOrdering;

Source line: 183.

On this page