nautilus_core/message.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2025 Posei Systems Pty Ltd. All rights reserved.
3// https://poseitrader.io
4//
5// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6// You may not use this file except in compliance with the License.
7// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Common message types.
17
18use crate::{UUID4, UnixNanos};
19
20/// Represents different types of messages in the system.
21#[derive(Debug, Clone)]
22pub enum Message {
23 /// A command message with an identifier and initialization timestamp.
24 Command {
25 /// The unique identifier for this command.
26 id: UUID4,
27 /// The initialization timestamp.
28 ts_init: UnixNanos,
29 },
30 /// A document message with an identifier and initialization timestamp.
31 Document {
32 /// The unique identifier for this document.
33 id: UUID4,
34 /// The initialization timestamp.
35 ts_init: UnixNanos,
36 },
37 /// An event message with identifiers and timestamps.
38 Event {
39 /// The unique identifier for this event.
40 id: UUID4,
41 /// The initialization timestamp.
42 ts_init: UnixNanos,
43 /// The event timestamp.
44 ts_event: UnixNanos,
45 },
46 /// A request message with an identifier and initialization timestamp.
47 Request {
48 /// The unique identifier for this request.
49 id: UUID4,
50 /// The initialization timestamp.
51 ts_init: UnixNanos,
52 },
53 /// A response message with identifiers, timestamps, and correlation.
54 Response {
55 /// The unique identifier for this response.
56 id: UUID4,
57 /// The initialization timestamp.
58 ts_init: UnixNanos,
59 /// The correlation identifier linking this response to a request.
60 correlation_id: UUID4,
61 },
62}