Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidTagSet = errors.New("an even number of tags must be specified")
ErrInvalidTagSet indicates that an invalid set of tags was specified.
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode uint8
Mode indicates the user's preference on reads.
const ( // PrimaryMode indicates that only a primary is // considered for reading. This is the default // mode. PrimaryMode Mode = iota // PrimaryPreferredMode indicates that if a primary // is available, use it; otherwise, eligible // secondaries will be considered. PrimaryPreferredMode // SecondaryMode indicates that only secondaries // should be considered. SecondaryMode // SecondaryPreferredMode indicates that only secondaries // should be considered when one is available. If none // are available, then a primary will be considered. SecondaryPreferredMode // NearestMode indicates that all primaries and secondaries // will be considered. NearestMode )
Mode constants
func ModeFromString ¶
ModeFromString returns a mode corresponding to mode.
type Option ¶
Option configures a read preference
func WithMaxStaleness ¶
WithMaxStaleness sets the maximum staleness a server is allowed.
func WithTagSets ¶
WithTagSets sets the tag sets used to match a server. The last call to WithTags or WithTagSets overrides all previous calls to either method.
type ReadPref ¶
type ReadPref struct {
// contains filtered or unexported fields
}
ReadPref determines which servers are considered suitable for read operations.
func PrimaryPreferred ¶
PrimaryPreferred constructs a read preference with a PrimaryPreferredMode.
func SecondaryPreferred ¶
SecondaryPreferred constructs a read preference with a SecondaryPreferredMode.
func (*ReadPref) MaxStaleness ¶
MaxStaleness is the maximum amount of time to allow a server to be considered eligible for selection. The second return value indicates if this value has been set.