-
Notifications
You must be signed in to change notification settings - Fork 216
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
Prepare client.c for use in the client library #458
Conversation
Codecov Report
@@ Coverage Diff @@
## master #458 +/- ##
==========================================
- Coverage 74.32% 72.08% -2.24%
==========================================
Files 32 33 +1
Lines 5382 5878 +496
Branches 1682 1871 +189
==========================================
+ Hits 4000 4237 +237
- Misses 823 1004 +181
- Partials 559 637 +78
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Cole Miller <cole.miller@canonical.com>
This information doesn't seem useful to me. Signed-off-by: Cole Miller <cole.miller@canonical.com>
We probably want to save the generic name for a higher-level object. Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
6cd4a4d
to
291f6df
Compare
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
f7516ed
to
6ffe509
Compare
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
afdb1b6
to
036c96d
Compare
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
@freeekanayaka, could you elucidate what |
src/client/protocol.c
Outdated
* On error, -1 is returned. Otherwise the return value is the count | ||
* of bytes read. This may be less than n if either EOF happened or | ||
* polling timed out. */ | ||
static ssize_t doRead(int fd, void *buf, size_t n, int timeout_millis) |
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.
Maybe we can pass the client struct here instead and do some accounting on the timeout and save e.g. timeout_left
in the client struct after measuring the time spent in poll
?
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.
Yes, this makes sense to me, I'll try to implement it. (The alternative for setting a budget on the time spent in the loop as a whole would be arranging to get SIGALRM when a timer expires and setting up a handler, but that sounds terrible.)
Did a first round of reading through the changes, think it already looks good. |
It's basically used as glue between dqlite and raft. If you use dqlite without a custom transport, then when raft needs to establish a connection to another raft node it will use the default dqlite transport defined in It's implicitly used by go-dqlite as well via I hope my memory doesn't fail me and that everything is correct and clear :) Please let me know if something doesn't match. |
@freeekanayaka Got it, thanks! I'll add this to the docs. What's the motivation for proxying raft connections through dqlite, instead of having them flow independently? I guess it's convenient to have just one address that both dqlite and raft are listening on. |
591af7e
to
8a2e2e6
Compare
Sorry, I didn't see your follow up before. Yes, it's to have a single endpoint. |
I've pushed another (rather large, sorry) commit that implements a different strategy for timing out reads/writes. It also includes a rewrite of clientRecvRows to do proper cleanup if an error is encountered. |
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.
Mostly nits :-)
{ | ||
switch (val.type) { | ||
case SQLITE_TEXT: | ||
free((char *)val.text); |
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.
Funny that you need to cast this :-)
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.
Yes, I guess not being allow to free const T*
is some kind of safeguard against calling it on static data.
Signed-off-by: Cole Miller <cole.miller@canonical.com>
Signed-off-by: Cole Miller <cole.miller@canonical.com>
src/client.{c,h} -> src/client/protocol.{c,h}
in preparation for more client source filesThis will be easiest to review commit-by-commit.