Documentation
¶
Overview ¶
Package broadcast implements a MCollective like broadcast discovery system for nodes running choria
It is not thread safe and a single instance of the discoverer shouldn't be shared by go routines etc, you can reuse them but should not be using the same one multiple times.
It will create a single connection to your Choria network and close it once the context to Discover is canceled.
It has been shown to discover 50 000 nodes in around 1.2 seconds, I'd suggest on such a large network setting protocol.ClientStrictValidation to false
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcast ¶
type Broadcast struct {
// contains filtered or unexported fields
}
Broadcast implements mcollective like broadcast discovery
type ChoriaClient ¶
type ChoriaClient interface {
Request(ctx context.Context, msg inter.Message, handler client.Handler) (err error)
}
ChoriaClient implements the connection to the Choria network
type DiscoverOption ¶
type DiscoverOption func(o *dOpts)
DiscoverOption configures the broadcast discovery method
func Collective ¶
func Collective(c string) DiscoverOption
Collective sets the collective to discover in, else main collective is used
func Filter ¶
func Filter(f *protocol.Filter) DiscoverOption
Filter sets the filter to use for the discovery, else a blank one is used
func Name ¶
func Name(n string) DiscoverOption
Name sets a NATS connection name to use, without this random names will be made.
This setting is important if you make a daemon that makes many long client connections as each client connection makes Prometheus stats based on the name and you'll be leaking many stats over time
func SlidingWindow ¶ added in v0.24.0
func SlidingWindow() DiscoverOption
SlidingWindow enables a sliding window for discovery timeout that terminates discovery after 300ms of no responses
func Timeout ¶
func Timeout(t time.Duration) DiscoverOption
Timeout sets the discovery timeout, else the configured default is used