message

package
v0.0.0-...-c8d1825 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageId int64 // 消息的ID

基础消息类

Functions

This section is empty.

Types

type BaseMessage

type BaseMessage interface {
	Id() int64                        // 消息ID
	MessagePriority() common.Priority // 消息优先级
	TransType() TransType             // 发送类型,同步消息还是异步消息
	Birthday() time.Time              // 消息的生成时间
	String() string
}

message的接口

type BaseMessageInfo

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

func (*BaseMessageInfo) Birthday

func (m *BaseMessageInfo) Birthday() time.Time

消息的生成时间

func (*BaseMessageInfo) Id

func (m *BaseMessageInfo) Id() int64

消息的id

func (*BaseMessageInfo) MessagePriority

func (m *BaseMessageInfo) MessagePriority() common.Priority

消息的优先级

func (*BaseMessageInfo) String

func (m *BaseMessageInfo) String() string

基类消息转为string

func (*BaseMessageInfo) TransType

func (m *BaseMessageInfo) TransType() TransType

消息的传输类型

type BaseResponse

type BaseResponse interface {
	Message() BaseMessage // 消息
	String() string
}

response的接口

type BaseResponseInfo

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

消息的回应

func NewBaseResponse

func NewBaseResponse(msg BaseMessage) *BaseResponseInfo

生成回应

func (*BaseResponseInfo) Message

func (r *BaseResponseInfo) Message() BaseMessage

消息

func (*BaseResponseInfo) String

func (r *BaseResponseInfo) String() string

基类消息的回应转为string

type CPUStatisticMessage

type CPUStatisticMessage struct {
	BaseMessageInfo
	time.Time
	common.CapacityInfo
}

CPU使用情况

func NewCPUStatisticMessage

func NewCPUStatisticMessage(samplingTime time.Time, capacity common.CapacityInfo, pri common.Priority, tra TransType) (msg *CPUStatisticMessage)

生成消息

func (*CPUStatisticMessage) String

func (c *CPUStatisticMessage) String() (result string)

type ConfigureMessage

type ConfigureMessage struct {
	BaseMessageInfo
	// contains filtered or unexported fields
}

配置消息

func NewConfigureMessage

func NewConfigureMessage(host common.GgfServiceInfo, pri common.Priority, tra TransType) *ConfigureMessage

生成配置消息

func (*ConfigureMessage) GgfService

func (c *ConfigureMessage) GgfService() common.GgfServiceInfo

host service信息

func (*ConfigureMessage) String

func (c *ConfigureMessage) String() string

消息转为string

type DiskStatisticMessage

type DiskStatisticMessage struct {
	BaseMessageInfo
	time.Time
	Statistic []common.DiskStatisticInfo
}

磁盘的读写速率

func NewDiskStatisticMessage

func NewDiskStatisticMessage(samplingTime time.Time, stat []common.DiskStatisticInfo, pri common.Priority, tra TransType) (msg *DiskStatisticMessage)

生成消息

func (*DiskStatisticMessage) String

func (d *DiskStatisticMessage) String() (result string)

type DownloadServerLogMessage

type DownloadServerLogMessage struct {
	BaseMessageInfo
}

下载系统日志的消息

func NewDownloadServerLogMessage

func NewDownloadServerLogMessage(pri common.Priority, trs TransType) *DownloadServerLogMessage

生成消息

func (*DownloadServerLogMessage) String

func (d *DownloadServerLogMessage) String() string

type DownloadServerLogResponse

type DownloadServerLogResponse struct {
	BaseResponseInfo
	LogPath    string // 下载路径
	ZipLogPath string // 日志 压缩的下载路径
}

下载系统日志的回应

func NewDownloadServerLogResponse

func NewDownloadServerLogResponse(log, zipLog string, msg BaseMessage) (rsp *DownloadServerLogResponse)

func (*DownloadServerLogResponse) String

func (d *DownloadServerLogResponse) String() string

type DownloadServiceLogMessage

type DownloadServiceLogMessage struct {
	BaseMessageInfo
	Service string //   服务名称
}

获取服务组件信息的消息

func NewDownloadServiceLogMessage

