Documentation ¶
Index ¶
- type BootstrapMode
- type Config
- type Provider
- func (r *Provider) GetMembers(service string) ([]membership.HostInfo, error)
- func (r *Provider) HandleEvent(event events.Event)
- func (r *Provider) SelfEvict() error
- func (r *Provider) Start()
- func (r *Provider) Stop()
- func (r *Provider) Subscribe(name string, notifyChannel chan<- *membership.ChangedEvent) error
- func (r *Provider) WhoAmI() (membership.HostInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootstrapMode ¶
type BootstrapMode int
BootstrapMode is an enum type for ringpop bootstrap mode
const ( // BootstrapModeNone represents a bootstrap mode set to nothing or invalid BootstrapModeNone BootstrapMode = iota // BootstrapModeFile represents a file-based bootstrap mode BootstrapModeFile // BootstrapModeHosts represents a list of hosts passed in the configuration BootstrapModeHosts // BootstrapModeCustom represents a custom bootstrap mode BootstrapModeCustom // BootstrapModeDNS represents a list of hosts passed in the configuration // to be resolved, and the resulting addresses are used for bootstrap BootstrapModeDNS // BootstrapModeDNSSRV represents a list of DNS hosts passed in the configuration // to resolve secondary addresses that DNS SRV record would return resulting in // a host list that will contain multiple dynamic addresses and their unique ports BootstrapModeDNSSRV )
func (*BootstrapMode) UnmarshalYAML ¶
func (m *BootstrapMode) UnmarshalYAML( unmarshal func(interface{}) error, ) error
UnmarshalYAML is called by the yaml package to convert the config YAML into a BootstrapMode.
type Config ¶
type Config struct { // Name to be used in ringpop advertisement Name string `yaml:"name" validate:"nonzero"` // BroadcastAddress is communicated with peers to connect to this container/host. // This is useful when running cadence in K8s and the containers need to listen on 0.0.0.0 but advertise their pod IP to peers. // If not set, the listen address will be used as broadcast address. BroadcastAddress string `yaml:"broadcastAddress"` // BootstrapMode is a enum that defines the ringpop bootstrap method, currently supports: hosts, files, custom, dns, and dns-srv BootstrapMode BootstrapMode `yaml:"bootstrapMode"` // BootstrapHosts is a list of seed hosts to be used for ringpop bootstrap BootstrapHosts []string `yaml:"bootstrapHosts"` // BootstrapFile is the file path to be used for ringpop bootstrap BootstrapFile string `yaml:"bootstrapFile"` // MaxJoinDuration is the max wait time to join the ring MaxJoinDuration time.Duration `yaml:"maxJoinDuration"` // Custom discovery provider, cannot be specified through yaml DiscoveryProvider discovery.DiscoverProvider `yaml:"-"` }
Config contains the ringpop config items
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider use ringpop to announce membership changes
func NewRingpopProvider ¶
func NewRingpopProvider( service string, rp *ringpop.Ringpop, portMap membership.PortMap, bootstrapOpts *swim.BootstrapOptions, logger log.Logger, ) *Provider
NewRingpopProvider sets up ringpop based peer provider
func (*Provider) GetMembers ¶
func (r *Provider) GetMembers(service string) ([]membership.HostInfo, error)
GetMembers returns all hosts with a specified role value
func (*Provider) HandleEvent ¶
HandleEvent handles updates from ringpop
func (*Provider) Subscribe ¶
func (r *Provider) Subscribe(name string, notifyChannel chan<- *membership.ChangedEvent) error
Subscribe allows to be subscribed for ring changes
Click to show internal directories.
Click to hide internal directories.