-
Notifications
You must be signed in to change notification settings - Fork 50
feat(gRPC): Add transaction and read/write services for internal usage #8552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
83033fe
508e3b4
3f0a86b
f3d1bd3
8d40b0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
|
||
use std::sync::Arc; | ||
|
||
use iota_grpc_api::EventSubscriber; | ||
use iota_json_rpc_types::{ | ||
EffectsWithInput, EventFilter, IotaEvent, IotaTransactionBlockEffects, | ||
IotaTransactionBlockEffectsAPI, IotaTransactionBlockEvents, TransactionFilter, | ||
|
@@ -14,7 +13,6 @@ use prometheus::{ | |
IntCounterVec, IntGaugeVec, Registry, register_int_counter_vec_with_registry, | ||
register_int_gauge_vec_with_registry, | ||
}; | ||
use tokio_stream::Stream; | ||
use tracing::{error, instrument, trace}; | ||
|
||
use crate::streamer::Streamer; | ||
|
@@ -114,24 +112,17 @@ impl SubscriptionHandler { | |
Ok(()) | ||
} | ||
|
||
pub fn subscribe_events(&self, filter: EventFilter) -> impl Stream<Item = IotaEvent> { | ||
self.event_streamer.subscribe(filter) | ||
pub fn subscribe_events( | ||
&self, | ||
filter: EventFilter, | ||
) -> Box<dyn futures::Stream<Item = IotaEvent> + Send + Unpin> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be |
||
Box::new(Box::pin(self.event_streamer.subscribe(filter))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double |
||
} | ||
|
||
pub fn subscribe_transactions( | ||
&self, | ||
filter: TransactionFilter, | ||
) -> impl Stream<Item = IotaTransactionBlockEffects> { | ||
self.transaction_streamer.subscribe(filter) | ||
} | ||
} | ||
|
||
// Implement EventSubscriber trait for gRPC integration | ||
impl EventSubscriber for SubscriptionHandler { | ||
fn subscribe_events( | ||
&self, | ||
filter: EventFilter, | ||
) -> Box<dyn futures::Stream<Item = IotaEvent> + Send + Unpin> { | ||
Box::new(Box::pin(self.event_streamer.subscribe(filter))) | ||
) -> Box<dyn futures::Stream<Item = IotaTransactionBlockEffects> + Send + Unpin> { | ||
Box::new(Box::pin(self.transaction_streamer.subscribe(filter))) | ||
Comment on lines
+125
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not move these methods and make them a part of
RestStateReader
trait?