mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-29 01:14:44 +00:00
39 lines
914 B
TeX
39 lines
914 B
TeX
\section{Event Ordering}
|
|
|
|
|
|
\subsection{Causal Ordering}
|
|
|
|
Events for the same resource are delivered in causal order:
|
|
|
|
\begin{definition}[Causal Order]
|
|
For events $e_1, e_2$ on resource $r$:
|
|
\[
|
|
e_1 \prec e_2 \iff e_1.timestamp < e_2.timestamp \land e_1.resource = e_2.resource
|
|
\]
|
|
\end{definition}
|
|
|
|
\begin{theorem}[Order Preservation]
|
|
For causally related events $e_1 \prec e_2$:
|
|
\[
|
|
delivered(e_1, s) \text{ completes before } delivery(e_2, s) \text{ starts}
|
|
\]
|
|
\end{theorem}
|
|
|
|
Implementation: events are partitioned by resource ID, with single-threaded delivery per partition.
|
|
|
|
\subsection{Handling Out-of-Order Delivery}
|
|
|
|
Cross-resource events may arrive out of order. We include sequence information:
|
|
|
|
\begin{lstlisting}[caption=Sequence Metadata]
|
|
{
|
|
"id": "evt_abc123",
|
|
"sequence": 12345,
|
|
"previous_sequence": 12344,
|
|
...
|
|
}
|
|
\end{lstlisting}
|
|
|
|
Endpoints can detect and reorder events using sequence numbers.
|
|
|