Skip to content

Commit ac9966d

Browse files
committed
chore: updating message format
Signed-off-by: Simon Paitrault <[email protected]>
1 parent 90383e0 commit ac9966d

File tree

9 files changed

+34
-30
lines changed

9 files changed

+34
-30
lines changed

Cargo.toml

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
[workspace]
2+
resolver = "2"
23
default-members = ["crates/*"]
34
members = ["crates/*", "examples/*"]
45

56
[workspace.dependencies]
67
uuid = { version = "1.3.0", features = ["serde", "v4"] }
78
serde = { version = "1.0.117", features = ["derive"] }
8-
sqlx = { version = "0.6.2", features = ["chrono", "time", "uuid", "json", "offline", "runtime-actix-native-tls"] }
9+
sqlx = { version = "0.6.2", features = [
10+
"chrono",
11+
"time",
12+
"uuid",
13+
"json",
14+
"offline",
15+
"runtime-actix-native-tls",
16+
] }
917
async-trait = "0.1.51"
1018
serde_json = "1.0.68"
1119
actix = "0.12.0"
@@ -14,5 +22,3 @@ log = "0.4.14"
1422
tokio = { version = "1.12.0", features = ["full"] }
1523
tracing = "0.1.28"
1624
tracing-futures = "0.2.5"
17-
18-

crates/chekov/src/message.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct EventMetadatas {
4848

4949
#[doc(hidden)]
5050
#[derive(Debug, Clone, Message)]
51-
#[rtype(result = "Result(), ()>")]
51+
#[rtype(result = "Result<(), ()>")]
5252
pub struct EventEnvelope<E: Event> {
5353
pub event: E,
5454
pub meta: EventMetadatas,
@@ -65,55 +65,53 @@ pub struct ResolveAndApply(pub RecordedEvent);
6565
pub struct ResolveAndApplyMany(pub Vec<RecordedEvent>);
6666

6767
#[derive(Message)]
68-
#[rtype("Result<Vec<RecordedEvent>, event_store::prelude::EventStoreError>")]
68+
#[rtype(result = "Result<Vec<RecordedEvent>, event_store::prelude::EventStoreError>")]
6969
pub(crate) struct ExecuteReader(pub(crate) event_store::prelude::Reader);
7070

7171
#[derive(Message)]
72-
#[rtype(
73-
"Result<
72+
#[rtype(result = "Result<
7473
std::pin::Pin<
7574
Box<dyn futures::Stream<Item = Result<Vec<RecordedEvent>, EventStoreError>> + Send>,
7675
>,
7776
EventStoreError,
78-
>"
79-
)]
77+
>")]
8078
pub(crate) struct ExecuteStreamForward(pub(crate) String);
8179

8280
#[derive(Message)]
83-
#[rtype("Result<Vec<Uuid>, event_store::prelude::EventStoreError>")]
81+
#[rtype(result = "Result<Vec<Uuid>, event_store::prelude::EventStoreError>")]
8482
pub(crate) struct ExecuteAppender(pub(crate) event_store::prelude::Appender);
8583

8684
#[derive(Message)]
87-
#[rtype("Result<event_store::prelude::Stream, event_store::prelude::EventStoreError>")]
85+
#[rtype(result = "Result<event_store::prelude::Stream, event_store::prelude::EventStoreError>")]
8886
pub(crate) struct ExecuteStreamInfo(pub(crate) String);
8987

9088
#[derive(Message)]
91-
#[rtype("u64")]
89+
#[rtype(result = "u64")]
9290
pub(crate) struct AggregateVersion;
9391

9492
#[derive(Message)]
95-
#[rtype("A")]
93+
#[rtype(result = "A")]
9694
pub(crate) struct AggregateState<A: Aggregate>(pub(crate) PhantomData<A>);
9795

9896
#[derive(Message, Debug)]
99-
#[rtype("()")]
97+
#[rtype(result = "()")]
10098
pub(crate) struct StartListening;
10199

102100
#[derive(Message)]
103-
#[rtype("Addr<event_store::EventStore<S>>")]
101+
#[rtype(result = "Addr<event_store::EventStore<S>>")]
104102
pub(crate) struct GetEventStoreAddr<S: Storage> {
105103
pub(crate) _phantom: PhantomData<S>,
106104
}
107105

108106
#[derive(Message)]
109-
#[rtype("Option<Addr<crate::aggregate::AggregateInstance<A>>>")]
107+
#[rtype(result = "Option<Addr<crate::aggregate::AggregateInstance<A>>>")]
110108
pub(crate) struct GetAggregateAddr<A: Aggregate> {
111109
pub(crate) identifier: String,
112110
pub(crate) _phantom: PhantomData<A>,
113111
}
114112

115113
#[derive(Message)]
116-
#[rtype("Result<Addr<crate::aggregate::AggregateInstance<A>>, ()>")]
114+
#[rtype(result = "Result<Addr<crate::aggregate::AggregateInstance<A>>, ()>")]
117115
pub(crate) struct StartAggregate<A: Aggregate, APP: Application> {
118116
pub(crate) identifier: String,
119117
pub(crate) correlation_id: Option<Uuid>,
@@ -122,7 +120,7 @@ pub(crate) struct StartAggregate<A: Aggregate, APP: Application> {
122120
}
123121

124122
#[derive(Message)]
125-
#[rtype("Result<(), ()>")]
123+
#[rtype(result = "Result<(), ()>")]
126124
pub(crate) struct ShutdownAggregate {
127125
pub(crate) identifier: String,
128126
}

crates/event_store-core/src/event/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait Event: Serialize + Send + std::convert::TryFrom<RecordedEvent> {
2727

2828
/// A `RecordedEvent` represents an `Event` which have been append to a `Stream`
2929
#[derive(sqlx::FromRow, Debug, Clone, Message, Serialize)]
30-
#[rtype("()")]
30+
#[rtype(result = "()")]
3131
pub struct RecordedEvent {
3232
/// an incrementing and gapless integer used to order the event in a stream.
3333
#[sqlx(try_from = "i64")]

crates/event_store-core/src/event_bus/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub type BoxedStream = Pin<
2626
>;
2727

2828
#[derive(Debug, Message)]
29-
#[rtype("()")]
29+
#[rtype(result = "()")]
3030
pub enum EventBusMessage {
3131
Notification(EventNotification),
3232
Events(String, Vec<RecordedEvent>),

crates/event_store/src/connection/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ mod messaging;
2121
pub use messaging::{Append, CreateStream, Read, StreamForward, StreamForwardResult, StreamInfo};
2222

2323
#[derive(Message)]
24-
#[rtype("()")]
24+
#[rtype(result = "()")]
2525
// TODO: Remove this by a better subscription channel
2626
pub struct OpenNotificationChannel {
2727
pub(crate) sender: mpsc::UnboundedSender<EventBusMessage>,

crates/event_store/src/event/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use crate::core::event::UnsavedEvent;
66
pub use crate::core::event::UnsavedEventError;
77

88
#[derive(Debug, Clone, Message)]
9-
#[rtype("()")]
9+
#[rtype(result = "()")]
1010
pub struct RecordedEvents {
1111
pub(crate) events: Vec<RecordedEvent>,
1212
}

crates/event_store/src/subscriptions/pub_sub.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ impl PubSub {
3737
}
3838

3939
#[derive(Message)]
40-
#[rtype("()")]
40+
#[rtype(result = "()")]
4141
struct Subscribe(Recipient<SubscriptionNotification>, String);
4242

4343
#[derive(Message)]
44-
#[rtype("usize")]
44+
#[rtype(result = "usize")]
4545
struct GetSubscriberCountForStream(String);
4646

4747
#[derive(Message)]
48-
#[rtype("()")]
48+
#[rtype(result = "()")]
4949
pub struct PubSubNotification {
5050
pub(crate) stream: String,
5151
pub(crate) events: Vec<RecordedEvent>,

crates/event_store/src/subscriptions/subscription.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use actix::prelude::*;
1414
use tracing::debug;
1515

1616
#[derive(Debug, Message)]
17-
#[rtype("()")]
17+
#[rtype(result = "()")]
1818
struct Connect(pub Recipient<SubscriptionNotification>, SubscriptionOptions);
1919

2020
#[derive(Debug, Message)]
21-
#[rtype("()")]
21+
#[rtype(result = "()")]
2222
pub struct CatchUp;
2323

2424
#[derive(Debug)]

crates/event_store/src/subscriptions/supervisor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<S: Storage> Handler<CreateSubscription<S>> for SubscriptionsSupervisor<S> {
8585
}
8686

8787
#[derive(Message)]
88-
#[rtype("()")]
88+
#[rtype(result = "()")]
8989
pub struct Started;
9090

9191
impl<S: Storage> Handler<Started> for SubscriptionsSupervisor<S> {
@@ -97,7 +97,7 @@ impl<S: Storage> Handler<Started> for SubscriptionsSupervisor<S> {
9797
}
9898

9999
#[derive(Message)]
100-
#[rtype("()")]
100+
#[rtype(result = "()")]
101101
pub struct GoingDown;
102102

103103
impl<S: Storage> Handler<GoingDown> for SubscriptionsSupervisor<S> {
@@ -109,7 +109,7 @@ impl<S: Storage> Handler<GoingDown> for SubscriptionsSupervisor<S> {
109109
}
110110

111111
#[derive(Message)]
112-
#[rtype("()")]
112+
#[rtype(result = "()")]
113113
pub struct Down;
114114

115115
impl<S: Storage> Handler<Down> for SubscriptionsSupervisor<S> {

0 commit comments

Comments
 (0)