Skip to content

Import path: gitlab.soludian.com/soludian/fountain/libs/sd/fregistry

fregistry

go
import "gitlab.soludian.com/soludian/fountain/libs/sd/fregistry"

Index

Constants

go
const (
    ProtocolGRPC = "grpc"
    ProtocolHTTP = "http"
    ProtocolTPC  = "tcp"
    ProtocolUDP  = "udp"
)

func GetServiceKey

go
func GetServiceKey(prefix string, s runnable.ServerInstance) string

GetServiceKey ETCD registration needs to be used Deprecated: Use *server.ServiceInfo.GetServiceKey()

func GetServiceValue

go
func GetServiceValue(s runnable.ServerInstance) string

GetServiceValue ETCD registration needs to use Deprecated: Use *server.ServiceInfo.GetServiceValue()

type Configuration

Configuration...

go
type Configuration struct {
    Routes []Route           `json:"routes" conf:"routes"` // Configure client routing strategy
    Labels map[string]string `json:"labels" conf:"labels"` // Configure server labels: grouping
}

type ConsumerConfig

ConsumerConfig config of consumer The client calls the app's configuration

go
type ConsumerConfig struct {
    ID     string `json:"id" conf:"id"`
    Scheme string `json:"scheme" conf:"scheme"`
    Host   string `json:"host" conf:"host"`
}

type Endpoints

Endpoints...

go
type Endpoints struct {
    // Nodes service node list
    Servers map[string]runnable.ServerInstance `json:"servers"`

    // RouteConfigs routing configuration
    RouteConfigs map[string]RouteConfig `json:"route_configs"`

    // ConsumerConfigs consumer metadata
    ConsumerConfigs map[string]ConsumerConfig `json:"consumer_configs"`

    // ProviderConfigs service meta information
    ProviderConfigs map[string]ProviderConfig `json:"provider_configs"`
}

func (*Endpoints) DeepCopy

go
func (in *Endpoints) DeepCopy() *Endpoints

DeepCopy...

type Nop

Nop registry, used for local development/debugging

go
type Nop struct{}

func (Nop) Close

go
func (n Nop) Close() error

Close ...

func (Nop) ListServices

go
func (n Nop) ListServices(ctx context.Context, target Target) ([]runnable.ServerInstance, error)

ListServices ...

func (Nop) RegisterService

go
func (n Nop) RegisterService(context.Context, runnable.ServerInstance) error

RegisterService ...

func (Nop) SyncServices

go
func (n Nop) SyncServices(context.Context, SyncServicesOptions) error

SyncServices syncs all services

func (Nop) UnregisterService

go
func (n Nop) UnregisterService(context.Context, runnable.ServerInstance) error

UnregisterService ...

func (Nop) WatchServices

go
func (n Nop) WatchServices(ctx context.Context, target Target) (chan Endpoints, error)

WatchServices ...

type ProviderConfig

ProviderConfig config of provider Through this configuration, modify the properties of the provider

go
type ProviderConfig struct {
    ID         string            `json:"id" conf:"id"`
    Scheme     string            `json:"scheme" conf:"scheme"`
    Host       string            `json:"host" conf:"host"`
    Region     string            `json:"region" conf:"region"`
    Zone       string            `json:"zone" conf:"zone"`
    Deployment string            `json:"deployment" conf:"deployment"`
    Metadata   map[string]string `json:"metadata" conf:"metadata"`
    Enable     bool              `json:"enable" conf:"enable"`
}

type Registry

Registry register/unregister service registry impl should control rpc timeout

go
type Registry interface {
    RegisterService(context.Context, runnable.ServerInstance) error
    UnregisterService(context.Context, runnable.ServerInstance) error
    ListServices(context.Context, Target) ([]runnable.ServerInstance, error)
    WatchServices(context.Context, Target) (chan Endpoints, error)
    SyncServices(context.Context, SyncServicesOptions) error
    io.Closer
}

type Route

Route represents route configuration

go
type Route struct {
    // route method name
    Method string `json:"method" conf:"method"`
    // Route weight groups, distribute traffic among weight groups according to the ratio
    WeightGroups []WeightGroup `json:"weightGroups" conf:"weightGroups"`
    // Route the deployment group, import traffic to the deployment group
    Deployment string `json:"deployment" conf:"deployment"`
}

type RouteConfig

RouteConfig...

go
type RouteConfig struct {
    ID         string   `json:"id" conf:"id"`
    Scheme     string   `json:"scheme" conf:"scheme"`
    Host       string   `json:"host" conf:"host"`
    Deployment string   `json:"deployment" conf:"deployment"`
    URI        string   `json:"uri" conf:"uri"`
    Upstream   Upstream `json:"upstream" conf:"upstream"`
}

func (RouteConfig) String

go
func (config RouteConfig) String() string

String...

type ServiceDiscoveryClientConfig

ServiceDiscoveryClientConfig func

go
type ServiceDiscoveryClientConfig struct {
    DCName      string
    ServiceName string
    EtcdAddrs   []string
    Balancer    string
}

type SyncServicesOptions

SyncServicesOptions...

go
type SyncServicesOptions struct {
    GrpcResolverNowOptions resolver.ResolveNowOptions
}

type Target

Target...

go
type Target struct {
    Protocol  constants.ServerProtocol // "http"|"grpc"|"tcp"|"udp"
    Scheme    string                   // "etcd"|"k8s"|"dns"
    Endpoint  string                   // service name
    Authority string
}

type Upstream

Upstream represents upstream balancing config

go
type Upstream struct {
    Nodes  map[string]int `json:"nodes"`
    Groups map[string]int `json:"groups"`
}

type WeightGroup

WeightGroup...

go
type WeightGroup struct {
    Group  string `json:"group" conf:"group"`
    Weight int    `json:"weight" conf:"weight"`
}

Generated by gomarkdoc