Skip to content

Commit 1add120

Browse files
tbgwenyihu6
authored andcommitted
state: rename ParseStoreWeights -> ParseReplicaPlacement
This is a more consistent name.
1 parent 2628863 commit 1add120

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pkg/kv/kvserver/asim/state/parser_replica_placement.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ func (pr ReplicaPlacement) String() string {
8080
return strings.Join(result, "\n")
8181
}
8282

83-
// ParseStoreWeights parses replica placement rules in the format "{stores}:weight".
83+
// ParseReplicaPlacement parses replica placement rules in the format "{stores}:weight".
8484
// Weights determine the fraction of ranges using each placement pattern. Examples:
8585
// {s1:*,s2,s3:NON_VOTER}:1 {s4:*,s5,s6}:1 means half of ranges: s1(leaseholder),s2,s3(non-voter)
8686
// and half of ranges: s4(leaseholder),s5,s6.
87-
func ParseStoreWeights(input string) ReplicaPlacement {
87+
func ParseReplicaPlacement(input string) ReplicaPlacement {
8888
pattern := `\{([^}]+)\}:(\d+)`
8989
re := regexp.MustCompile(pattern)
9090

pkg/kv/kvserver/asim/state/parser_replica_placement_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestReplicaPlacement(t *testing.T) {
1818
datadriven.Walk(t, datapathutils.TestDataPath(t, t.Name()), func(t *testing.T, path string) {
1919
datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string {
2020
require.Equal(t, "parse", d.Cmd)
21-
rp := ParseStoreWeights(d.Input)
21+
rp := ParseReplicaPlacement(d.Input)
2222
rp.findReplicaPlacementForEveryStoreSet(1000)
2323
return rp.String()
2424
})

pkg/kv/kvserver/asim/tests/datadriven_simulation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func TestDataDriven(t *testing.T) {
228228
placementType := gen.GetRangePlacementType(placementTypeStr)
229229
var replicaPlacement state.ReplicaPlacement
230230
if placementType == gen.ReplicaPlacement {
231-
parsed := state.ParseStoreWeights(d.Input)
231+
parsed := state.ParseReplicaPlacement(d.Input)
232232
buf.WriteString(fmt.Sprintf("%v", parsed))
233233
replicaPlacement = parsed
234234
}

0 commit comments

Comments
 (0)