monitor

package
v0.0.0-...-f6b4a90 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HeartbeatInterval = 20
View Source
const StaleInterval = 3 * HeartbeatInterval

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

Types

type Agent

type Agent struct {
	Id     uint64 `json:"id"`
	Status string `json:"status"`
	// rpc connection address of agent
	Address string `json:"address"`
	// config is a place holder of config
	Config        string `json:"config"`
	HeartbeatTick int    `json:"alive"`
}

type AgentsSyncMap

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

func NewAgentsSyncMap

func NewAgentsSyncMap(logger *logger.Logger) *AgentsSyncMap

func (*AgentsSyncMap) AgentToJson

func (agentsMap *AgentsSyncMap) AgentToJson(id uint64) ([]byte, error)

func (*AgentsSyncMap) GetAll

func (agentsMap *AgentsSyncMap) GetAll() []Agent

func (*AgentsSyncMap) Tick

func (agentsMap *AgentsSyncMap) Tick()

func (*AgentsSyncMap) ToJson

func (agentsMap *AgentsSyncMap) ToJson() ([]byte, error)

func (*AgentsSyncMap) TryGet

func (agentsMap *AgentsSyncMap) TryGet(id uint64) (Agent, error)

func (*AgentsSyncMap) Update

func (agentsMap *AgentsSyncMap) Update(agents ...Agent)

type App

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

App instance at Run time most recent agents information is maintained in memory db updates only happens when 1) create a new agent instance 2) delete a agent instance 3) a heartbeat comes from a new agent

func NewApp

func NewApp(rpcPort string, webPort string) (*App, error)

NewApp

func (*App) Start

func (app *App) Start()

type AppConfig

type AppConfig struct {
	WebPort string `yaml: "webport"`
	RpcPort string `yaml: "rpcport"`
}

Jump to

Keyboard shortcuts

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