s2_api/v1/stream/proto/s2.v1.rs
1// This file is @generated by prost-build.
2/// Position of a record in a stream.
3#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct StreamPosition {
5 /// Sequence number assigned by the service.
6 #[prost(uint64, tag = "1")]
7 pub seq_num: u64,
8 /// Timestamp, which may be user-specified or assigned by the service.
9 /// If it is assigned by the service, it will represent milliseconds since Unix epoch.
10 #[prost(uint64, tag = "2")]
11 pub timestamp: u64,
12}
13/// Headers add structured information to a record as name-value pairs.
14#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
15pub struct Header {
16 /// Header name blob.
17 /// The name cannot be empty, with the exception of an S2 command record.
18 #[prost(bytes = "bytes", tag = "1")]
19 pub name: ::prost::bytes::Bytes,
20 /// Header value blob.
21 #[prost(bytes = "bytes", tag = "2")]
22 pub value: ::prost::bytes::Bytes,
23}
24/// Record to be appended to a stream.
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct AppendRecord {
27 /// Timestamp for this record.
28 /// Precise semantics depend on the stream's `timestamping` config.
29 #[prost(uint64, optional, tag = "1")]
30 pub timestamp: ::core::option::Option<u64>,
31 /// Series of name-value pairs for this record.
32 #[prost(message, repeated, tag = "2")]
33 pub headers: ::prost::alloc::vec::Vec<Header>,
34 /// Body of this record.
35 #[prost(bytes = "bytes", tag = "3")]
36 pub body: ::prost::bytes::Bytes,
37}
38/// Payload of an Append request message.
39#[derive(Clone, PartialEq, ::prost::Message)]
40pub struct AppendInput {
41 /// Batch of records to append atomically, which must contain at least one record, and no more than 1000.
42 /// The total size of a batch of records may not exceed 1MiB of metered bytes.
43 #[prost(message, repeated, tag = "1")]
44 pub records: ::prost::alloc::vec::Vec<AppendRecord>,
45 /// Enforce that the sequence number issued to the first record matches.
46 #[prost(uint64, optional, tag = "2")]
47 pub match_seq_num: ::core::option::Option<u64>,
48 /// Enforce a fencing token which must have been previously set by a `fence` command record.
49 #[prost(string, optional, tag = "3")]
50 pub fencing_token: ::core::option::Option<::prost::alloc::string::String>,
51}
52/// Success response message to an Append request.
53#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
54pub struct AppendAck {
55 /// Sequence number and timestamp of the first record that was appended.
56 #[prost(message, optional, tag = "1")]
57 pub start: ::core::option::Option<StreamPosition>,
58 /// Sequence number of the last record that was appended + 1, and timestamp of the last record that was appended.
59 /// The difference between `end.seq_num` and `start.seq_num` will be the number of records appended.
60 #[prost(message, optional, tag = "2")]
61 pub end: ::core::option::Option<StreamPosition>,
62 /// Sequence number that will be assigned to the next record on the stream, and timestamp of the last record on the stream.
63 /// This can be greater than the `end` position in case of concurrent appends.
64 #[prost(message, optional, tag = "3")]
65 pub tail: ::core::option::Option<StreamPosition>,
66}
67/// Record that is durably sequenced on a stream.
68#[derive(Clone, PartialEq, ::prost::Message)]
69pub struct SequencedRecord {
70 /// Sequence number assigned to this record.
71 #[prost(uint64, tag = "1")]
72 pub seq_num: u64,
73 /// Timestamp for this record.
74 #[prost(uint64, tag = "2")]
75 pub timestamp: u64,
76 /// Series of name-value pairs for this record.
77 #[prost(message, repeated, tag = "3")]
78 pub headers: ::prost::alloc::vec::Vec<Header>,
79 /// Body of this record.
80 #[prost(bytes = "bytes", tag = "4")]
81 pub body: ::prost::bytes::Bytes,
82}
83/// Success response message to a Read request.
84#[derive(Clone, PartialEq, ::prost::Message)]
85pub struct ReadBatch {
86 /// Records that are durably sequenced on the stream, retrieved based on the requested criteria.
87 /// This can only be empty in response to a unary read if the request cannot be satisfied without violating an explicit bound (`count`, `bytes`, or `until`).
88 /// In the context of a session, it can be empty as a heartbeat message. A heartbeat will be sent whenever a switch to following in real-time happens, and then at a randomized gap between 5 and 15 seconds if no records have become available.
89 #[prost(message, repeated, tag = "1")]
90 pub records: ::prost::alloc::vec::Vec<SequencedRecord>,
91 /// Sequence number that will be assigned to the next record on the stream, and timestamp of the last record.
92 /// It will only be present when reading recent records.
93 #[prost(message, optional, tag = "2")]
94 pub tail: ::core::option::Option<StreamPosition>,
95}