-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathsystem.go
More file actions
35 lines (28 loc) · 993 Bytes
/
system.go
File metadata and controls
35 lines (28 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package models
// SystemModel groups operations on the system.
type SystemModel struct{}
// RunningStatus holds information of the network.
type RunningStatus struct {
BlockHeight int64 `json:"block_height"`
CountAccounts int64 `json:"count_accounts"`
CountShardChains int64 `json:"count_shardchains"`
QPS int64 `json:"qps"`
StorageSize int64 `json:"storage_size"`
}
// GetRunningStatus gets current running status of the system.
func (m *SystemModel) GetRunningStatus() (status *RunningStatus, err error) {
status = new(RunningStatus)
var blocksModel BlocksModel
if status.BlockHeight, err = blocksModel.GetMaxHeight(); err != nil {
return nil, err
}
var accountsModel AccountsModel
if status.CountAccounts, err = accountsModel.CountAccounts(); err != nil {
return nil, err
}
var shardChainsModel ShardChainsModel
if status.CountShardChains, err = shardChainsModel.CountShardChains(); err != nil {
return nil, err
}
return status, nil
}