Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Composite ¶
type Composite struct {
Selectors []description.ServerSelector
}
Composite combines multiple selectors into a single selector by applying them in order to the candidates list.
For example, if the initial candidates list is [s0, s1, s2, s3] and two selectors are provided where the first matches s0 and s1 and the second matches s1 and s2, the following would occur during server selection:
1. firstSelector([s0, s1, s2, s3]) -> [s0, s1] 2. secondSelector([s0, s1]) -> [s1]
The final list of candidates returned by the composite selector would be [s1].
func (*Composite) SelectServer ¶
func (selector *Composite) SelectServer( topo description.Topology, candidates []description.Server, ) ([]description.Server, error)
SelectServer combines multiple selectors into a single selector.
type Func ¶
type Func func(description.Topology, []description.Server) ([]description.Server, error)
Func is a function that can be used as a ServerSelector.
func (Func) SelectServer ¶
func (ssf Func) SelectServer( t description.Topology, s []description.Server, ) ([]description.Server, error)
SelectServer implements the ServerSelector interface.
type Latency ¶
Latency creates a ServerSelector which selects servers based on their average RTT values.
func (*Latency) SelectServer ¶
func (selector *Latency) SelectServer( topo description.Topology, candidates []description.Server, ) ([]description.Server, error)
SelectServer selects servers based on average RTT.
type ReadPref ¶
ReadPref selects servers based on the provided read preference.
func (*ReadPref) SelectServer ¶
func (selector *ReadPref) SelectServer( topo description.Topology, candidates []description.Server, ) ([]description.Server, error)
SelectServer selects servers based on read preference.
type Write ¶
type Write struct{}
Write selects all the writable servers.
func (*Write) SelectServer ¶
func (selector *Write) SelectServer( topo description.Topology, candidates []description.Server, ) ([]description.Server, error)
SelectServer selects all writable servers.