rainbond: github.com/goodrain/rainbond/discover.v2 Index | Files | Directories

package discover

import "github.com/goodrain/rainbond/discover.v2"

Index

Package Files

discover.go k8s_discover.go register.go

type Callback Uses

type Callback interface {
    UpdateEndpoints(endpoints ...*config.Endpoint)
    //when watch occurred error,will exec this method
    Error(error)
}

Callback 每次返回全部节点

type CallbackUpdate Uses

type CallbackUpdate interface {
    //TODO:
    //weight自动发现更改实现暂时不 Ready
    UpdateEndpoints(operation config.Operation, endpoints ...*config.Endpoint)
    //when watch occurred error,will exec this method
    Error(error)
}

CallbackUpdate 每次返还变化

type Discover Uses

type Discover interface {
    // Add project to cache if not exists, then watch the endpoints.
    AddProject(name string, callback Callback)
    // Update a project.
    AddUpdateProject(name string, callback CallbackUpdate)
    Stop()
}

Discover 后端服务自动发现

func GetDiscover Uses

func GetDiscover(opt config.DiscoverConfig) (Discover, error)

GetDiscover 获取服务发现管理器

func NewK8sDiscover Uses

func NewK8sDiscover(ctx context.Context, clientset kubernetes.Interface, cfg *option.Conf) Discover

NewK8sDiscover creates a new Discover

type KeepAlive Uses

type KeepAlive struct {
    EtcdClientArgs *etcdutil.ClientArgs
    ServerName     string
    HostName       string
    Endpoint       string
    TTL            int64
    LID            clientv3.LeaseID
    Done           chan struct{}
    // contains filtered or unexported fields
}

KeepAlive 服务注册

func CreateKeepAlive Uses

func CreateKeepAlive(etcdClientArgs *etcdutil.ClientArgs, ServerName string, Protocol string, HostIP string, Port int) (*KeepAlive, error)

CreateKeepAlive create keepalive for server

func (*KeepAlive) Start Uses

func (k *KeepAlive) Start() error

Start 开始

func (*KeepAlive) Stop Uses

func (k *KeepAlive) Stop()

Stop 结束

Directories

PathSynopsis
config

Package discover imports 21 packages (graph) and is imported by 6 packages. Updated 2020-04-05. Refresh now. Tools for package owners.