-
Notifications
You must be signed in to change notification settings - Fork 12
feat(transport): start working on transport metering & metrics #102
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
Conversation
merklefruit
left a comment
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.
smol nits
msg-socket/src/req/mod.rs
Outdated
| pub(crate) transport: Arc<RwLock<Arc<S>>>, | ||
| } | ||
|
|
||
| // Manual clone implementation needed here because `S` is n`. |
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.
typo?
| where | ||
| Io: AsyncRead + AsyncWrite + PeerAddress<A> + Unpin, | ||
| A: Address, | ||
| S: for<'a> TryFrom<&'a Io, Error: Debug>, |
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.
nice :D
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 took me a while ngl
thedevbirb
left a comment
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.
First pass, mostly readability / clarity!
| type ConnectionCtl<Io, S, A> = | ||
| ConnectionState<Framed<MeteredIo<Io, S, A>, reqrep::Codec>, ExponentialBackoff, A>; |
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.
Can you keep generics a little bit descriptive? Like Stats and Addr, otherwise looks a bit like the alphabet.
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.
I usually avoid doing that because then they become indistinguishable from concrete type implementations
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.
I see. Anyway, I think C# got it right since a lot of years with the T* naming convention. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names#type-parameter-naming-guidelines. I've also seen it a lot in TypeScript and I think it's great.
| /// The interval at which the stats should be refreshed. | ||
| refresh_interval: Duration, | ||
|
|
||
| _marker: PhantomData<A>, |
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.
The marker is not needed here, A is already captured by Io.
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.
Still needs to be actually referenced in one of the fields, I can't remove this.
msg-socket/src/req/mod.rs
Outdated
| pub(crate) struct SocketState<S> { | ||
| /// The socket stats. | ||
| pub(crate) stats: Arc<SocketStats<ReqStats>>, | ||
| pub(crate) transport: Arc<RwLock<Arc<S>>>, |
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.
I'm a bit doubtful of the Arc wrapping RwLock wrapping Arc... It feels a bit of an anti pattern
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.
Could you explain why it's necessary? Maybe with a short comment here even
Co-authored-by: Karrq <franci.dainese@gmail.com>
merklefruit
left a comment
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.
🚢
To Do
Stats for other transports will be added in follow-up