servicediscovery

package
v1.1.41 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Close() error
	Ping() error
	Register() error
	IsConnected() bool
	Reconnect() error
	Rebalance(memberNumber int, totalMembers int) error
}

func NewClient

func NewClient(port int, myIdentity *models.Identity, targetIdentity *models.Identity) (Client, error)

type Handler

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

func (*Handler) Ping

func (rh *Handler) Ping(_ Ping, reply *Pong) error

func (*Handler) Rebalance

func (rh *Handler) Rebalance(payload Rebalance, reply *bool) error

func (*Handler) Register

func (rh *Handler) Register(payload Register, reply *bool) error

type Ping

type Ping struct {
	From *models.Identity
}

type Pong

type Pong struct {
	From *models.Identity
}

type Rebalance

type Rebalance struct {
	From         *models.Identity
	MemberNumber int
	TotalMembers int
}

type Register

type Register struct {
	From     *models.Identity
	Identity *models.Identity
}

type Server

type Server interface {
	Listen()
	Shutdown()
}

func NewServer

func NewServer(port int, myIdentity *models.Identity, serviceDiscovery ServiceDiscovery) Server

type Service

type Service struct {
	Client          Client
	Name            string
	ClusterJoinTime int64
}

func NewService

func NewService(client Client, name string, clusterJoinTime int64) *Service

type ServiceBy added in v1.1.13

type ServiceBy func(s1, s2 *Service) bool

func (ServiceBy) Sort added in v1.1.13

func (by ServiceBy) Sort(services []Service)

type ServiceDiscovery

type ServiceDiscovery interface {
	Add(service *Service)
	Remove(name string)
	RemoveAll()
	AssignLeader(leaderService *Service)
	RemoveLeader()
	ReassignLeader() error
	StartHeartbeat()
	StopHeartbeat()
	StartMonitor()
	StopMonitor()
	GetAll() []string
	SetInfo(memberNumber int, totalMembers int)
	BeLeader()
	DontBeLeader()
}

func NewServiceDiscovery

func NewServiceDiscovery(config *config.Dcp, bus EventBus.Bus) ServiceDiscovery

Jump to

Keyboard shortcuts

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