Skip to main content

harmos_domain/operations/streams/
payloads.rs

1/* ***
2 *
3 * Harmos
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * ***
8 */
9
10/* === Modules === */
11
12/* === Re-Exports === */
13
14/* === Imports === */
15
16// Standard Library Imports
17
18// Third Party Imports
19
20// Local Imports
21use crate::operations::common::payload::payload;
22
23/* === Constants === */
24
25/* === Macros === */
26
27// One Ordered Batch On One Stream: The Head Row Carries `sequence`; Each
28// Following Row Takes The Next Sequence. A Single Row Has No Following Rows.
29payload! { Publish,
30    stream: String => (1, Kind::String, Required),
31    schema: u32 => (2, Kind::U32, Required),
32    sequence: Option<u64> => (3, Kind::U64, Optional),
33    published_unix_micros: Option<i64> => (4, Kind::I64, Optional),
34    context: Option<String> => (5, Kind::String, Optional),
35    payload: Vec<u8> => (6, Kind::Bytes, Required),
36    following: Vec<FollowingRow> => (7, Kind::Message { definition: FollowingRow::DEFINITION }, Repeated),
37}
38
39// A Following Row's Stamp Is Its Signed Offset From The Preceding Row's
40// Stamp, So A Steady Series Costs A Short Varint Per Row. It Is Present
41// Exactly When The Row Is Stamped, And Requires A Stamped Predecessor.
42payload! { FollowingRow,
43    payload: Vec<u8> => (1, Kind::Bytes, Required),
44    published_delta_micros: Option<i64> => (2, Kind::I64, Optional),
45}
46
47/* === Type Aliases === */
48
49/* === Structs === */
50
51/* === Enums === */
52
53/* === Traits === */
54
55/* === Implementations === */
56
57/* === Public Functions === */
58
59/* === Private Functions === */
60
61/* === Tests === */