Skip to content

Commit 18bbcb5

Browse files
andy-shi88sukrawidhyawan
authored andcommitted
zoobc/zoobc-core#159 add auth and getNodeHardware service (#44)
* zoobc/zoobc-core#159 add auth and getNodeHardware service
1 parent fb79dc9 commit 18bbcb5

File tree

4 files changed

+273
-0
lines changed

4 files changed

+273
-0
lines changed

documentation.swagger.json

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,46 @@
632632
}
633633
}
634634
},
635+
"modelCPUInformation": {
636+
"type": "object",
637+
"properties": {
638+
"CPUIndex": {
639+
"type": "integer",
640+
"format": "int32"
641+
},
642+
"CacheSize": {
643+
"type": "integer",
644+
"format": "int32"
645+
},
646+
"CoreID": {
647+
"type": "string"
648+
},
649+
"Cores": {
650+
"type": "integer",
651+
"format": "int32"
652+
},
653+
"Family": {
654+
"type": "string"
655+
},
656+
"Mhz": {
657+
"type": "number",
658+
"format": "double"
659+
},
660+
"Model": {
661+
"type": "string"
662+
},
663+
"ModelName": {
664+
"type": "string"
665+
},
666+
"UsedPercent": {
667+
"type": "number",
668+
"format": "double"
669+
},
670+
"VendorId": {
671+
"type": "string"
672+
}
673+
}
674+
},
635675
"modelChainStatus": {
636676
"type": "object",
637677
"properties": {
@@ -770,6 +810,14 @@
770810
}
771811
}
772812
},
813+
"modelGetNodeHardwareResponse": {
814+
"type": "object",
815+
"properties": {
816+
"NodeHardware": {
817+
"$ref": "#/definitions/modelNodeHardware"
818+
}
819+
}
820+
},
773821
"modelGetNodeRegistrationsResponse": {
774822
"type": "object",
775823
"properties": {
@@ -877,6 +925,64 @@
877925
}
878926
}
879927
},
928+
"modelHostInformation": {
929+
"type": "object",
930+
"properties": {
931+
"HostID": {
932+
"type": "string"
933+
},
934+
"HostName": {
935+
"type": "string"
936+
},
937+
"NumberOfRunningProcess": {
938+
"type": "string",
939+
"format": "uint64"
940+
},
941+
"OS": {
942+
"type": "string"
943+
},
944+
"Platform": {
945+
"type": "string"
946+
},
947+
"PlatformFamily": {
948+
"type": "string"
949+
},
950+
"PlatformVersion": {
951+
"type": "string"
952+
},
953+
"Uptime": {
954+
"type": "string",
955+
"format": "uint64"
956+
}
957+
}
958+
},
959+
"modelMemoryInformation": {
960+
"type": "object",
961+
"properties": {
962+
"Available": {
963+
"type": "string",
964+
"format": "uint64",
965+
"title": "RAM available for programs to allocate"
966+
},
967+
"Free": {
968+
"description": "This is the kernel's notion of free memory; RAM chips whose bits nobody\ncares about the value of right now. For a human consumable number,\nAvailable is what you really want.",
969+
"type": "string",
970+
"format": "uint64"
971+
},
972+
"Total": {
973+
"type": "string",
974+
"format": "uint64"
975+
},
976+
"Used": {
977+
"type": "string",
978+
"format": "uint64"
979+
},
980+
"UsedPercent": {
981+
"type": "number",
982+
"format": "double"
983+
}
984+
}
985+
},
880986
"modelMempoolTransaction": {
881987
"type": "object",
882988
"title": "Mempool represent the mempool data structure stored in the database",
@@ -921,6 +1027,26 @@
9211027
}
9221028
}
9231029
},
1030+
"modelNodeHardware": {
1031+
"type": "object",
1032+
"properties": {
1033+
"CPUInformation": {
1034+
"type": "array",
1035+
"items": {
1036+
"$ref": "#/definitions/modelCPUInformation"
1037+
}
1038+
},
1039+
"HostInformation": {
1040+
"$ref": "#/definitions/modelHostInformation"
1041+
},
1042+
"MemoryInformation": {
1043+
"$ref": "#/definitions/modelMemoryInformation"
1044+
},
1045+
"StorageInformation": {
1046+
"$ref": "#/definitions/modelStorageInformation"
1047+
}
1048+
}
1049+
},
9241050
"modelNodeRegistration": {
9251051
"type": "object",
9261052
"properties": {
@@ -1074,6 +1200,30 @@
10741200
}
10751201
}
10761202
},
1203+
"modelStorageInformation": {
1204+
"type": "object",
1205+
"properties": {
1206+
"Free": {
1207+
"type": "string",
1208+
"format": "uint64"
1209+
},
1210+
"FsType": {
1211+
"type": "string"
1212+
},
1213+
"Total": {
1214+
"type": "string",
1215+
"format": "uint64"
1216+
},
1217+
"Used": {
1218+
"type": "string",
1219+
"format": "uint64"
1220+
},
1221+
"UsedPercent": {
1222+
"type": "number",
1223+
"format": "double"
1224+
}
1225+
}
1226+
},
10771227
"modelTransaction": {
10781228
"type": "object",
10791229
"title": "Transaction represent the transaction data structure stored in the database",
@@ -1166,6 +1316,43 @@
11661316
"$ref": "#/definitions/modelProofOfOwnership"
11671317
}
11681318
}
1319+
},
1320+
"protobufAny": {
1321+
"type": "object",
1322+
"properties": {
1323+
"type_url": {
1324+
"type": "string"
1325+
},
1326+
"value": {
1327+
"type": "string",
1328+
"format": "byte"
1329+
}
1330+
}
1331+
},
1332+
"runtimeStreamError": {
1333+
"type": "object",
1334+
"properties": {
1335+
"details": {
1336+
"type": "array",
1337+
"items": {
1338+
"$ref": "#/definitions/protobufAny"
1339+
}
1340+
},
1341+
"grpc_code": {
1342+
"type": "integer",
1343+
"format": "int32"
1344+
},
1345+
"http_code": {
1346+
"type": "integer",
1347+
"format": "int32"
1348+
},
1349+
"http_status": {
1350+
"type": "string"
1351+
},
1352+
"message": {
1353+
"type": "string"
1354+
}
1355+
}
11691356
}
11701357
}
11711358
}

model/auth.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax="proto3";
2+
3+
package model;
4+
5+
option go_package = "github.com/zoobc/zoobc-core/common/model";
6+
7+
// RequestType used to sign a node administration request
8+
enum RequestType {
9+
GetNodeHardware = 0;
10+
}

model/nodeHardware.proto

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
syntax="proto3";
2+
3+
package model;
4+
5+
option go_package = "github.com/zoobc/zoobc-core/common/model";
6+
7+
message GetNodeHardwareResponse {
8+
NodeHardware NodeHardware = 1;
9+
}
10+
11+
message GetNodeHardwareRequest {
12+
}
13+
14+
message NodeHardware {
15+
repeated CPUInformation CPUInformation = 1;
16+
MemoryInformation MemoryInformation = 2;
17+
StorageInformation StorageInformation = 3;
18+
HostInformation HostInformation = 4;
19+
}
20+
21+
message CPUInformation {
22+
string Family = 1;
23+
int32 CPUIndex = 2;
24+
string Model = 3;
25+
string ModelName = 4;
26+
string VendorId = 5;
27+
double Mhz = 6;
28+
int32 CacheSize = 7;
29+
double UsedPercent = 8;
30+
string CoreID = 9;
31+
int32 Cores = 10;
32+
}
33+
34+
message HostInformation {
35+
uint64 Uptime = 1;
36+
string OS = 2;
37+
string Platform = 3;
38+
string PlatformFamily = 4;
39+
string PlatformVersion = 5;
40+
uint64 NumberOfRunningProcess = 6;
41+
string HostID = 7;
42+
string HostName = 8;
43+
}
44+
45+
message MemoryInformation {
46+
uint64 Total = 1;
47+
// This is the kernel's notion of free memory; RAM chips whose bits nobody
48+
// cares about the value of right now. For a human consumable number,
49+
// Available is what you really want.
50+
uint64 Free = 2;
51+
// RAM available for programs to allocate
52+
uint64 Available = 3;
53+
uint64 Used = 4;
54+
double UsedPercent = 5;
55+
}
56+
57+
message StorageInformation {
58+
string FsType = 1;
59+
uint64 Total = 2;
60+
uint64 Free = 3;
61+
uint64 Used = 4;
62+
double UsedPercent = 5;
63+
}

service/nodeHardware.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
syntax="proto3";
2+
3+
package service;
4+
5+
option go_package = "github.com/zoobc/zoobc-core/common/service";
6+
7+
import "model/nodeHardware.proto";
8+
import "google/api/annotations.proto";
9+
10+
// NodeHardwareService represent request on get node hardware information
11+
service NodeHardwareService {
12+
rpc GetNodeHardware(stream model.GetNodeHardwareRequest) returns (stream model.GetNodeHardwareResponse) {}
13+
}

0 commit comments

Comments
 (0)