Skip to content

Commit

Permalink
Make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramesh VK committed Oct 27, 2019
1 parent 8dfa2e8 commit 44f0f67
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/partition/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ func (e *errors) toError() error {
return (*e)[0]
}

// IncorrectPartitionError is a transient error that happens when
// requests end up on the wrong partition.
type IncorrectPartitionError struct{}

// Error returns the error string
func (e IncorrectPartitionError) Error() string {
return "incorrect partition, retry later"
}
3 changes: 3 additions & 0 deletions pkg/partition/hashring.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
"sync"
)

// NewHashRing returns a picker which uses a consistent hashing scheme
//
// The scheme is implemented using a hash ring of crc32 hashes.
func NewHashRing() func(ctx context.Context, list []string, hash uint64) string {
ring := &hashring{factor: 1000}
return ring.Pick
Expand Down
2 changes: 2 additions & 0 deletions pkg/partition/internal/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type RunCloser interface {
//io.Closer
}

// DialClient creates a RPC client
func DialClient(ctx context.Context, addr string) (client, error) {
conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure())
if err != nil {
Expand All @@ -35,6 +36,7 @@ func DialClient(ctx context.Context, addr string) (client, error) {
return client{conn}, nil
}

// RegisterServer registers an RPC handler
func RegisterServer(ctx context.Context, srv *grpc.Server, addr string, handler Runner) (io.Closer, error) {
var listener net.Listener
if srv == nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/partition/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ func WithEndpointRegistry(r EndpointRegistry) Option {
}
}

// Picker implements the algorithm to choose an endpoint given a hash
// key.
// WithPicker specifies how the pick endpoints based on the hash.
//
// The default algorithm is to use a consistent hash using a hash ring
// (via NewHashRing()).
Expand Down

0 comments on commit 44f0f67

Please sign in to comment.