Skip to content
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

Merged
merged 8 commits into from
Nov 18, 2022
Merged

Client implementation #40

merged 8 commits into from
Nov 18, 2022

Conversation

nahguam
Copy link
Contributor

@nahguam nahguam commented Nov 17, 2022

This is stacked on #39

@nahguam nahguam requested review from merlimat and a team as code owners November 17, 2022 15:57
common/client_pool.go Show resolved Hide resolved
standalone/standalone_rpc_server.go Outdated Show resolved Hide resolved
@nahguam nahguam mentioned this pull request Nov 17, 2022
internal/client/test_utils.go Outdated Show resolved Hide resolved
common/client_pool.go Show resolved Hide resolved
common/client_pool.go Show resolved Hide resolved
internal/client/batch/test_utils.go Outdated Show resolved Hide resolved
common/client_pool.go Show resolved Hide resolved
internal/client/batch/batch.go Outdated Show resolved Hide resolved
internal/client/batch/batcher.go Outdated Show resolved Hide resolved
internal/client/batch/manager.go Outdated Show resolved Hide resolved
oxia/client.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@merlimat merlimat left a 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 Show resolved Hide resolved
oxia/client.go Outdated Show resolved Hide resolved
oxia/client.go Outdated
return newAsyncClient(options)
}

func NewSyncClient(options *ClientOptions) SyncClient {
Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@nahguam nahguam Nov 18, 2022

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

oxia/sync_client_impl.go Show resolved Hide resolved
@nahguam nahguam merged commit 1c00497 into streamnative:main Nov 18, 2022
@nahguam nahguam deleted the client-impl branch November 18, 2022 10:25
assert.ErrorIs(t, nil, err)

err = server.Close()
assert.ErrorIs(t, nil, err)
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants