Documentation
¶
Index ¶
- type OnRegisterFunc
- type Service
- func (s *Service) Deregister(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (*ServiceInfo, error)
- func (s *Service) Heartbeat(ctx context.Context, id string) error
- func (s *Service) List(ctx context.Context) ([]ServiceInfo, error)
- func (s *Service) ListByCapability(ctx context.Context, capability string) ([]ServiceInfo, error)
- func (s *Service) ListByType(ctx context.Context, svcType string) ([]ServiceInfo, error)
- func (s *Service) Register(ctx context.Context, input ServiceInput) (*ServiceInfo, error)
- func (s *Service) SetOnRegister(fn OnRegisterFunc)
- func (s *Service) UpdateStatus(ctx context.Context, id, status string) error
- type ServiceInfo
- type ServiceInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OnRegisterFunc ¶
OnRegisterFunc is called after a service registers. Used for retroactive indexer auto-assignment without circular imports.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages the service registry.
func NewService ¶
NewService creates a new registry service.
func (*Service) Deregister ¶
Deregister removes a service from the registry.
func (*Service) List ¶
func (s *Service) List(ctx context.Context) ([]ServiceInfo, error)
List returns all registered services.
func (*Service) ListByCapability ¶
ListByCapability returns services that declare a specific capability.
func (*Service) ListByType ¶
ListByType returns services filtered by type.
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, input ServiceInput) (*ServiceInfo, error)
Register adds or updates a service in the registry. If a service with the same name+type exists, it updates; otherwise creates.
func (*Service) SetOnRegister ¶
func (s *Service) SetOnRegister(fn OnRegisterFunc)
SetOnRegister sets a callback that fires after a new service registers.
type ServiceInfo ¶
ServiceInfo is the enriched view returned from queries.
type ServiceInput ¶
type ServiceInput struct {
Name string `json:"name"`
Type string `json:"type"`
APIURL string `json:"api_url"`
APIKey string `json:"api_key"`
HealthURL string `json:"health_url"`
Version string `json:"version"`
Capabilities []string `json:"capabilities"`
Metadata string `json:"metadata"`
}
ServiceInput is the data required to register or update a service.