WIP: allow update processes in cluster

This commit is contained in:
Ingo Oppermann
2023-05-12 12:59:01 +02:00
parent f3e410f4f5
commit 7d2b7b4836
18 changed files with 990 additions and 311 deletions

View File

@@ -1,19 +1,25 @@
package api
type ClusterNodeConfig struct {
Address string `json:"address"`
Username string `json:"username"`
Password string `json:"password"`
}
import "encoding/json"
type ClusterNode struct {
Address string `json:"address"`
ID string `json:"id"`
LastContact int64 `json:"last_contact"` // unix timestamp
Latency float64 `json:"latency_ms"` // milliseconds
State string `json:"state"`
CPU float64 `json:"cpu_used"` // percent 0-100*npcu
Mem uint64 `json:"mem_used" format:"uint64"` // bytes
ID string `json:"id"`
Name string `json:"name"`
Address string `json:"address"`
CreatedAt string `json:"created_at"`
Uptime int64 `json:"uptime_seconds"`
LastContact int64 `json:"last_contact"` // unix timestamp
Latency float64 `json:"latency_ms"` // milliseconds
State string `json:"state"`
Resources ClusterNodeResources `json:"resources"`
}
type ClusterNodeResources struct {
NCPU float64 `json:"ncpu"`
CPU float64 `json:"cpu_used"` // percent 0-100*npcu
CPULimit float64 `json:"cpu_limit"` // percent 0-100*npcu
Mem uint64 `json:"memory_used_bytes"`
MemLimit uint64 `json:"memory_limit_bytes"`
}
type ClusterNodeFiles struct {
@@ -28,6 +34,17 @@ type ClusterServer struct {
Leader bool `json:"leader"`
}
type ClusterProcess struct {
ProcessID string `json:"id"`
NodeID string `json:"node_id"`
Reference string `json:"reference"`
Order string `json:"order"`
State string `json:"state"`
CPU json.Number `json:"cpu" swaggertype:"number" jsonschema:"type=number"`
Memory uint64 `json:"memory_bytes"`
Runtime int64 `json:"runtime_seconds"`
}
type ClusterStats struct {
State string `json:"state"`
LastContact float64 `json:"last_contact_ms"`
@@ -39,6 +56,6 @@ type ClusterAbout struct {
Address string `json:"address"`
ClusterAPIAddress string `json:"cluster_api_address"`
CoreAPIAddress string `json:"core_api_address"`
Nodes []ClusterServer `json:"nodes"`
Server []ClusterServer `json:"server"`
Stats ClusterStats `json:"stats"`
}