Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRegistrarName ¶
Types ¶
type Registrar ¶
type Registrar interface { Name() string ServerConfigs() string // Register the registration. Register(ctx context.Context, service *ServiceInstance) error // Deregister the registration. Deregister(ctx context.Context, service *ServiceInstance) error // GetService return the service instances in memory according to the service name. GetService(ctx context.Context, serviceName string) ([]*ServiceInstance, error) // Watch creates a watcher according to the service name. Watch(ctx context.Context, serviceName string) (Watcher, error) // GetAllServicesInfo return all services in memory. GetAllServicesInfo(ctx context.Context) (ServiceList, error) // GetServiceRouterList return the service router path. GetServiceRouterList(ctx context.Context, serviceName string) ([]string, error) // GetImpl return the implementation of the registrar. GetImpl() any }
Registrar is service registrar.
type ServerItem ¶ added in v0.1.1
type ServiceInstance ¶
type ServiceInstance struct { ID string `json:"id"` Name string `json:"name"` Version string `json:"version"` Metadata map[string]string `json:"metadata"` //http://localhost:8000 Endpoints []ServerItem `json:"endpoints"` }
ServiceInstance is an instance of a service in a discovery system.
type ServiceList ¶ added in v0.5.7
type Watcher ¶
type Watcher interface { // Next returns services in the following two cases: // 1.the first time to watch and the service instance list is not empty. // 2.any service instance changes found. // if the above two conditions are not met, it will block until context deadline exceeded or canceled Next() ([]*ServiceInstance, error) // Stop close the watcher. Stop() error }
Watcher is service watcher.
Click to show internal directories.
Click to hide internal directories.