Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yashash H L <[email protected]>
  • Loading branch information
yhl25 committed Dec 15, 2023
1 parent 2ba6a04 commit 12be0a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/reducer/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type ReducerCreator interface {
Create() Reducer
}

// simpleReducerCreator is a implementation of ReducerCreator, which creates a Reducer for the given function.
// simpleReducerCreator is an implementation of ReducerCreator, which creates a Reducer for the given function.
type simpleReducerCreator struct {
f func(context.Context, []string, <-chan Datum, Metadata) Messages
}
Expand All @@ -39,8 +39,8 @@ func (s *simpleReducerCreator) Create() Reducer {
return reducerFn(s.f)
}

// SimpleReducerCreator creates a simple ReducerCreator for the given reduce function.
func SimpleReducerCreator(f func(context.Context, []string, <-chan Datum, Metadata) Messages) ReducerCreator {
// SimpleCreatorWithReduceFn creates a simple ReducerCreator for the given reduce function.
func SimpleCreatorWithReduceFn(f func(context.Context, []string, <-chan Datum, Metadata) Messages) ReducerCreator {
return &simpleReducerCreator{f: f}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/reducer/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func TestReduceServer_Start(t *testing.T) {
// note: using actual uds connection
ctx, cancel := context.WithTimeout(context.Background(), 6*time.Second)
defer cancel()
err := NewServer(SimpleReducerCreator(rfn), WithSockAddr(socketFile.Name()), WithServerInfoFilePath(serverInfoFile.Name())).Start(ctx)
err := NewServer(SimpleCreatorWithReduceFn(rfn), WithSockAddr(socketFile.Name()), WithServerInfoFilePath(serverInfoFile.Name())).Start(ctx)
assert.NoError(t, err)
}
2 changes: 1 addition & 1 deletion pkg/reducer/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func TestService_ReduceFn(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
fs := &Service{
CreateReduceHandler: SimpleReducerCreator(tt.handler),
CreateReduceHandler: SimpleCreatorWithReduceFn(tt.handler),
}
// here's a trick for testing:
// because we are not using gRPC, we directly set a new incoming ctx
Expand Down

0 comments on commit 12be0a6

Please sign in to comment.