consul

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = types.Module{
	{CreateFunc: NewConsul},
	{CreateFunc: config.CreateConfig},
}

Functions

This section is empty.

Types

type Consul

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

func NewConsul

func NewConsul(cfg config.Config, logger *zap.Logger) (*Consul, error)

func (*Consul) KV

func (c *Consul) KV() connectors.DBConnector[*api.KV, *api.Txn]

func (*Consul) Leader

func (c *Consul) Leader() Leader

func (*Consul) Locker

func (c *Consul) Locker() Locker

func (*Consul) ServiceDiscovery

func (c *Consul) ServiceDiscovery() ServiceDiscovery

func (*Consul) Session

func (c *Consul) Session() Session

func (*Consul) Watcher

func (c *Consul) Watcher() Watcher

type Leader

type Leader interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	IsLeader() bool
}

type Locker

type Locker interface {
	Acquire(ctx context.Context, key, sessionID string) (bool, error)
	Release(ctx context.Context, key, sessionID string) (bool, error)
	KeyOwner(ctx context.Context, key string) (string, error)
}

type ServiceDiscovery

type ServiceDiscovery interface {
	ServiceInfo(ctx context.Context, serviceName string, tags []string) ([]*api.ServiceEntry, error)
	ServiceList(ctx context.Context) (map[string][]string, error)
	ServiceRegister(ctx context.Context, reg *api.AgentServiceRegistration) error
	ServiceDeregister(ctx context.Context, serviceID string) error
}

type Session

type Session interface {
	Create(ctx context.Context) (string, error)
	Destroy(ctx context.Context) error
	Renew(ctx context.Context) <-chan error
	SessionID() string
	SessionKey() string
}

type Watcher

type Watcher interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	WatchKeys(keys watcher.WatchKeys) error
	WatchPrefixKeys(keys watcher.WatchPrefixKey) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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