dispatch

package module
v0.0.0-...-f41560d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: AGPL-3.0 Imports: 12 Imported by: 1

README

dispatch

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNode

func AddNode(serviceName string, address string) error

func CheckRole

func CheckRole(name string, path, role string) bool

func DelService

func DelService(serviceName string) error

func RmNode

func RmNode(serviceName string, address string) error

func ServiceExit

func ServiceExit(name string) bool

func UpdateServiceType

func UpdateServiceType(serviceName string, serviceType ServiceType) error

Types

type Node

type Node struct {
	// 节点地址
	Address string `json:"address,omitempty" yaml:"address,omitempty"`

	// 是否存活
	Alive bool `json:"alive,omitempty" yaml:"alive,omitempty"`
}

func ChooseNode

func ChooseNode(name string) (node *Node, err error)

func (*Node) ID

func (p *Node) ID() string

type Service

type Service struct {
	ServiceType ServiceType `json:"service_type,omitempty" yaml:"service_type,omitempty"`

	ServiceName string `json:"service_name,omitempty" yaml:"service_name,omitempty"`

	Nodes []*Node `json:"nodes,omitempty" yaml:"nodes,omitempty"`

	PathRole map[string][]string `json:"path_role,omitempty" yaml:"path_role,omitempty"`
}

func GetAllService

func GetAllService() (services []*Service, err error)

func GetService

func GetService(name string) (*Service, error)

func GetServiceFromDisk

func GetServiceFromDisk(name string) (*Service, error)

type ServiceType

type ServiceType uint8
const (
	ServiceConuwaPeer ServiceType = iota
	ServiceEtcd
	ServiceRedis
	ServiceMySql
)

func (ServiceType) String

func (p ServiceType) String() string

Jump to

Keyboard shortcuts

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