nats

package
v1.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NatsServer      string = "nats-server"       // NatsServer specifies the Nats server Address
	NatsSubject     string = "nats-subject"      // NatsSubject specifies the NATs subject
	ActorSystemName        = "actor_system_name" // ActorSystemName specifies the actor system name
	ApplicationName        = "app_name"          // ApplicationName specifies the application name. This often matches the actor system name
	Timeout                = "timeout"           // Timeout specifies the discovery timeout. The default value is 1 second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery struct {
	// contains filtered or unexported fields
}

Discovery represents the kubernetes discovery

func NewDiscovery

func NewDiscovery(opts ...Option) *Discovery

NewDiscovery returns an instance of the kubernetes discovery provider

func (*Discovery) Close

func (d *Discovery) Close() error

Close closes the provider

func (*Discovery) Deregister

func (d *Discovery) Deregister() error

Deregister removes this node from a service discovery directory.

func (*Discovery) DiscoverPeers

func (d *Discovery) DiscoverPeers() ([]string, error)

DiscoverPeers returns a list of known nodes.

func (*Discovery) ID

func (d *Discovery) ID() string

ID returns the discovery provider id

func (*Discovery) Initialize

func (d *Discovery) Initialize() error

Initialize initializes the plugin: registers some internal data structures, clients etc.

func (*Discovery) Register

func (d *Discovery) Register() error

Register registers this node to a service discovery directory.

func (*Discovery) SetConfig

func (d *Discovery) SetConfig(config discovery.Config) error

SetConfig registers the underlying discovery configuration

type Option

type Option interface {
	// Apply sets the Option value of a config.
	Apply(disco *Discovery)
}

Option is the interface that applies a configuration option.

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger sets the logger

type OptionFunc

type OptionFunc func(disco *Discovery)

OptionFunc implements the Option interface.

func (OptionFunc) Apply

func (f OptionFunc) Apply(disco *Discovery)

Apply applies the Cluster's option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL