Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DiscoveryCallback ¶
type DiscoveryCallback func(status HealthStatus)
type DiscoveryErrCallback ¶
type DiscoveryErrCallback func(err error)
type HealthStatus ¶
type HealthStatus struct { Identity Identity IsAvailble bool LastHeartbeat time.Time AvailableUntil time.Time }
HealthStatus is the service status.
type Operator ¶
type Operator interface { ServiceProviderOperator ServiceConsumerOperator }
Operator is the interface that should be implmented by the underlying implementation for both ServiceProvider and ServiceConsume.
type RegisterErrCallback ¶
type RegisterErrCallback func(err error)
type ServiceConsumer ¶
type ServiceConsumer interface { List(ctx context.Context) ([]HealthStatus, error) Run(ctx context.Context) error }
ServiceConsumer consumes services via the service discovery.
func NewServicConsumer ¶
func NewServicConsumer(option ServiceConsumerOption) (ServiceConsumer, error)
type ServiceConsumerOperator ¶
type ServiceConsumerOperator interface { ListHealthStatus(ctx context.Context, identity Identity) ([]HealthStatus, error) DeregisterHealthStatus(ctx context.Context, identity Identity) error }
ServiceConsumerOperator is the interface that should be implmented by the underlying implementation for ServiceConsume.
type ServiceConsumerOption ¶
type ServiceConsumerOption struct { Identity Identity DiscoveryDuration time.Duration DiscoveryCallback DiscoveryCallback DiscoveryErrCallback DiscoveryErrCallback ServiceConsumerOperator ServiceConsumerOperator }
ServiceConsumerOption defines the behavior of the service consumer.
type ServiceProvider ¶
ServiceProvider provides a service via the service discovery.
func NewServiceProvider ¶
func NewServiceProvider(option ServiceProviderOption) (ServiceProvider, error)
type ServiceProviderOperator ¶
type ServiceProviderOperator interface {
RegisterHealthStatus(ctx context.Context, status HealthStatus) error
}
ServiceProviderOperator is the interface that should be implmented by the underlying implementation for ServiceProvider.
type ServiceProviderOption ¶
type ServiceProviderOption struct { Identity Identity HeartbeatDuration time.Duration AvailableDuration time.Duration RegisterErrCallback RegisterErrCallback ServiceProviderOperator ServiceProviderOperator }
ServiceProviderOption defines the behavior of the service provider.