Skip to content

Commit

Permalink
go/vt/topo: cfg -> opt
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Layher <[email protected]>
  • Loading branch information
mdlayher committed Dec 5, 2023
1 parent 2640368 commit b8184a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions go/vt/topo/keyspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ type FindAllShardsInKeyspaceOptions struct {
// FindAllShardsInKeyspace reads and returns all the existing shards in a
// keyspace. It doesn't take any lock.
//
// If cfg is non-nil, it is used to configure the method's behavior. Otherwise,
// a default configuration is used.
// If opt is non-nil, it is used to configure the method's behavior. Otherwise,
// the default options are used.
func (ts *Server) FindAllShardsInKeyspace(ctx context.Context, keyspace string, opt *FindAllShardsInKeyspaceOptions) (map[string]*ShardInfo, error) {
// Apply any necessary defaults.
if opt == nil {
Expand Down
10 changes: 5 additions & 5 deletions go/vt/topo/keyspace_external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ func TestServerFindAllShardsInKeyspace(t *testing.T) {
tests := []struct {
name string
shards int
cfg *topo.FindAllShardsInKeyspaceOptions
opt *topo.FindAllShardsInKeyspaceOptions
}{
{
name: "negative concurrency",
shards: 1,
// Ensure this doesn't panic.
cfg: &topo.FindAllShardsInKeyspaceOptions{Concurrency: -1},
opt: &topo.FindAllShardsInKeyspaceOptions{Concurrency: -1},
},
{
name: "unsharded",
shards: 1,
// Make sure the defaults apply as expected.
cfg: nil,
opt: nil,
},
{
name: "sharded",
shards: 32,
cfg: &topo.FindAllShardsInKeyspaceOptions{Concurrency: 8},
opt: &topo.FindAllShardsInKeyspaceOptions{Concurrency: 8},
},
}

Expand All @@ -75,7 +75,7 @@ func TestServerFindAllShardsInKeyspace(t *testing.T) {

// Verify that we return a complete list of shards and that each
// key range is present in the output.
out, err := ts.FindAllShardsInKeyspace(ctx, keyspace, tt.cfg)
out, err := ts.FindAllShardsInKeyspace(ctx, keyspace, tt.opt)
require.NoError(t, err)
require.Len(t, out, tt.shards)

Expand Down

0 comments on commit b8184a7

Please sign in to comment.