func NewDownloadServiceLogMessage(name string, pri common.Priority, tra TransType) (msg *DownloadServiceLogMessage)

生成消息

func (*DownloadServiceLogMessage) String

func (s *DownloadServiceLogMessage) String() string

type DownloadServiceLogResponse

type DownloadServiceLogResponse struct {
	BaseResponseInfo
	Log string // 日志的下载路径
}

func NewDownloadServiceLogResponse

func NewDownloadServiceLogResponse(log string, msg BaseMessage) (response *DownloadServiceLogResponse)

生成回应

func (*DownloadServiceLogResponse) String

func (s *DownloadServiceLogResponse) String() (result string)

type EventMessage

type EventMessage struct {
	BaseMessageInfo
	Type    string // 事件类型
	Explain string // 事件的描述
}

记录事件的消息

func NewEventMessage

func NewEventMessage(eventType, explain string, pri common.Priority, tra TransType) (msg *EventMessage)

生成消息

func (*EventMessage) String

func (d *EventMessage) String() string

type GetCpuStatisticMessage

type GetCpuStatisticMessage struct {
	BaseMessageInfo
	BeginTime string // 开始时间
	EndTime   string // 结束时间
}

获取CPU使用率

func NewGetCpuStatisticMessage

func NewGetCpuStatisticMessage(begin, end string, pri common.Priority, trs TransType) *GetCpuStatisticMessage

生成消息

func (*GetCpuStatisticMessage) String

func (d *GetCpuStatisticMessage) String() string

type GetCpuStatisticResponse

type GetCpuStatisticResponse struct {
	BaseResponseInfo
	Time []time.Time
	Cpu  []common.CapacityInfo
}

获取CPU使用率的回应

func NewGetCpuStatisticResponse

func NewGetCpuStatisticResponse(statisticTime []time.Time, cpu []common.CapacityInfo, msg BaseMessage) (rsp *GetCpuStatisticResponse)

func (*GetCpuStatisticResponse) String

func (d *GetCpuStatisticResponse) String() (result string)

type GetDiskStatisticMessage

type GetDiskStatisticMessage struct {
	BaseMessageInfo
	BeginTime string // 开始时间
	EndTime   string // 结束时间
}

获取硬盘使用率

func NewGetDiskStatisticMessage

func NewGetDiskStatisticMessage(begin, end string, pri common.Priority, trs TransType) *GetDiskStatisticMessage

生成消息

func (*GetDiskStatisticMessage) String

func (d *GetDiskStatisticMessage) String() string

type GetDiskStatisticResponse

type GetDiskStatisticResponse struct {
	BaseResponseInfo
	Time      []time.Time
	Statistic [][]common.DiskStatisticInfo
}

获取硬盘使用率的回应

func NewGetDiskStatisticResponse

func NewGetDiskStatisticResponse(statisticTime []time.Time, stat [][]common.DiskStatisticInfo, msg BaseMessage) (rsp *GetDiskStatisticResponse)

func (*GetDiskStatisticResponse) String

func (d *GetDiskStatisticResponse) String() (result string)

type GetMemoryStatisticMessage

type GetMemoryStatisticMessage struct {
	BaseMessageInfo
	BeginTime string // 开始时间
	EndTime   string // 结束时间
}

获取内存使用率

func NewGetMemoryStatisticMessage

func NewGetMemoryStatisticMessage(begin, end string, pri common.Priority, trs TransType) *GetMemoryStatisticMessage

生成消息

func (*GetMemoryStatisticMessage) String

func (d *GetMemoryStatisticMessage) String() string

type GetMemoryStatisticResponse

type GetMemoryStatisticResponse struct {
	BaseResponseInfo
	Time      []time.Time
	Statistic []common.MemoryStatisticInfo
}

获取内存使用率的回应

func NewGetMemoryStatisticResponse

func NewGetMemoryStatisticResponse(statisticTime []time.Time, stat []common.MemoryStatisticInfo, msg BaseMessage) (rsp *GetMemoryStatisticResponse)

func (*GetMemoryStatisticResponse) String

func (d *GetMemoryStatisticResponse) String() (result string)

type GetNetworkStatisticMessage

