Documentation
¶
Index ¶
- Variables
- func AddWorker(w Worker) error
- func ListWorkers() map[string][]string
- func NewService(confPath string) (*service, error)
- func RegisterHandler(s *service)
- func RemoveWorker(w Worker) error
- func RemoveWorkerAsTimeout()
- func SetLBPolicy(p util.LBPolicyEnum)
- type Comparable
- type DefaultServiceRegCommand
- type DefaultServiceRmCommand
- type ProcTimer
- type Service
- type ServiceCommand
- type Worker
- type Workers
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ERR_WORKER_EXISTS = errors.New("ERR_WORKER_EXISTS") ERR_WORKER_NOT_EXISTS = errors.New("ERR_WORKER_NOT_EXISTS") )
Functions ¶
func NewService ¶
func RemoveWorker ¶
func RemoveWorkerAsTimeout ¶
func RemoveWorkerAsTimeout()
RemoveWorkerAsTimeout remove those workers lost heartbeat
func SetLBPolicy ¶
func SetLBPolicy(p util.LBPolicyEnum)
Types ¶
type Comparable ¶
type Comparable interface {
IsEqual(a interface{}) bool
}
type DefaultServiceRegCommand ¶
func (*DefaultServiceRegCommand) Apply ¶
func (c *DefaultServiceRegCommand) Apply(server raft.Server) (interface{}, error)
func (*DefaultServiceRegCommand) CommandName ¶
func (c *DefaultServiceRegCommand) CommandName() string
type DefaultServiceRmCommand ¶
func (*DefaultServiceRmCommand) Apply ¶
func (c *DefaultServiceRmCommand) Apply(server raft.Server) (interface{}, error)
func (*DefaultServiceRmCommand) CommandName ¶
func (c *DefaultServiceRmCommand) CommandName() string
type ServiceCommand ¶
type Worker ¶
type Worker struct { HealthCheckURL string // api for healthcheck Heartbeat int64 // last heartbeat timestamp UriPath string // api request uripath Host string sync.Mutex // contains filtered or unexported fields }
func FastResponseWorker ¶
func RandomWorker ¶
func RoundRobinWorker ¶
func (*Worker) AsTaskFinished ¶
func (*Worker) AsyncHealthCheck ¶
func (worker *Worker) AsyncHealthCheck()
AsyncHealthCheck helthcheck for one node
func (*Worker) HostToCall ¶
get host to call, and do something extra
func (*Worker) ResponseTimeUsed ¶
Click to show internal directories.
Click to hide internal directories.