k8s

package
v0.0.0-...-b77c001 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ID_BASE = 100000

Variables

This section is empty.

Functions

func GetNamespace

func GetNamespace(t int) string

func GetServiceName

func GetServiceName(t int) string

func GetServiceType

func GetServiceType(ns, svc string) int

给 k8s_api_windows.go 使用,不需要考虑效率问题

func RegisterNodeType

func RegisterNodeType(t int, ns, svc string)

Types

type Endpoint

type Endpoint struct {
	NodeType int
	Index    int
	IP       string
	Ports    map[string]int
}

func GetEndpoints

func GetEndpoints(namespace, service string) ([]*Endpoint, error)

func NewEndpoint

func NewEndpoint() *Endpoint

func (*Endpoint) Id

func (this *Endpoint) Id() uint32

type INode

type INode interface {
	OnNodeJoin(endpoint *Endpoint)
	OnNodeLeave(endpoint *Endpoint)
	GetBase() interface{}
}

type Node

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

func (*Node) Close

func (this *Node) Close()

func (*Node) GetBase

func (this *Node) GetBase() interface{}

func (*Node) Id

func (this *Node) Id() uint32

func (*Node) Init

func (this *Node) Init(nodeType int, watchNodeTypes []int, d time.Duration, inst INode) error

func (*Node) OnNodeJoin

func (this *Node) OnNodeJoin(endpoint *Endpoint)

子类可以根据需要重载下面的方法

注意 OnNodeJoin 、 OnNodeLeave 在内部协程被调用,请注意多协程安全!!!

func (*Node) OnNodeLeave

func (this *Node) OnNodeLeave(endpoint *Endpoint)

func (*Node) Ports

func (this *Node) Ports(name string) int

type NodeType

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

type Watch

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

func NewWatch

func NewWatch(nt *NodeType, ctx context.Context, d time.Duration, derived INode) *Watch

func (*Watch) OnLoseEndpoint

func (this *Watch) OnLoseEndpoint(index int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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