Add context options to the runtime
This commit is contained in:
		| @@ -276,7 +276,7 @@ func (e *etcdRegistry) registerNode(s *registry.Service, node *registry.Node, op | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (e *etcdRegistry) Deregister(s *registry.Service) error { | ||||
| func (e *etcdRegistry) Deregister(s *registry.Service, opts ...registry.DeregisterOption) error { | ||||
| 	if len(s.Nodes) == 0 { | ||||
| 		return errors.New("Require at least one node") | ||||
| 	} | ||||
| @@ -322,7 +322,7 @@ func (e *etcdRegistry) Register(s *registry.Service, opts ...registry.RegisterOp | ||||
| 	return gerr | ||||
| } | ||||
|  | ||||
| func (e *etcdRegistry) GetService(name string) ([]*registry.Service, error) { | ||||
| func (e *etcdRegistry) GetService(name string, opts ...registry.GetOption) ([]*registry.Service, error) { | ||||
| 	ctx, cancel := context.WithTimeout(context.Background(), e.options.Timeout) | ||||
| 	defer cancel() | ||||
|  | ||||
| @@ -362,7 +362,7 @@ func (e *etcdRegistry) GetService(name string) ([]*registry.Service, error) { | ||||
| 	return services, nil | ||||
| } | ||||
|  | ||||
| func (e *etcdRegistry) ListServices() ([]*registry.Service, error) { | ||||
| func (e *etcdRegistry) ListServices(opts ...registry.ListOption) ([]*registry.Service, error) { | ||||
| 	versions := make(map[string]*registry.Service) | ||||
|  | ||||
| 	ctx, cancel := context.WithTimeout(context.Background(), e.options.Timeout) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user