-
Notifications
You must be signed in to change notification settings - Fork 19
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
Introduce gRPC replication client api #1062
Draft
mkysel
wants to merge
17
commits into
main
Choose a base branch
from
mkysel/replication-grpc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7615a23
Introduce gRPC replication client api
mkysel cc70ecd
advancement
mkysel 9a92b24
teach client to use v4
mkysel 9d486ca
cleanup
mkysel 45c63dd
Fix fmt
mkysel 7d5437d
another one
mkysel 47cfdef
Merge branch 'main' into mkysel/replication-grpc
mkysel 1ae37ec
Merge branch 'main' into mkysel/replication-grpc
mkysel 9cc822e
Write to identity updates
neekolas beff857
Merge branch 'nm/identity-update-fixes' into mkysel/replication-grpc
neekolas aa20dbf
Add get inbox ids endpoint to the server
neekolas 4124db0
Add more methods to send to v4
neekolas 0319045
Convert group message results
neekolas d77f22f
Convert welcome message results
neekolas ba8b08a
Fix delimiter
neekolas 200d46a
Take group id from request
neekolas 95ce411
Add check command
richardhuaaa 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
use prost::Message; | ||
use xmtp_proto::xmtp::xmtpv4::{ | ||
ClientEnvelope, OriginatorEnvelope, PayerEnvelope, PublishEnvelopeRequest, | ||
UnsignedOriginatorEnvelope, | ||
}; | ||
|
||
pub fn wrap_client_envelope(req: ClientEnvelope) -> PublishEnvelopeRequest { | ||
let mut buf = vec![]; | ||
req.encode(&mut buf).unwrap(); | ||
|
||
PublishEnvelopeRequest { | ||
payer_envelope: Some(PayerEnvelope { | ||
unsigned_client_envelope: buf, | ||
payer_signature: None, | ||
}), | ||
} | ||
} | ||
|
||
pub fn extract_unsigned_originator_envelope( | ||
req: &OriginatorEnvelope, | ||
) -> UnsignedOriginatorEnvelope { | ||
let mut unsigned_bytes = req.unsigned_originator_envelope.as_slice(); | ||
UnsignedOriginatorEnvelope::decode(&mut unsigned_bytes) | ||
.expect("Failed to decode unsigned originator envelope") | ||
} | ||
|
||
pub fn extract_client_envelope(req: &OriginatorEnvelope) -> ClientEnvelope { | ||
let unsigned_originator = extract_unsigned_originator_envelope(req); | ||
|
||
let payer_envelope = unsigned_originator.payer_envelope.unwrap(); | ||
let mut payer_bytes = payer_envelope.unsigned_client_envelope.as_slice(); | ||
ClientEnvelope::decode(&mut payer_bytes).expect("Failed to decode client envelope") | ||
} | ||
|
||
pub fn extract_group_id_from_topic(topic: Vec<u8>) -> Vec<u8> { | ||
let topic_str = String::from_utf8(topic).expect("Failed to convert topic to string"); | ||
let group_id = topic_str | ||
.split("/") | ||
.nth(1) | ||
.expect("Failed to extract group id from topic"); | ||
group_id.as_bytes().to_vec() | ||
} |
Oops, something went wrong.
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.
Nit: create_payer_envelope?