-
Notifications
You must be signed in to change notification settings - Fork 23
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
Client implementation #40
Conversation
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.
👍 👍
oxia/client.go
Outdated
return newAsyncClient(options) | ||
} | ||
|
||
func NewSyncClient(options *ClientOptions) SyncClient { |
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.
(for subsequent PRs)
Since we are taking the "serviceUrl", it doesn't really make sense to take options = nil
which would mean "default options".
Because of that, we could just take options ClientOptions
as the argument.
One problem with Go struct, when used as options, is that it's not easy to provide default values. All the integers default to 0, and pointers to nil
.
One aspect to consider is to that we might want to have linger time = 0
when using sync API, or we're going to cap the throughput.
There are 2 options, either we consider "0 means default" or we could
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.
or we could...
😄
Yes, I was pondering this last night. I'll remove the pointer.
For the sync client, we can just do max size = 1
then it'll send one at a time.
0 = default sounds like a reasonable starting point.
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.
Or I could try this - https://www.sohamkamani.com/golang/options-pattern/ or similar
I'll merge this PR do another one for that
assert.ErrorIs(t, nil, err) | ||
|
||
err = server.Close() | ||
assert.ErrorIs(t, nil, err) |
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 know I'm a bit late. But I think this should be assert.NoError(err)
. IIUC, this does something else
This is stacked on #39