-
Notifications
You must be signed in to change notification settings - Fork 213
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
feat(iroh): add ticket prefixes and a doctor ticket-inspect
command
#1711
Conversation
doctor ticket-inspect
command
doctor ticket-inspect
commanddoctor ticket-inspect
command
iroh/src/ticket.rs
Outdated
/// Serialize to string. | ||
fn serialize(&self) -> String { | ||
let mut out = Self::KIND.to_string(); | ||
out.push(':'); |
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.
ok, I want to propose we use _
instead of :
to separate. my reason: I can't double-click the ticket to get the entire string if we use the colon. If we use the underscore it'll work
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.
curious I thought this would happen but weirdly it works on my terminal
iroh/src/ticket/blob.rs
Outdated
const KIND: Kind = Kind::Blob; | ||
} | ||
|
||
impl std::str::FromStr for Ticket { |
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.
couldn't this be done with a blanket impl
impl<T: Ticket> FromStr for T {
}
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.
sadly no, due to orphan rules we need to own either the type over which the trait is implemented, or the implemented trait, and here we only own the bound
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.
:(
iroh/src/ticket/blob.rs
Outdated
} | ||
|
||
/// Deserializes from bytes. | ||
pub fn from_bytes(bytes: &[u8]) -> Result<Self> { |
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.
This shadowing of method names is a bit tricky. Maybe add a verify_ticket
method to the trait (which is called when doing from_bytes
, with a default impl of Ok(())
and implement the verification you are doing here with that?
contains an empty file of |
in light of the changes done in #1738 I'm thinking there is no need to group the tickets together so not to overwrite the authorship of the code. What would you prefer @dignifiedquire to keep them together like this or where they currently are on main? Revert to where they are should be quick |
I think it is great to move them together |
Description
Adds a
doc:
andblob:
prefix to the doc and blob tickets respectively. This is mandatory and identifies the kind of iroh ticket.Notes & open questions
doctor sample run (happy path):
doctor sample run (unhappy path):
another unhappy path:
Change checklist