type GetNetworkStatisticMessage struct {
	BaseMessageInfo
	BeginTime string // 开始时间
	EndTime   string // 结束时间
}

获取网络使用

func NewGetNetworkStatisticMessage

func NewGetNetworkStatisticMessage(begin, end string, pri common.Priority, trs TransType) *GetNetworkStatisticMessage

生成消息

func (*GetNetworkStatisticMessage) String

func (d *GetNetworkStatisticMessage) String() string

type GetNetworkStatisticResponse

type GetNetworkStatisticResponse struct {
	BaseResponseInfo
	Time      []time.Time
	Statistic [][]common.NetworkStatisticInfo
}

获取网络使用的回应

func NewGetNetworkStatisticResponse

func NewGetNetworkStatisticResponse(statisticTime []time.Time, stat [][]common.NetworkStatisticInfo, msg BaseMessage) (rsp *GetNetworkStatisticResponse)

func (*GetNetworkStatisticResponse) String

func (d *GetNetworkStatisticResponse) String() (result string)

type GetServiceLogMessage

type GetServiceLogMessage struct {
	BaseMessageInfo
	Service string // 服务名称
	Begin   int64  // 开始行数
	End     int64  // 结束行数
}

下载系统日志的消息

func NewGetServiceLogMessage

func NewGetServiceLogMessage(service string, begin, end int64, pri common.Priority, trs TransType) *GetServiceLogMessage

生成消息

func (*GetServiceLogMessage) String

func (d *GetServiceLogMessage) String() string

type GetServiceLogResponse

type GetServiceLogResponse struct {
	BaseResponseInfo
	Begin int64    // 开始行数
	End   int64    // 结束行数
	Log   []string // 日志内容
}

下载系统日志的回应

func NewGetServiceLogResponse

func NewGetServiceLogResponse(begin, end int64, log []string, msg BaseMessage) (rsp *GetServiceLogResponse)

func (*GetServiceLogResponse) String

func (d *GetServiceLogResponse) String() string

type GgfServiceMessage

type GgfServiceMessage struct {
	BaseMessageInfo
}

获取host服务的信息,包括开机时间,git信息

func NewGgfServiceMessage

func NewGgfServiceMessage(pri common.Priority, tra TransType) (msg *GgfServiceMessage)

生成消息

func (*GgfServiceMessage) String

func (h *GgfServiceMessage) String() string

type HostServiceResponse

type HostServiceResponse struct {
	BaseResponseInfo
	HostStartup   time.Time // 服务启动时间
	SystemStartup time.Time // 系统开机时间
	GitBranch     string    // git分支信息
	GitCommitID   string    // git commit id信息
}

获取服务器标识的回应

func NewGgfServiceResponse

func NewGgfServiceResponse(host, system time.Time, gitBranch, gitCommit string, msg BaseMessage) (rsp *HostServiceResponse)

func (*HostServiceResponse) String

func (h *HostServiceResponse) String() string

type MemoryStatisticMessage

type MemoryStatisticMessage struct {
	BaseMessageInfo
	time.Time
	common.MemoryStatisticInfo
}

内存使用情况

func NewMemoryInfoMessage

func NewMemoryInfoMessage(samplingTime time.Time, capacity common.MemoryStatisticInfo, pri common.Priority, tra TransType) (msg *MemoryStatisticMessage)

生成消息

func (*MemoryStatisticMessage) String

func (m *MemoryStatisticMessage) String() (result string)

type NetworkStatisticMessage

type NetworkStatisticMessage struct {
	BaseMessageInfo
	time.Time
	Statistic []common.NetworkStatisticInfo
}

网络使用情况

func NewNetworkStatisticMessage

func NewNetworkStatisticMessage(samplingTime time.Time, stat []common.NetworkStatisticInfo, pri common.Priority, tra TransType) (msg *NetworkStatisticMessage)

生成消息

func (*NetworkStatisticMessage) String

func (n *NetworkStatisticMessage) String() (result string)

type NtpConfigureMessage

type NtpConfigureMessage struct {
	BaseMessageInfo
}

获取ntp配置

func NewNtpConfigureMessage

