discovery

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package discovery is main package of service discovery module

Index

Constants

View Source
const (
	// YandexMDB constant SdConfig.type
	YandexMDB = "yandex-mdb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddServiceFunc

type AddServiceFunc func(services map[string]Service) error

AddServiceFunc services arg is map serviceId -> data source name

type Config

type Config any

Config abstract configuration SdConfig.config

type Discovery

type Discovery interface {
	//Init casting abstract Config to determined structure
	Init(c Config) error
	//Start is the discoverer starting point
	Start(ctx context.Context, errCh chan<- error) error
	//Subscribe - binding "add" and "remove" functions. Functions will be called when services appear or disappear
	Subscribe(subscriberID string, addService AddServiceFunc, removeService RemoveServiceFunc) error
	//Unsubscribe - remove subscriber from list
	Unsubscribe(subscriberID string) error
}

Discovery interface of abstract discovery services

type RemoveServiceFunc

type RemoveServiceFunc func(serviceIds []string) error

RemoveServiceFunc serviceIds is array of service IDs

type SdConfig

type SdConfig struct {
	Type   string `yaml:"type"`
	Config Config `yaml:"config"`
}

SdConfig top level of configuration tree

type Service

type Service struct {
	DSN          string
	ConstLabels  map[string]string
	TargetLabels map[string]string
}

Service abstract service definition

Directories

Path Synopsis
Package factory create service discovery from config
Package factory create service discovery from config
Package log using for logging SD event
Package log using for logging SD event

Jump to

Keyboard shortcuts

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