Documentation ¶
Overview ¶
Code generated by "-type serviceQueryMap<string, ServiceQuery> -type serviceQueryMap<string, ServiceQuery>"; DO NOT EDIT.
Code generated by "-type serviceRegistrationMap<string, ServiceRegistration> -type serviceRegistrationMap<string, ServiceRegistration>"; DO NOT EDIT.
Index ¶
- Variables
- type CompletedConfig
- type Config
- type Consul
- func (*Consul) Descriptor() ([]byte, []int)deprecated
- func (x *Consul) GetAddress() string
- func (x *Consul) GetDefaultAddress() string
- func (x *Consul) GetServiceRegistry() *Consul_ServiceRegistry
- func (x *Consul) GetServiceResolver() *Consul_ServiceResolver
- func (*Consul) ProtoMessage()
- func (x *Consul) ProtoReflect() protoreflect.Message
- func (x *Consul) Reset()
- func (x *Consul) String() string
- type Consul_ServiceRegistry
- func (*Consul_ServiceRegistry) Descriptor() ([]byte, []int)deprecated
- func (x *Consul_ServiceRegistry) GetDefaultServiceAddress() string
- func (x *Consul_ServiceRegistry) GetHealthCheckInterval() *durationpb.Duration
- func (x *Consul_ServiceRegistry) GetRegisterInterval() *durationpb.Duration
- func (x *Consul_ServiceRegistry) GetServices() []*Consul_ServiceRegistry_Service
- func (*Consul_ServiceRegistry) ProtoMessage()
- func (x *Consul_ServiceRegistry) ProtoReflect() protoreflect.Message
- func (x *Consul_ServiceRegistry) Reset()
- func (x *Consul_ServiceRegistry) String() string
- type Consul_ServiceRegistry_Service
- func (*Consul_ServiceRegistry_Service) Descriptor() ([]byte, []int)deprecated
- func (x *Consul_ServiceRegistry_Service) GetAddress() string
- func (x *Consul_ServiceRegistry_Service) GetHealthCheckUrl() string
- func (x *Consul_ServiceRegistry_Service) GetName() string
- func (*Consul_ServiceRegistry_Service) ProtoMessage()
- func (x *Consul_ServiceRegistry_Service) ProtoReflect() protoreflect.Message
- func (x *Consul_ServiceRegistry_Service) Reset()
- func (x *Consul_ServiceRegistry_Service) String() string
- type Consul_ServiceResolver
- func (*Consul_ServiceResolver) Descriptor() ([]byte, []int)deprecated
- func (x *Consul_ServiceResolver) GetResolveInterval() *durationpb.Duration
- func (x *Consul_ServiceResolver) GetServices() []*Consul_ServiceResolver_Service
- func (*Consul_ServiceResolver) ProtoMessage()
- func (x *Consul_ServiceResolver) ProtoReflect() protoreflect.Message
- func (x *Consul_ServiceResolver) Reset()
- func (x *Consul_ServiceResolver) String() string
- type Consul_ServiceResolver_ResolverType
- func (Consul_ServiceResolver_ResolverType) Descriptor() protoreflect.EnumDescriptor
- func (x Consul_ServiceResolver_ResolverType) Enum() *Consul_ServiceResolver_ResolverType
- func (Consul_ServiceResolver_ResolverType) EnumDescriptor() ([]byte, []int)deprecated
- func (x Consul_ServiceResolver_ResolverType) Number() protoreflect.EnumNumber
- func (x Consul_ServiceResolver_ResolverType) String() string
- func (Consul_ServiceResolver_ResolverType) Type() protoreflect.EnumType
- type Consul_ServiceResolver_Service
- func (*Consul_ServiceResolver_Service) Descriptor() ([]byte, []int)deprecated
- func (x *Consul_ServiceResolver_Service) GetName() string
- func (x *Consul_ServiceResolver_Service) GetResolverType() Consul_ServiceResolver_ResolverType
- func (*Consul_ServiceResolver_Service) ProtoMessage()
- func (x *Consul_ServiceResolver_Service) ProtoReflect() protoreflect.Message
- func (x *Consul_ServiceResolver_Service) Reset()
- func (x *Consul_ServiceResolver_Service) String() string
- type ResolverType
- type ServiceQuery
- type ServiceRegister
- func (srv *ServiceRegister) AddService(service ServiceRegistration) error
- func (srv *ServiceRegister) DeleteService(serviceId string) error
- func (srv *ServiceRegister) GetConsulAgent() (*api.Agent, error)
- func (srv *ServiceRegister) Register() error
- func (srv *ServiceRegister) RegisterService(service ServiceRegistration) error
- func (srv *ServiceRegister) Run(ctx context.Context) error
- func (srv *ServiceRegister) Serve(ctx context.Context) error
- func (srv *ServiceRegister) Shutdown()
- func (srv *ServiceRegister) UnRegister() error
- func (srv *ServiceRegister) UnregisterService(service ServiceRegistration) error
- type ServiceRegistration
- type ServiceResolver
- func (srv *ServiceResolver) AddService(service ServiceQuery) error
- func (srv *ServiceResolver) DeleteService(name string)
- func (srv *ServiceResolver) LookupService(name string) []*api.ServiceEntry
- func (srv *ServiceResolver) PickNode(name string, consistKey string) (addr string, has bool)
- func (srv *ServiceResolver) QueryServices() error
- func (srv *ServiceResolver) Run(ctx context.Context) error
- func (srv *ServiceResolver) Serve(ctx context.Context) error
- func (srv *ServiceResolver) Shutdown()
Constants ¶
This section is empty.
Variables ¶
var ( Consul_ServiceResolver_ResolverType_name = map[int32]string{ 0: "resolver_type_random", 1: "resolver_type_consist", } Consul_ServiceResolver_ResolverType_value = map[string]int32{ "resolver_type_random": 0, "resolver_type_consist": 1, } )
Enum value maps for Consul_ServiceResolver_ResolverType.
var File_consul_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type CompletedConfig ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
func (CompletedConfig) NewServiceRegister ¶ added in v0.0.19
func (c CompletedConfig) NewServiceRegister() (*ServiceRegister, error)
NewServiceRegister creates a new server which logically combines the handling chain with the passed server. name is used to differentiate for logging. The handler chain in particular can be difficult as it starts delgating.
func (CompletedConfig) NewServiceResolver ¶ added in v0.0.19
func (c CompletedConfig) NewServiceResolver() (*ServiceResolver, error)
NewServiceResolver creates a new server which logically combines the handling chain with the passed server. name is used to differentiate for logging. The handler chain in particular can be difficult as it starts delgating.
type Config ¶
type Config struct { GetViper func() *viper.Viper // If set, overrides params below Proto Consul Validator *validator.Validate }
func NewViperConfig ¶ added in v0.0.19
NewViperConfig returns a Config struct with the global viper instance key representing a sub tree of this instance. NewViperConfig is case-insensitive for a key.
func (*Config) Complete ¶
func (c *Config) Complete() CompletedConfig
Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to `ApplyOptions`, do that first. It's mutating the receiver.
type Consul ¶ added in v0.0.19
type Consul struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // host:port, addr of consul server, default ip and port is default_consul_address DefaultAddress string `protobuf:"bytes,2,opt,name=default_address,json=defaultAddress,proto3" json:"default_address,omitempty"` // host:port, addr of consul server, default is 127.0.0.1:8500 ServiceRegistry *Consul_ServiceRegistry `protobuf:"bytes,3,opt,name=service_registry,json=serviceRegistry,proto3" json:"service_registry,omitempty"` // for service registry ServiceResolver *Consul_ServiceResolver `protobuf:"bytes,4,opt,name=service_resolver,json=serviceResolver,proto3" json:"service_resolver,omitempty"` // for service resolver // contains filtered or unexported fields }
func (*Consul) Descriptor
deprecated
added in
v0.0.19
func (*Consul) GetAddress ¶ added in v0.0.26
func (*Consul) GetDefaultAddress ¶ added in v0.0.26
func (*Consul) GetServiceRegistry ¶ added in v0.0.19
func (x *Consul) GetServiceRegistry() *Consul_ServiceRegistry
func (*Consul) GetServiceResolver ¶ added in v0.0.19
func (x *Consul) GetServiceResolver() *Consul_ServiceResolver
func (*Consul) ProtoMessage ¶ added in v0.0.19
func (*Consul) ProtoMessage()
func (*Consul) ProtoReflect ¶ added in v0.0.19
func (x *Consul) ProtoReflect() protoreflect.Message
type Consul_ServiceRegistry ¶ added in v0.0.19
type Consul_ServiceRegistry struct { RegisterInterval *durationpb.Duration `protobuf:"bytes,1,opt,name=register_interval,json=registerInterval,proto3" json:"register_interval,omitempty"` // interval to register services to consul HealthCheckInterval *durationpb.Duration `protobuf:"bytes,2,opt,name=health_check_interval,json=healthCheckInterval,proto3" json:"health_check_interval,omitempty"` Services []*Consul_ServiceRegistry_Service `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` DefaultServiceAddress string `` // host:port, default addr of services to register if not empty /* 126-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Consul_ServiceRegistry) Descriptor
deprecated
added in
v0.0.19
func (*Consul_ServiceRegistry) Descriptor() ([]byte, []int)
Deprecated: Use Consul_ServiceRegistry.ProtoReflect.Descriptor instead.
func (*Consul_ServiceRegistry) GetDefaultServiceAddress ¶ added in v0.0.19
func (x *Consul_ServiceRegistry) GetDefaultServiceAddress() string
func (*Consul_ServiceRegistry) GetHealthCheckInterval ¶ added in v0.0.19
func (x *Consul_ServiceRegistry) GetHealthCheckInterval() *durationpb.Duration
func (*Consul_ServiceRegistry) GetRegisterInterval ¶ added in v0.0.19
func (x *Consul_ServiceRegistry) GetRegisterInterval() *durationpb.Duration
func (*Consul_ServiceRegistry) GetServices ¶ added in v0.0.19
func (x *Consul_ServiceRegistry) GetServices() []*Consul_ServiceRegistry_Service
func (*Consul_ServiceRegistry) ProtoMessage ¶ added in v0.0.19
func (*Consul_ServiceRegistry) ProtoMessage()
func (*Consul_ServiceRegistry) ProtoReflect ¶ added in v0.0.19
func (x *Consul_ServiceRegistry) ProtoReflect() protoreflect.Message
func (*Consul_ServiceRegistry) Reset ¶ added in v0.0.19
func (x *Consul_ServiceRegistry) Reset()
func (*Consul_ServiceRegistry) String ¶ added in v0.0.19
func (x *Consul_ServiceRegistry) String() string
type Consul_ServiceRegistry_Service ¶ added in v0.0.19
type Consul_ServiceRegistry_Service struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // service name Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // host:port HealthCheckUrl string `protobuf:"bytes,3,opt,name=health_check_url,json=healthCheckUrl,proto3" json:"health_check_url,omitempty"` // contains filtered or unexported fields }
func (*Consul_ServiceRegistry_Service) Descriptor
deprecated
added in
v0.0.19
func (*Consul_ServiceRegistry_Service) Descriptor() ([]byte, []int)
Deprecated: Use Consul_ServiceRegistry_Service.ProtoReflect.Descriptor instead.
func (*Consul_ServiceRegistry_Service) GetAddress ¶ added in v0.0.19
func (x *Consul_ServiceRegistry_Service) GetAddress() string
func (*Consul_ServiceRegistry_Service) GetHealthCheckUrl ¶ added in v0.0.19
func (x *Consul_ServiceRegistry_Service) GetHealthCheckUrl() string
func (*Consul_ServiceRegistry_Service) GetName ¶ added in v0.0.19
func (x *Consul_ServiceRegistry_Service) GetName() string
func (*Consul_ServiceRegistry_Service) ProtoMessage ¶ added in v0.0.19
func (*Consul_ServiceRegistry_Service) ProtoMessage()
func (*Consul_ServiceRegistry_Service) ProtoReflect ¶ added in v0.0.19
func (x *Consul_ServiceRegistry_Service) ProtoReflect() protoreflect.Message
func (*Consul_ServiceRegistry_Service) Reset ¶ added in v0.0.19
func (x *Consul_ServiceRegistry_Service) Reset()
func (*Consul_ServiceRegistry_Service) String ¶ added in v0.0.19
func (x *Consul_ServiceRegistry_Service) String() string
type Consul_ServiceResolver ¶ added in v0.0.19
type Consul_ServiceResolver struct { ResolveInterval *durationpb.Duration `protobuf:"bytes,1,opt,name=resolve_interval,json=resolveInterval,proto3" json:"resolve_interval,omitempty"` // interval to pull server nodes from consul Services []*Consul_ServiceResolver_Service `protobuf:"bytes,2,rep,name=services,proto3" json:"services,omitempty"` // contains filtered or unexported fields }
func (*Consul_ServiceResolver) Descriptor
deprecated
added in
v0.0.19
func (*Consul_ServiceResolver) Descriptor() ([]byte, []int)
Deprecated: Use Consul_ServiceResolver.ProtoReflect.Descriptor instead.
func (*Consul_ServiceResolver) GetResolveInterval ¶ added in v0.0.19
func (x *Consul_ServiceResolver) GetResolveInterval() *durationpb.Duration
func (*Consul_ServiceResolver) GetServices ¶ added in v0.0.19
func (x *Consul_ServiceResolver) GetServices() []*Consul_ServiceResolver_Service
func (*Consul_ServiceResolver) ProtoMessage ¶ added in v0.0.19
func (*Consul_ServiceResolver) ProtoMessage()
func (*Consul_ServiceResolver) ProtoReflect ¶ added in v0.0.19
func (x *Consul_ServiceResolver) ProtoReflect() protoreflect.Message
func (*Consul_ServiceResolver) Reset ¶ added in v0.0.19
func (x *Consul_ServiceResolver) Reset()
func (*Consul_ServiceResolver) String ¶ added in v0.0.19
func (x *Consul_ServiceResolver) String() string
type Consul_ServiceResolver_ResolverType ¶ added in v0.0.19
type Consul_ServiceResolver_ResolverType int32
const ( Consul_ServiceResolver_resolver_type_random Consul_ServiceResolver_ResolverType = 0 Consul_ServiceResolver_resolver_type_consist Consul_ServiceResolver_ResolverType = 1 )
func (Consul_ServiceResolver_ResolverType) Descriptor ¶ added in v0.0.19
func (Consul_ServiceResolver_ResolverType) Descriptor() protoreflect.EnumDescriptor
func (Consul_ServiceResolver_ResolverType) Enum ¶ added in v0.0.19
func (x Consul_ServiceResolver_ResolverType) Enum() *Consul_ServiceResolver_ResolverType
func (Consul_ServiceResolver_ResolverType) EnumDescriptor
deprecated
added in
v0.0.19
func (Consul_ServiceResolver_ResolverType) EnumDescriptor() ([]byte, []int)
Deprecated: Use Consul_ServiceResolver_ResolverType.Descriptor instead.
func (Consul_ServiceResolver_ResolverType) Number ¶ added in v0.0.19
func (x Consul_ServiceResolver_ResolverType) Number() protoreflect.EnumNumber
func (Consul_ServiceResolver_ResolverType) String ¶ added in v0.0.19
func (x Consul_ServiceResolver_ResolverType) String() string
func (Consul_ServiceResolver_ResolverType) Type ¶ added in v0.0.19
func (Consul_ServiceResolver_ResolverType) Type() protoreflect.EnumType
type Consul_ServiceResolver_Service ¶ added in v0.0.19
type Consul_ServiceResolver_Service struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // service name ResolverType Consul_ServiceResolver_ResolverType `` /* 164-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Consul_ServiceResolver_Service) Descriptor
deprecated
added in
v0.0.19
func (*Consul_ServiceResolver_Service) Descriptor() ([]byte, []int)
Deprecated: Use Consul_ServiceResolver_Service.ProtoReflect.Descriptor instead.
func (*Consul_ServiceResolver_Service) GetName ¶ added in v0.0.19
func (x *Consul_ServiceResolver_Service) GetName() string
func (*Consul_ServiceResolver_Service) GetResolverType ¶ added in v0.0.19
func (x *Consul_ServiceResolver_Service) GetResolverType() Consul_ServiceResolver_ResolverType
func (*Consul_ServiceResolver_Service) ProtoMessage ¶ added in v0.0.19
func (*Consul_ServiceResolver_Service) ProtoMessage()
func (*Consul_ServiceResolver_Service) ProtoReflect ¶ added in v0.0.19
func (x *Consul_ServiceResolver_Service) ProtoReflect() protoreflect.Message
func (*Consul_ServiceResolver_Service) Reset ¶ added in v0.0.19
func (x *Consul_ServiceResolver_Service) Reset()
func (*Consul_ServiceResolver_Service) String ¶ added in v0.0.19
func (x *Consul_ServiceResolver_Service) String() string
type ResolverType ¶ added in v0.0.14
type ResolverType int
const ( ResolverTypeReserve ResolverType = iota ResolverTypeRandom ResolverType = iota ResolverTypeConsist ResolverType = iota )
type ServiceQuery ¶ added in v0.0.19
type ServiceQuery struct { Name string `validate:"required"` // optional ResolverType ResolverType Tags []string PassingOnly bool QueryOptions *api.QueryOptions NodeLocatorOptions []hashring.NodeLocatorOption // contains filtered or unexported fields }
func (*ServiceQuery) Complete ¶ added in v0.0.19
func (r *ServiceQuery) Complete()
func (*ServiceQuery) SetDefault ¶ added in v0.0.19
func (r *ServiceQuery) SetDefault() *ServiceQuery
type ServiceRegister ¶ added in v0.0.19
type ServiceRegister struct { ConsulAddress string RegisterInterval time.Duration // contains filtered or unexported fields }
func NewServiceRegister ¶ added in v0.0.19
func NewServiceRegister(consulAddr string, services ...ServiceRegistration) (*ServiceRegister, error)
func (*ServiceRegister) AddService ¶ added in v0.0.19
func (srv *ServiceRegister) AddService(service ServiceRegistration) error
func (*ServiceRegister) DeleteService ¶ added in v0.0.19
func (srv *ServiceRegister) DeleteService(serviceId string) error
func (*ServiceRegister) GetConsulAgent ¶ added in v0.0.19
func (srv *ServiceRegister) GetConsulAgent() (*api.Agent, error)
func (*ServiceRegister) Register ¶ added in v0.0.19
func (srv *ServiceRegister) Register() error
func (*ServiceRegister) RegisterService ¶ added in v0.0.19
func (srv *ServiceRegister) RegisterService(service ServiceRegistration) error
func (*ServiceRegister) Run ¶ added in v0.0.19
func (srv *ServiceRegister) Run(ctx context.Context) error
Run will initialize the backend. It must not block, but may run go routines in the background.
func (*ServiceRegister) Serve ¶ added in v0.0.19
func (srv *ServiceRegister) Serve(ctx context.Context) error
func (*ServiceRegister) Shutdown ¶ added in v0.0.19
func (srv *ServiceRegister) Shutdown()
func (*ServiceRegister) UnRegister ¶ added in v0.0.19
func (srv *ServiceRegister) UnRegister() error
func (*ServiceRegister) UnregisterService ¶ added in v0.0.19
func (srv *ServiceRegister) UnregisterService(service ServiceRegistration) error
type ServiceRegistration ¶ added in v0.0.19
type ServiceRegistration struct { Name string Id string // default is <Name>-<Ip>-<Port> Tags []string Ip string Port int HealthCheckUrl string HealthCheckInterval time.Duration TTL time.Duration }
func (*ServiceRegistration) Complete ¶ added in v0.0.19
func (r *ServiceRegistration) Complete()
func (*ServiceRegistration) GetCheck ¶ added in v0.0.19
func (r *ServiceRegistration) GetCheck() (*api.AgentServiceCheck, error)
func (*ServiceRegistration) SetAddr ¶ added in v0.0.19
func (r *ServiceRegistration) SetAddr(addr string) error
func (*ServiceRegistration) SetDefault ¶ added in v0.0.19
func (r *ServiceRegistration) SetDefault() *ServiceRegistration
type ServiceResolver ¶ added in v0.0.14
type ServiceResolver struct { ConsulAddress string ResolverInterval time.Duration // contains filtered or unexported fields }
func NewServiceResolver ¶ added in v0.0.14
func NewServiceResolver(address string, services ...ServiceQuery) *ServiceResolver
func (*ServiceResolver) AddService ¶ added in v0.0.14
func (srv *ServiceResolver) AddService(service ServiceQuery) error
func (*ServiceResolver) DeleteService ¶ added in v0.0.14
func (srv *ServiceResolver) DeleteService(name string)
func (*ServiceResolver) LookupService ¶ added in v0.0.14
func (srv *ServiceResolver) LookupService(name string) []*api.ServiceEntry
func (*ServiceResolver) PickNode ¶ added in v0.0.14
func (srv *ServiceResolver) PickNode(name string, consistKey string) (addr string, has bool)
func (*ServiceResolver) QueryServices ¶ added in v0.0.14
func (srv *ServiceResolver) QueryServices() error
func (*ServiceResolver) Run ¶ added in v0.0.14
func (srv *ServiceResolver) Run(ctx context.Context) error
Run will initialize the backend. It must not block, but may run go routines in the background.
func (*ServiceResolver) Serve ¶ added in v0.0.14
func (srv *ServiceResolver) Serve(ctx context.Context) error
func (*ServiceResolver) Shutdown ¶ added in v0.0.14
func (srv *ServiceResolver) Shutdown()