serverselector

package
v2.0.0-beta1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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

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

type Latency struct {
	Latency time.Duration
}

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

type ReadPref struct {
	ReadPref          *readpref.ReadPref
	IsOutputAggregate bool
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL