-
Notifications
You must be signed in to change notification settings - Fork 92
/
status.go
84 lines (74 loc) · 1.46 KB
/
status.go
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright 2017 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package wsapi
import (
"github.com/FactomProject/factomd/common/interfaces"
"github.com/FactomProject/factomd/common/primitives"
"encoding/json" // DEBUG
"fmt" // DEBUG
)
var _ = fmt.Sprintln("DEBUG")
var _ = json.Marshal // "DEBUG"
func HandleHoldingQueue(
state interfaces.IState,
params interface{},
) (
interface{},
*primitives.JSONError,
) {
type ret struct {
Messages []interfaces.IMsg
}
r := new(ret)
for _, v := range state.LoadHoldingMap() {
r.Messages = append(r.Messages, v)
}
return r, nil
}
func HandleNodeStatus(
state interfaces.IState,
params interface{},
) (
interface{},
*primitives.JSONError,
) {
type ret struct {
Status []string
}
r := new(ret)
r.Status = state.GetStatus()
return r, nil
}
func HandleNetworkInfo(
state interfaces.IState,
params interface{},
) (
interface{},
*primitives.JSONError,
) {
type ret struct {
NetworkNumber int
NetworkName string
NetworkID uint32
}
r := new(ret)
r.NetworkNumber = state.GetNetworkNumber()
r.NetworkName = state.GetNetworkName()
r.NetworkID = state.GetNetworkID()
return r, nil
}
func HandlePredictiveFER(
state interfaces.IState,
params interface{},
) (
interface{},
*primitives.JSONError,
) {
type ret struct {
PredictiveFER uint64
}
r := new(ret)
r.PredictiveFER = state.GetPredictiveFER()
return r, nil
}