mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 00:45:43 +03:00
small cleanup
This commit is contained in:
10
api/nodes.go
10
api/nodes.go
@@ -127,13 +127,11 @@ const (
|
||||
|
||||
// NodeEvent is a single unit representing a node’s state change
|
||||
type NodeEvent struct {
|
||||
Message string
|
||||
Subsystem string
|
||||
Details map[string]string
|
||||
Timestamp int64
|
||||
|
||||
Message string
|
||||
Subsystem string
|
||||
Details map[string]string
|
||||
Timestamp int64
|
||||
CreateIndex uint64
|
||||
ModifyIndex uint64
|
||||
}
|
||||
|
||||
// HostStats represents resource usage stats of the host running a Nomad client
|
||||
|
||||
@@ -1153,7 +1153,7 @@ func (c *Client) submitNodeEvents(events []*structs.NodeEvent) error {
|
||||
}
|
||||
var resp structs.EmitNodeEventsResponse
|
||||
if err := c.RPC("Node.EmitEvents", &req, &resp); err != nil {
|
||||
return fmt.Errorf("Emitting node event failed: %v", err)
|
||||
return fmt.Errorf("Emitting node events failed: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ func (n *nomadFSM) Apply(log *raft.Log) interface{} {
|
||||
case structs.AutopilotRequestType:
|
||||
return n.applyAutopilotUpdate(buf[1:], log.Index)
|
||||
case structs.UpsertNodeEventsType:
|
||||
return n.applyUpsertNodeEventType(buf[1:], log.Index)
|
||||
return n.applyUpsertNodeEvent(buf[1:], log.Index)
|
||||
}
|
||||
|
||||
// Check enterprise only message types.
|
||||
@@ -630,8 +630,8 @@ func (n *nomadFSM) applyReconcileSummaries(buf []byte, index uint64) interface{}
|
||||
return n.reconcileQueuedAllocations(index)
|
||||
}
|
||||
|
||||
// applyUpsertNodeEventType tracks the given node events.
|
||||
func (n *nomadFSM) applyUpsertNodeEventType(buf []byte, index uint64) interface{} {
|
||||
// applyUpsertNodeEvent tracks the given node events.
|
||||
func (n *nomadFSM) applyUpsertNodeEvent(buf []byte, index uint64) interface{} {
|
||||
defer metrics.MeasureSince([]string{"nomad", "fsm", "upsert_node_events"}, time.Now())
|
||||
var req structs.EmitNodeEventsRequest
|
||||
if err := structs.Decode(buf, &req); err != nil {
|
||||
|
||||
@@ -527,7 +527,7 @@ func (s *StateStore) UpsertNode(index uint64, node *structs.Node) error {
|
||||
node.ModifyIndex = index
|
||||
node.Drain = exist.Drain // Retain the drain mode
|
||||
|
||||
// retain node events that have already been set on the node
|
||||
// Retain node events that have already been set on the node
|
||||
node.Events = exist.Events
|
||||
} else {
|
||||
// Because this is the first time the node is being registered, we should
|
||||
@@ -685,7 +685,6 @@ func (s *StateStore) upsertNodeEvents(index uint64, nodeID string, events []*str
|
||||
// Add the events, updating the indexes
|
||||
for _, e := range events {
|
||||
e.CreateIndex = index
|
||||
e.ModifyIndex = index
|
||||
copyNode.Events = append(copyNode.Events, e)
|
||||
}
|
||||
|
||||
|
||||
@@ -1086,7 +1086,6 @@ type NodeEvent struct {
|
||||
Details map[string]string
|
||||
Timestamp int64
|
||||
CreateIndex uint64
|
||||
ModifyIndex uint64
|
||||
}
|
||||
|
||||
func (ne *NodeEvent) String() string {
|
||||
|
||||
Reference in New Issue
Block a user