Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
}
Logger is an interface that can be implemented to provide custom log output.
type MCSet ¶
type MCSet struct {
Watcher
LastEvent time.Time
EventCount int
Logger Logger
// contains filtered or unexported fields
}
A MCSet is a wrapper around the serverset.Watch to handle the memcache use case. Basically provides some helper functions to pick the servers consistently.
func New ¶
New creates a new memcache server set. Can be used to just consistently hash keys to a known set of servers by having watch = nil and then calling SetEndpoints with the known set of memcache hosts.
func (*MCSet) Each ¶
Each runs the function over each server currently in the set. Kind of a weird signature but is necessary to satisfy the memcache.ServerSelector interface.
func (*MCSet) Endpoints ¶
Endpoints returns the current endpoints for this service. This can be those set via the serverset.Watch or manually via SetEndpoints()
func (*MCSet) Event ¶
func (s *MCSet) Event() <-chan struct{}
Event returns the event channel. This channel will get an object whenever something changes with the list of endpoints. Mostly just a passthrough of the underlying watch event.
func (*MCSet) PickServer ¶
PickServer consistently picks a server from the list. Kind of a weird signature but is necessary to satisfy the memcache.ServerSelector interface.
func (*MCSet) SetEndpoints ¶
SetEndpoints sets current list of endpoints. This will override the list returned by the serverset. An event by the serverset will override these values.

