-
Notifications
You must be signed in to change notification settings - Fork 26
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
Go sharded client #43
Conversation
e16d9ec
to
48f16d2
Compare
clients/go/dkv/client.go
Outdated
return m, nil | ||
} | ||
|
||
type SimpleDKVClient struct { |
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.
Please provide a public API(s) for initializing instances of this struct
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.
Made this private. There is already an existing api to create ctl.NewInSecureDKVClient(....)
clients/go/dkv/client.go
Outdated
BufferItems: 64, | ||
OnExit: func(val interface{}) { | ||
client := val.(*SimpleDKVClient) | ||
log.Printf("Closing Client of %s \n", client.Addr) |
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.
Given that Addr
has this only logging usage here, please check if this log statement is needed. Or check if this can be logged from inside client.Close()
itself.
clients/go/dkv/client.go
Outdated
|
||
type ShardProvider interface { | ||
ProvideShard(key []byte) (*DKVShard, error) | ||
ProvideShards(keys ...[]byte) (map[*DKVShard][][]byte, error) |
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.
Given that the key used in the returned map
is a pointer, only pointer equality is considered. In other words, the underlying DKVShard
equality is never considered. Please check 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.
Refactored it to return slice of DKVKeyGroup
clients/go/dkv/client.go
Outdated
shards []DKVShard | ||
} | ||
|
||
func NewShardedDKVClient(shardProvider ShardProvider) (*ShardedDKVClient, error) { |
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.
Please validate if the shardProvider
is actually given.
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.
Done
clients/go/dkv/client.go
Outdated
for _, serverRole := range role { | ||
nodeSet, err = shard.GetNodesByType(serverRole) | ||
if err == nil { | ||
return nodeSet, 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.
Please use return 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.
This is an early return, breaks out of the iteration by returning nodeSet
be8fe95
to
e6ea193
Compare
809fdf2
to
780db31
Compare
Implements the sharded go-client #40