Skip to content

Commit b80df47

Browse files
committed
asim: add node id for simulator replica
Previously, the simulator replica interface did not include a NodeID() method. Future changes to replica_rankings.go will require this as part of the candidate replica interface. This commit updates the simulator replica to implement NodeID() method. Epic: none Release note: none
1 parent 7661812 commit b80df47

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ func (s *state) addReplica(
628628

629629
desc := rng.desc.AddReplica(roachpb.NodeID(nodeID), roachpb.StoreID(storeID), rtype)
630630
replica := &replica{
631+
nodeID: nodeID,
631632
replicaID: ReplicaID(desc.ReplicaID),
632633
storeID: storeID,
633634
rangeID: rangeID,
@@ -1607,6 +1608,7 @@ func (r *rng) Size() int64 {
16071608
// replica is an implementation of the Replica interface.
16081609
type replica struct {
16091610
replicaID ReplicaID
1611+
nodeID NodeID
16101612
storeID StoreID
16111613
rangeID RangeID
16121614
desc roachpb.ReplicaDescriptor
@@ -1618,6 +1620,11 @@ func (r *replica) ReplicaID() ReplicaID {
16181620
return r.replicaID
16191621
}
16201622

1623+
// NodeID returns the ID of the node this replica is on.
1624+
func (r *replica) NodeID() NodeID {
1625+
return r.nodeID
1626+
}
1627+
16211628
// StoreID returns the ID of the store this replica is on.
16221629
func (r *replica) StoreID() StoreID {
16231630
return r.storeID

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ type Range interface {
270270
type Replica interface {
271271
// ReplicaID returns the ID of this replica.
272272
ReplicaID() ReplicaID
273+
// NodeID returns the ID of the node this replica is on.
274+
NodeID() NodeID
273275
// StoreID returns the ID of the store this replica is on.
274276
StoreID() StoreID
275277
// Descriptor returns the descriptor for this replica.

0 commit comments

Comments
 (0)