Skip to content

Commit 3f924ba

Browse files
authored
Add Info msgpack marshal/unmarshal (#316)
Re-using json tags and re-arranging some types to not have to generate for all files. Will allow cheaper rpc calls by avoiding JSON.
1 parent 007ae23 commit 3f924ba

22 files changed

+33752
-100
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
go-version: [1.22.x]
20+
go-version: [1.22.x,1.23.x]
2121
steps:
2222
- name: Set up Go ${{ matrix.go-version }}
2323
uses: actions/setup-go@v5

external.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// Copyright (c) 2015-2022 MinIO, Inc.
3+
//
4+
// This file is part of MinIO Object Storage stack
5+
//
6+
// This program is free software: you can redistribute it and/or modify
7+
// it under the terms of the GNU Affero General Public License as
8+
// published by the Free Software Foundation, either version 3 of the
9+
// License, or (at your option) any later version.
10+
//
11+
// This program is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU Affero General Public License for more details.
15+
//
16+
// You should have received a copy of the GNU Affero General Public License
17+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
//
19+
20+
package madmin
21+
22+
// Provide msgp for external types.
23+
// If updating packages breaks this, update structs below.
24+
25+
//msgp:clearomitted
26+
//msgp:tag json
27+
//go:generate msgp -unexported
28+
29+
type cpuTimesStat struct {
30+
CPU string `json:"cpu"`
31+
User float64 `json:"user"`
32+
System float64 `json:"system"`
33+
Idle float64 `json:"idle"`
34+
Nice float64 `json:"nice"`
35+
Iowait float64 `json:"iowait"`
36+
Irq float64 `json:"irq"`
37+
Softirq float64 `json:"softirq"`
38+
Steal float64 `json:"steal"`
39+
Guest float64 `json:"guest"`
40+
GuestNice float64 `json:"guestNice"`
41+
}
42+
43+
type loadAvgStat struct {
44+
Load1 float64 `json:"load1"`
45+
Load5 float64 `json:"load5"`
46+
Load15 float64 `json:"load15"`
47+
}
48+
49+
// NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev.
50+
type procfsNetDevLine struct {
51+
Name string `json:"name"` // The name of the interface.
52+
RxBytes uint64 `json:"rx_bytes"` // Cumulative count of bytes received.
53+
RxPackets uint64 `json:"rx_packets"` // Cumulative count of packets received.
54+
RxErrors uint64 `json:"rx_errors"` // Cumulative count of receive errors encountered.
55+
RxDropped uint64 `json:"rx_dropped"` // Cumulative count of packets dropped while receiving.
56+
RxFIFO uint64 `json:"rx_fifo"` // Cumulative count of FIFO buffer errors.
57+
RxFrame uint64 `json:"rx_frame"` // Cumulative count of packet framing errors.
58+
RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver.
59+
RxMulticast uint64 `json:"rx_multicast"` // Cumulative count of multicast frames received by the device driver.
60+
TxBytes uint64 `json:"tx_bytes"` // Cumulative count of bytes transmitted.
61+
TxPackets uint64 `json:"tx_packets"` // Cumulative count of packets transmitted.
62+
TxErrors uint64 `json:"tx_errors"` // Cumulative count of transmit errors encountered.
63+
TxDropped uint64 `json:"tx_dropped"` // Cumulative count of packets dropped while transmitting.
64+
TxFIFO uint64 `json:"tx_fifo"` // Cumulative count of FIFO buffer errors.
65+
TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface.
66+
TxCarrier uint64 `json:"tx_carrier"` // Cumulative count of carrier losses detected by the device driver.
67+
TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver.
68+
}

0 commit comments

Comments
 (0)