func NewNtpConfigureMessage(pri common.Priority, tra TransType) (msg *NtpConfigureMessage)

生成消息

func (*NtpConfigureMessage) String

func (n *NtpConfigureMessage) String() string

type NtpConfigureResponse

type NtpConfigureResponse struct {
	BaseResponseInfo
	common.NTPInfo
}

获取ntp配置的响应

func NewNtpConfigureResponse

func NewNtpConfigureResponse(ntp common.NTPInfo, msg BaseMessage) (response *NtpConfigureResponse)

生成回应

func (*NtpConfigureResponse) String

func (n *NtpConfigureResponse) String() (result string)

type RemoveStorageMessage

type RemoveStorageMessage struct {
	BaseMessageInfo
	Times
}

删除存储的消息

func NewRemoveStorageMessage

func NewRemoveStorageMessage(times []string, pri common.Priority, trs TransType) *RemoveStorageMessage

生成消息

func (*RemoveStorageMessage) GetRemoveTime

func (r *RemoveStorageMessage) GetRemoveTime() Times

获取删除的时间

func (*RemoveStorageMessage) String

func (r *RemoveStorageMessage) String() string

type ServiceStatisticMessage

type ServiceStatisticMessage struct {
	BaseMessageInfo
	time.Time
	Statistic []common.ProcessInfo
}

统计进程的资源使用

func NewServiceStatisticMessage

func NewServiceStatisticMessage(samplintTime time.Time, stat []common.ProcessInfo, pri common.Priority, tra TransType) (msg *ServiceStatisticMessage)

生成消息

func (*ServiceStatisticMessage) String

func (d *ServiceStatisticMessage) String() (result string)

type StopHostServiceMessage

type StopHostServiceMessage struct {
	BaseMessageInfo
}

停止主机服务

func NewStopGgfServiceMessage

func NewStopGgfServiceMessage(pri common.Priority, tra TransType) (msg *StopHostServiceMessage)

生成消息

func (*StopHostServiceMessage) String

func (s *StopHostServiceMessage) String() string

type SystemTimeMessage

type SystemTimeMessage struct {
	BaseMessageInfo
}

获取系统时间

func NewSystemTimeMessage

func NewSystemTimeMessage(pri common.Priority, tra TransType) (msg *SystemTimeMessage)

生成消息

func (*SystemTimeMessage) String

func (s *SystemTimeMessage) String() string

type SystemTimeResponse

type SystemTimeResponse struct {
	BaseResponseInfo
	Time time.Time
}

获取系统时间的回应

func NewSystemTimeResponse

func NewSystemTimeResponse(current time.Time, msg BaseMessage) (response *SystemTimeResponse)

生成回应

func (*SystemTimeResponse) String

func (s *SystemTimeResponse) String() (result string)

type Times

type Times struct {
	Time []string `json:"time"`
}

type TransType

type TransType int32

消息发送类型(同步消息还是异步消息

const (
	Trans_Async TransType = iota // 异步发送
	Trans_Sync                   // 同步发送
)

func (TransType) String

func (trans TransType) String() string

type UpdateNtpConfigureMessage

type UpdateNtpConfigureMessage struct {
	BaseMessageInfo
	common.NTPInfo                       // NTP配置
	Operate        common.NtpControlType // 测试还是设置
}

更新ntp配置

func NewUpdateNtpConfigureMessage

func NewUpdateNtpConfigureMessage(ntp common.NTPInfo, operate common.NtpControlType, pri common.Priority, tra TransType) (msg *UpdateNtpConfigureMessage)

生成消息

func (*UpdateNtpConfigureMessage) String

func (n *UpdateNtpConfigureMessage) String() string

type UpdateSystemTimeMessage

type UpdateSystemTimeMessage struct {
	BaseMessageInfo
	Time string // 设置的系统时间
}

更新系统时间

func NewUpdateSystemTimeMessage

func NewUpdateSystemTimeMessage(systemTime string, pri common.Priority, tra TransType) (msg *UpdateSystemTimeMessage)

生成消息

func (*UpdateSystemTimeMessage) String

func (s *UpdateSystemTimeMessage) String() string

Jump to

Keyboard shortcuts

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