github.com/linapex/ethereum-go-chinese@v0.0.0-20190316121929-f8b7a73c3fa1/dashboard/message.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 19:16:37</date> 10 //</624450087409422336> 11 12 13 package dashboard 14 15 import ( 16 "encoding/json" 17 "time" 18 ) 19 20 type Message struct { 21 General *GeneralMessage `json:"general,omitempty"` 22 Home *HomeMessage `json:"home,omitempty"` 23 Chain *ChainMessage `json:"chain,omitempty"` 24 TxPool *TxPoolMessage `json:"txpool,omitempty"` 25 Network *NetworkMessage `json:"network,omitempty"` 26 System *SystemMessage `json:"system,omitempty"` 27 Logs *LogsMessage `json:"logs,omitempty"` 28 } 29 30 type ChartEntries []*ChartEntry 31 32 type ChartEntry struct { 33 Time time.Time `json:"time,omitempty"` 34 Value float64 `json:"value,omitempty"` 35 } 36 37 type GeneralMessage struct { 38 Version string `json:"version,omitempty"` 39 Commit string `json:"commit,omitempty"` 40 } 41 42 type HomeMessage struct { 43 /*托多(Kurkomisi)*/ 44 } 45 46 type ChainMessage struct { 47 /*托多(Kurkomisi)*/ 48 } 49 50 type TxPoolMessage struct { 51 /*托多(Kurkomisi)*/ 52 } 53 54 type NetworkMessage struct { 55 /*托多(Kurkomisi)*/ 56 } 57 58 type SystemMessage struct { 59 ActiveMemory ChartEntries `json:"activeMemory,omitempty"` 60 VirtualMemory ChartEntries `json:"virtualMemory,omitempty"` 61 NetworkIngress ChartEntries `json:"networkIngress,omitempty"` 62 NetworkEgress ChartEntries `json:"networkEgress,omitempty"` 63 ProcessCPU ChartEntries `json:"processCPU,omitempty"` 64 SystemCPU ChartEntries `json:"systemCPU,omitempty"` 65 DiskRead ChartEntries `json:"diskRead,omitempty"` 66 DiskWrite ChartEntries `json:"diskWrite,omitempty"` 67 } 68 69 //logsmessage包装了一个日志块。如果源不存在,则块是流块。 70 type LogsMessage struct { 71 Source *LogFile `json:"source,omitempty"` //日志文件的属性。 72 Chunk json.RawMessage `json:"chunk"` //包含日志记录。 73 } 74 75 //日志文件包含日志文件的属性。 76 type LogFile struct { 77 Name string `json:"name"` //文件名。 78 Last bool `json:"last"` //指示实际日志文件是否是目录中的最后一个。 79 } 80 81 //请求表示客户端请求。 82 type Request struct { 83 Logs *LogsRequest `json:"logs,omitempty"` 84 } 85 86 type LogsRequest struct { 87 Name string `json:"name"` //请求处理程序根据此文件名搜索日志文件。 88 Past bool `json:"past"` //指示客户端是要上一个文件还是下一个文件。 89 } 90