|
|
@ -2,16 +2,20 @@ package registry |
|
|
|
|
|
|
|
|
|
|
|
import "context" |
|
|
|
import "context" |
|
|
|
|
|
|
|
|
|
|
|
// Registry is service registry.
|
|
|
|
// Registrar is service registrar.
|
|
|
|
type Registry interface { |
|
|
|
type Registrar interface { |
|
|
|
// Register the registration.
|
|
|
|
// Register the registration.
|
|
|
|
Register(ctx context.Context, service *ServiceInstance) error |
|
|
|
Register(ctx context.Context, service *ServiceInstance) error |
|
|
|
// Deregister the registration.
|
|
|
|
// Deregister the registration.
|
|
|
|
Deregister(ctx context.Context, service *ServiceInstance) error |
|
|
|
Deregister(ctx context.Context, service *ServiceInstance) error |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Discovery is service discovery.
|
|
|
|
|
|
|
|
type Discovery interface { |
|
|
|
// Service return the service instances in memory according to the service name.
|
|
|
|
// Service return the service instances in memory according to the service name.
|
|
|
|
Service(ctx context.Context, name string) ([]*ServiceInstance, error) |
|
|
|
Fetch(ctx context.Context, serviceName string) ([]*ServiceInstance, error) |
|
|
|
// Watch creates a watcher according to the service name.
|
|
|
|
// Watch creates a watcher according to the service name.
|
|
|
|
Watch(ctx context.Context, name string) (Watcher, error) |
|
|
|
Watch(ctx context.Context, serviceName string) (Watcher, error) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Watcher is service watcher.
|
|
|
|
// Watcher is service watcher.
|
|
|
|