registry

package
v0.0.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MetaID = "id"
	// MetaRegion meta region
	MetaRegion = "region"
	// MetaZone meta region
	MetaZone = "zone"
	// MetaHostname meta hostname
	MetaHostname = "hostname"
	// MetaWeight meta weight
	MetaWeight = "weight"
	// MetaOffline meta offline
	MetaOffline = "offline"
	// MetaAddrs meta public ip addrs
	MetaAddrs = "addrs"
	// MetaIPCount meta ip count
	MetaIPCount = "ip_count"
	// MetaConnCount meta conn count
	MetaConnCount = "conn_count"
	// MetaTcpEndpoint meta conn count
	MetaTcpEndpoint = "tcp"
	// MetaWsEndpoint meta conn count
	MetaWsEndpoint = "ws"
	// MetaWssEndpoint meta conn count
	MetaWssEndpoint = "wss"
	// MetaLastTS meta LastTs
	MetaLastTS = "LastTs"

	// PlatformWeb platform web
	PlatformWeb = "web"
)

Variables

View Source
var (
	ProviderType_name = map[int32]string{
		0: "Unkown",
		1: "Etcd",
		2: "Consul",
		3: "Kube",
		4: "Nacos",
	}
	ProviderType_value = map[string]int32{
		"Unkown": 0,
		"Etcd":   1,
		"Consul": 2,
		"Kube":   3,
		"Nacos":  4,
	}
)

Enum value maps for ProviderType.

View Source
var File_registry_conf_proto protoreflect.FileDescriptor

Functions

func Create added in v0.0.36

func Create(c *Conf) (Registrar, Discovery, error)

Create instantiates a discovery based on `discoveryDSN`.

func Register added in v0.0.36

func Register(name string, factory Factory)

Register registers one discovery.

Types

type Conf

type Conf struct {
	ProviderType      ProviderType         `protobuf:"varint,1,opt,name=providerType,proto3,enum=registry.ProviderType" json:"providerType,omitempty"`
	Endpoints         []string             `protobuf:"bytes,2,rep,name=endpoints,proto3" json:"endpoints,omitempty"`
	DialTimeout       *durationpb.Duration `protobuf:"bytes,3,opt,name=dialTimeout,proto3" json:"dialTimeout,omitempty"`
	EnableHealthCheck bool                 `protobuf:"varint,4,opt,name=enableHealthCheck,proto3" json:"enableHealthCheck,omitempty"`
	Namespace         string               `protobuf:"bytes,5,opt,name=namespace,proto3" json:"namespace,omitempty"`
	LogDir            string               `protobuf:"bytes,6,opt,name=logDir,proto3" json:"logDir,omitempty"`
	CacheDir          string               `protobuf:"bytes,7,opt,name=cacheDir,proto3" json:"cacheDir,omitempty"`
	// contains filtered or unexported fields
}

func (*Conf) Descriptor deprecated

func (*Conf) Descriptor() ([]byte, []int)

Deprecated: Use Conf.ProtoReflect.Descriptor instead.

func (*Conf) GetCacheDir added in v0.0.36

func (x *Conf) GetCacheDir() string

func (*Conf) GetDialTimeout added in v0.0.36

func (x *Conf) GetDialTimeout() *durationpb.Duration

func (*Conf) GetEnableHealthCheck added in v0.0.36

func (x *Conf) GetEnableHealthCheck() bool

func (*Conf) GetEndpoints added in v0.0.36

func (x *Conf) GetEndpoints() []string

func (*Conf) GetLogDir added in v0.0.36

func (x *Conf) GetLogDir() string

func (*Conf) GetNamespace added in v0.0.36

func (x *Conf) GetNamespace() string

func (*Conf) GetProviderType added in v0.0.36

func (x *Conf) GetProviderType() ProviderType

func (*Conf) ProtoMessage

func (*Conf) ProtoMessage()

func (*Conf) ProtoReflect

func (x *Conf) ProtoReflect() protoreflect.Message

func (*Conf) Reset

func (x *Conf) Reset()

func (*Conf) String

func (x *Conf) String() string

func (*Conf) Validate

func (m *Conf) Validate() error

Validate checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Conf) ValidateAll added in v0.0.8

func (m *Conf) ValidateAll() error

ValidateAll checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfMultiError, or nil if none found.

type ConfMultiError added in v0.0.8

type ConfMultiError []error

ConfMultiError is an error wrapping multiple validation errors returned by Conf.ValidateAll() if the designated constraints aren't met.

func (ConfMultiError) AllErrors added in v0.0.8

func (m ConfMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ConfMultiError) Error added in v0.0.8

func (m ConfMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ConfValidationError

type ConfValidationError struct {
	// contains filtered or unexported fields
}

ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.

func (ConfValidationError) Cause

func (e ConfValidationError) Cause() error

Cause function returns cause value.

func (ConfValidationError) Error

func (e ConfValidationError) Error() string

Error satisfies the builtin error interface

func (ConfValidationError) ErrorName

func (e ConfValidationError) ErrorName() string

ErrorName returns error name.

func (ConfValidationError) Field

func (e ConfValidationError) Field() string

Field function returns field value.

func (ConfValidationError) Key

func (e ConfValidationError) Key() bool

Key function returns key value.

func (ConfValidationError) Reason

func (e ConfValidationError) Reason() string

Reason function returns reason value.

type Discovery added in v0.0.36

type Discovery = kreg.Discovery

type Factory added in v0.0.36

type Factory func(c *Conf) (Registrar, Discovery, error)

type ProviderType added in v0.0.36

type ProviderType int32
const (
	ProviderType_Unkown ProviderType = 0
	ProviderType_Etcd   ProviderType = 1
	ProviderType_Consul ProviderType = 2
	ProviderType_Kube   ProviderType = 3
	ProviderType_Nacos  ProviderType = 4
)

func (ProviderType) Descriptor added in v0.0.36

func (ProviderType) Enum added in v0.0.36

func (x ProviderType) Enum() *ProviderType

func (ProviderType) EnumDescriptor deprecated added in v0.0.36

func (ProviderType) EnumDescriptor() ([]byte, []int)

Deprecated: Use ProviderType.Descriptor instead.

func (ProviderType) Number added in v0.0.36

func (ProviderType) String added in v0.0.36

func (x ProviderType) String() string

func (ProviderType) Type added in v0.0.36

type Registrar added in v0.0.36

type Registrar interface {
	kreg.Registrar
	// Update the registration.
	Update(ctx context.Context, service *kreg.ServiceInstance) error
}

Registrar is service registrar.

type Registry added in v0.0.36

type Registry interface {
	Register(name string, factory Factory)
	Create(c *Conf) (Registrar, Discovery, error)
}

Registry is the interface for callers to get registered middleware.

func NewRegistry added in v0.0.36

func NewRegistry() Registry

NewRegistry returns a new middleware registry.

type ServiceInstance added in v0.0.36

type ServiceInstance = kreg.ServiceInstance

type Watcher added in v0.0.39

type Watcher = kreg.Watcher

Directories

Path Synopsis
Package kuberegistry registry simply implements the Kubernetes-based Registry
Package kuberegistry registry simply implements the Kubernetes-based Registry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL