syntax = "proto3";
option go_package = ".;linux";
package linux;
import "google/protobuf/empty.proto";

service Client {
  rpc Ping(google.protobuf.Empty) returns (PingResp){}
  rpc Init(InitReq) returns (SuccessMsg){}
  rpc Memory(MemoryReq) returns(SuccessMsg){}
  rpc Network(NetReq) returns(SuccessMsg){}
  rpc CPUPercent(CPUReq) returns (SuccessMsg) {}
}

//default id
message Server {
  string id = 1;
  string secret = 2;
  int64 timestamp = 3;
}
// default success msg
message SuccessMsg {
  int32 success = 1;
  string msg = 2;
}
// Ping
message PingResp {
  int32 success = 1;
}
// Init
message InitReq {
  Server server = 1;
  repeated CPUInit CPU = 2; // repeated 重复的（数组）
}
message CPUInit {
  string name = 1;
  int32 count = 2;
  double mhz = 3;
  int32 cacheSize = 4;
}
// memory
message MemoryReq {
  Server server = 1;
  uint64 total = 2;
  uint64 free = 3;
  uint64 used = 4;
  uint64 cached = 5;
  double usedPercent = 6;
}
// network io
message NetReq {
  Server server = 1;
  uint64 bytesRecv = 2;
  uint64 bytesSent = 3;
  uint64 packetsRecv = 4;
  uint64 packetsSent = 5;
}
// cpu percent
message CPUReq {
  Server server = 1;
  double percent = 2;
}

