util

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = "2006/01/02 15:04:05.000 MST"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionType

type ActionType string
const (
	// this job is added now
	AddAction ActionType = "add"
	// this job is updated.
	UpdateAction ActionType = "update"
	// this job is deleted.
	DeleteAction ActionType = "delete"
	// this job's action(above) is already handled.
	HandledAction ActionType = "handled"
)

type Job

type Job struct {
	// which module this job belongs to.
	Module string `json:"module"`
	// job actions, include: add, update, delete, handled.
	Action ActionType `json:"action"`
	// zone that this job belongs to.
	Zone Zone `json:"zone"`
	// Protocol that this job will use.
	Protocol Protocol `json:"protocol"`
	// url of the checked point, ip:port
	Url string `json:"url"`
	// the result of this job.
	Status *JobStatus `json:"status,omitempty"`
}

job contains all the info which is needed during the check.

func (*Job) DeepCopy

func (j *Job) DeepCopy() *Job

func (*Job) Name

func (j *Job) Name() string

func (*Job) String

func (j *Job) String() string

type JobStatus

type JobStatus struct {
	// slave infos that do this job
	SlaveInfo *Slave `json:"slaveInfo,omitempty"`
	// where the job is success or not.
	Success bool `json:"success,omitempty"`
	// record the check result when failed.
	Message string `json:"message,omitempty"`
	// time of the job is done.
	FinishedAt int64 `json:"finishedAt,omitempty"`
}

type Protocol

type Protocol string
const (
	HTTP Protocol = "http"
	TCP  Protocol = "tcp"
)

type Server

type Server struct {
	BindAddr string `json:"bind"`
	Port     uint   `json:"port"`
	TLS      `json:"serverTLS,inline"`
}

type Slave

type Slave struct {
	// the name of the slave cluster, must be unique among all clusters.
	// can be the value of cluster-id or others.
	SlaveClusterName string `json:"slaveClusterName"`
	// containers a collection of zone. it determines the jobs which is get from master.
	Zones Zones `json:"zones"`
	// details about this slave.
	types.ServerInfo `json:",inline"`
}

health slave's meta info

type SvrResponse

type SvrResponse struct {
	Error error  `json:"error"`
	Jobs  []*Job `json:"jobs,omitempty"`
}

type TLS

type TLS struct {
	CaFile   string `json:"ca-file"`
	CertFile string `json:"cert-file"`
	KeyFile  string `json:"key-file"`
	PassWord string `json:"-"`
}

type Zone

type Zone string

a zone contains a collection of jobs that this node will do. a zone value could be a cluster-id or a self-defined string which is set by user.

const AllZones Zone = "all-bcs-health-zones"

func (Zone) IsAllZone

func (z Zone) IsAllZone() bool

type Zones

type Zones []Zone

func (Zones) IsAllZone

func (z Zones) IsAllZone() bool

Jump to

Keyboard shortcuts

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