Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loggable ¶
type Loggable interface {
WithLogger(LoggerInterface)
}
Loggable determine possibility to inject LoggerInterface. Can be used to wire Source and Registry implementations
type LoggerInterface ¶
type LoggerInterface interface { logrus.FieldLogger }
LoggerInterface provides common log methods. This is replica for logrus.FieldLogger.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is built-in ManagerInterface implementation.
type ManagerExitOnError ¶
type ManagerExitOnError bool
ManagerExitOnError provide information how to handle errors and panics during manager.Run process.
type ManagerInterface ¶
ManagerInterface is main unit between Source and Registry. Implementation must provide full cycle for fetch services from Source and register them into Registry.
func NewManager ¶
func NewManager(source Source, registry Registry, logger LoggerInterface, exitOnError ManagerExitOnError) ManagerInterface
NewManager provider built-in ManagerInterface implementation
type Node ¶ added in v1.2.0
type Node struct { Node string `json:","` Address string `json:","` Datacenter *string `json:",omitempty"` NodeMeta *map[string]string `json:",omitempty"` }
Node contains info about host/node/server, hosting service. Used for catalog registration in consul.
type Registry ¶
type Registry interface { Fetch(ctx context.Context) (Services, error) Register(ctx context.Context, service *Service) error Deregister(ctx context.Context, service *Service) error }
Registry is endpoint/upstream for storing information about Services fetched from Source. Registry must implements 3 methods to make store clean: fetch current state, deregister orphans, register/update incoming
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler is simple wrapper for ManagerInterface. Scheduler provides possibility to call Manager.Run with constant interval passed to time.Ticker.
func NewScheduler ¶
func NewScheduler(ticker *time.Ticker, manager ManagerInterface, logger LoggerInterface) *Scheduler
NewScheduler provides Scheduler with predefined time.Ticker, ManagerInterface and LoggerInterface
type Service ¶
type Service struct { Name string `json:","` Address string `json:","` ID *string `json:",omitempty"` Port *int `json:",omitempty"` Tags *[]string `json:",omitempty"` Meta *map[string]string `json:",omitempty"` Node *Node `json:",omitempty"` }
Service contains all the necessary information for further registration in Registry
func (*Service) RegistrationID ¶
RegistrationID generate identification for registration in Registry.