Skip to content

Commit

Permalink
codereview comments
Browse files Browse the repository at this point in the history
  • Loading branch information
korotkov-aerospike committed Aug 11, 2024
1 parent fda1fd9 commit 3944c15
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
12 changes: 6 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,25 @@ type Client struct {
id string
}

// Option is a functional option that allows configuring the [Client].
type Option func(*Client)
// ClientOpt is a functional option that allows configuring the [Client].
type ClientOpt func(*Client)

// WithID sets the ID for the Client.
func WithID(id string) Option {
func WithID(id string) ClientOpt {
return func(c *Client) {
c.id = id
}
}

// WithLogger sets the logger for the [Client].
func WithLogger(logger *slog.Logger) Option {
func WithLogger(logger *slog.Logger) ClientOpt {
return func(c *Client) {
c.logger = logger
}
}

// WithScanLimiter sets the scan limiter for the [Client].
func WithScanLimiter(sem *semaphore.Weighted) Option {
func WithScanLimiter(sem *semaphore.Weighted) ClientOpt {
return func(c *Client) {
c.scanLimiter = sem
}
Expand All @@ -128,7 +128,7 @@ func WithScanLimiter(sem *semaphore.Weighted) Option {
// - [WithScanLimiter] to set a semaphore that is used to limit number of
// concurrent scans.
// - scan limiter semaphore that is used to limit number of concurrent scans.
func NewClient(ac AerospikeClient, opts ...Option) (*Client, error) {
func NewClient(ac AerospikeClient, opts ...ClientOpt) (*Client, error) {
if ac == nil {
return nil, errors.New("aerospike client pointer is nil")
}
Expand Down
3 changes: 2 additions & 1 deletion examples/aws/s3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package main
import (
"context"
"fmt"
"log"

"github.com/aerospike/aerospike-client-go/v7"
"github.com/aerospike/backup-go"
"github.com/aerospike/backup-go/io/aws/s3"
"log"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion examples/readme/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package main

import (
"context"
"log"

"github.com/aerospike/aerospike-client-go/v7"
"github.com/aerospike/backup-go"
"log"
)

func main() {
Expand Down
10 changes: 5 additions & 5 deletions io/aerospike/record_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (suite *readersTestSuite) TestAerospikeRecordReader() {
)

reader := NewRecordReader(
context.TODO(),
context.Background(),
mockScanner,
&RecordReaderConfig{
namespace: namespace,
Expand Down Expand Up @@ -126,7 +126,7 @@ func (suite *readersTestSuite) TestAerospikeRecordReaderRecordResError() {
)

reader := NewRecordReader(
context.TODO(),
context.Background(),
mockScanner,
&RecordReaderConfig{
namespace: namespace,
Expand Down Expand Up @@ -166,7 +166,7 @@ func (suite *readersTestSuite) TestAerospikeRecordReaderClosedChannel() {
)

reader := NewRecordReader(
context.TODO(),
context.Background(),
mockScanner,
&RecordReaderConfig{
namespace: namespace,
Expand Down Expand Up @@ -200,7 +200,7 @@ func (suite *readersTestSuite) TestAerospikeRecordReaderReadFailed() {
)

reader := NewRecordReader(
context.TODO(),
context.Background(),
mockScanner,
&RecordReaderConfig{
namespace: namespace,
Expand Down Expand Up @@ -259,7 +259,7 @@ func (suite *readersTestSuite) TestAerospikeRecordReaderWithPolicy() {
)

reader := NewRecordReader(
context.TODO(),
context.Background(),
mockScanner,
&RecordReaderConfig{
namespace: namespace,
Expand Down

0 comments on commit 3944c15

Please sign in to comment.