-
Notifications
You must be signed in to change notification settings - Fork 224
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
[WIP] Notifications and pubsub transports #10
Closed
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5e39a63
features: prep for pubsub
prestwich 12ef129
wip
prestwich 83471ef
start of pubsub
prestwich 34422f3
more pubsub
prestwich 55bb86d
more more pubsub
prestwich a4bdcd3
feature: more more more pubsub
prestwich 4a11097
lint: clippy and fmt
prestwich a0c42fc
chore: some cleanup
prestwich d054171
chore: cleanup
prestwich f467e58
refactor: subscription takes full request. Simpler local_id
prestwich 36ef797
fix: avoid exporting internal types
prestwich db5304b
fix: unsubscribe and get_sub by local_id
prestwich f4266d0
clean: local_to_server
prestwich 9541bc5
doc: lots of pubsub doc
prestwich e660fca
fix: clippy
prestwich abfaa76
refactor: move ix to its own mod
prestwich 4d7cef7
refactor: Request and Response have default types
prestwich 5473600
cleanup: select loop in backend
prestwich e48270b
fix: move keepalive below new dispatch
prestwich 50c639e
refactor: misc cleanup
prestwich d5bc154
fix: canonicalize
prestwich 522f8d8
fix: doc link
prestwich c514f89
refactor: cleanup PR comments
prestwich 819e4d9
refactor: move transport to a module
prestwich e0bc358
refactor: introduce TransportRequest
prestwich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use alloy_primitives::U256; | ||
use serde::{ser::SerializeMap, Deserialize, Serialize, Serializer}; | ||
|
||
#[derive(Debug, Deserialize)] | ||
pub struct EthNotification<T = Box<serde_json::value::RawValue>> { | ||
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. these are distinct from JSON-PRC notifications (which are ID-less requests) |
||
pub subscription: U256, | ||
pub result: T, | ||
} | ||
|
||
impl<T> Serialize for EthNotification<T> | ||
prestwich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
where | ||
T: Serialize, | ||
{ | ||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
let mut state = serializer.serialize_map(Some(2))?; | ||
state.serialize_entry("subscription", &self.subscription)?; | ||
state.serialize_entry("result", &self.result)?; | ||
state.end() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
allows use as key in btreemaps. implementation is arbitrary, but totally ordered