@@ -137,6 +137,14 @@ type ClientOption struct {
137137 // NOTE: This function must be used with the SendToReplicas function.
138138 ReplicaSelector func (slot uint16 , replicas []NodeInfo ) int
139139
140+ // ReadNodeSelector returns index of node selected for a read only command.
141+ // If set, ReadNodeSelector is prioritized over ReplicaSelector.
142+ // If the returned index is out of range, the primary node will be selected.
143+ // The function is called only when SendToReplicas returns true.
144+ // Each NodeInfo must not be modified.
145+ // NOTE: This function can't be used with ReplicaSelector option.
146+ ReadNodeSelector func (slot uint16 , nodes []NodeInfo ) int
147+
140148 // Sentinel options, including MasterSet and Auth options
141149 Sentinel SentinelOption
142150
@@ -269,14 +277,6 @@ type ClientOption struct {
269277 // EnableReplicaAZInfo enables the client to load the replica node's availability zone.
270278 // If true, the client will set the `AZ` field in `ReplicaInfo`.
271279 EnableReplicaAZInfo bool
272-
273- // ReadNodeSelector returns index of node selected for a read only command.
274- // If set, ReadNodeSelector is prioritized over ReplicaSelector.
275- // If the returned index is out of range, the primary node will be selected.
276- // The function is called only when SendToReplicas returns true.
277- // Each NodeInfo must not be modified.
278- // NOTE: This function can't be used with ReplicaSelector option.
279- ReadNodeSelector func (slot uint16 , nodes []NodeInfo ) int
280280}
281281
282282// SentinelOption contains MasterSet,
@@ -313,9 +313,9 @@ type StandaloneOption struct {
313313
314314// NodeInfo is the information of a replica node in a redis cluster.
315315type NodeInfo struct {
316+ conn conn
316317 Addr string
317318 AZ string
318- conn conn
319319}
320320
321321// ReplicaInfo is the information of a replica node in a redis cluster.
0 commit comments