Documentation ¶
Overview ¶
Package toolbox contains various helper and utility functions that the library uses. The gut reaction is to call this "toolbox" but it's not an exhaustive collection of utilities but rather a collection small helper functions that keeps on proving useful.It's not too different from a toolbox in the corner of the workshop with all sorts of mangled tools modified to fit a particular purpose :)
Index ¶
- func RandomID() string
- func TimeCall(call func(), description string)
- type ConsoleProgress
- type StringSet
- type ZeroconfRegistry
- func (zr *ZeroconfRegistry) Register(kind string, id string, port int) error
- func (zr *ZeroconfRegistry) Resolve(kind string, waitTime time.Duration) ([]string, error)
- func (zr *ZeroconfRegistry) ResolveFirst(kind string, waitTime time.Duration) (string, error)
- func (zr *ZeroconfRegistry) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsoleProgress ¶
ConsoleProgress prints an 80-character progress bar on the console for values between [0, Max]
func (*ConsoleProgress) Print ¶
func (c *ConsoleProgress) Print(val int)
Print prints a 80-character wide progress bar on the console.
type StringSet ¶
StringSet is a collection of nodes.
func (*StringSet) Remove ¶
Remove removes a node from the collection. It returns true if a node is removed
type ZeroconfRegistry ¶
type ZeroconfRegistry struct { ClusterName string // contains filtered or unexported fields }
ZeroconfRegistry is the type for a zeroconf registry. It will announce one or more endpoints via mDNS/Zeroconf/Bonjour until Shutdown() is called.
func NewZeroconfRegistry ¶
func NewZeroconfRegistry(clusterName string) *ZeroconfRegistry
NewZeroconfRegistry creates a new zeroconf server
func (*ZeroconfRegistry) Register ¶
func (zr *ZeroconfRegistry) Register(kind string, id string, port int) error
Register registers a new endpoint. Only one endpoint can be created at a time The ID parameter is an unique ID.
func (*ZeroconfRegistry) ResolveFirst ¶
ResolveFirst looks for another service and returns only the first matching element
func (*ZeroconfRegistry) Shutdown ¶
func (zr *ZeroconfRegistry) Shutdown()
Shutdown shuts down the Zeroconf server.