discovery

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsulConfig

type ConsulConfig struct {
	Address   string
	Scheme    string
	Discovery struct {
		HealthCheck   bool
		CheckInterval string
		Timeout       string
	}
}

ConsulConfig holds consul configuration

type ServiceCache

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

ServiceCache service cache implementation

func NewServiceCache

func NewServiceCache(ttl time.Duration) *ServiceCache

NewServiceCache creates a new service cache

func (*ServiceCache) Clear

func (sc *ServiceCache) Clear()

Clear clears the cache

func (*ServiceCache) Get

func (sc *ServiceCache) Get(name string) (*api.AgentService, bool)

Get gets a service from cache

func (*ServiceCache) GetStats

func (sc *ServiceCache) GetStats() map[string]any

GetStats returns cache statistics

func (*ServiceCache) Update

func (sc *ServiceCache) Update(services map[string]*api.AgentService)

Update updates the cache

type ServiceDiscovery

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

ServiceDiscovery handles service registration and discovery

func NewServiceDiscovery

func NewServiceDiscovery(config *ConsulConfig) (*ServiceDiscovery, error)

NewServiceDiscovery creates a new service discovery instance

func (*ServiceDiscovery) CheckServiceHealth

func (sd *ServiceDiscovery) CheckServiceHealth(name string) string

CheckServiceHealth checks service health

func (*ServiceDiscovery) ClearCache

func (sd *ServiceDiscovery) ClearCache()

ClearCache clears the service cache

func (*ServiceDiscovery) DeregisterService

func (sd *ServiceDiscovery) DeregisterService(name string) error

DeregisterService deregisters a service from Consul

func (*ServiceDiscovery) GetCacheStats

func (sd *ServiceDiscovery) GetCacheStats() map[string]any

GetCacheStats returns cache and discovery metrics

func (*ServiceDiscovery) GetHealthyServices

func (sd *ServiceDiscovery) GetHealthyServices(name string) ([]*api.ServiceEntry, error)

GetHealthyServices gets healthy services

func (*ServiceDiscovery) GetService

func (sd *ServiceDiscovery) GetService(name string) (*api.AgentService, error)

GetService gets a service from Consul

func (*ServiceDiscovery) RegisterService

func (sd *ServiceDiscovery) RegisterService(name string, info *types.ServiceInfo) error

RegisterService registers a service

func (*ServiceDiscovery) SetCacheTTL

func (sd *ServiceDiscovery) SetCacheTTL(ttl time.Duration)

SetCacheTTL sets the service cache TTL

Jump to

Keyboard shortcuts

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