mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-04 04:34:07 +09:00
types: add when a node's run of control sessions began
This commit is contained in:
1 parent
160302e920
commit
41dc97401b
4 files changed
+16
-2
No files matched your search
@@ -1912,7 +1912,7 @@ var nodeFieldImpact = map[string]string{
|
||||
"RegisterMethod": "payload", "AuthKeyID": "payload", "AuthKey": "payload",
|
||||
"Expiry": "election", "LastSeen": "payload", "CreatedAt": "payload",
|
||||
"UpdatedAt": "payload", "DeletedAt": "payload",
|
||||
"ActiveSessions": "payload", "SessionEpoch": "payload",
|
||||
"ActiveSessions": "payload", "SessionEpoch": "payload", "SessionStart": "election",
|
||||
}
|
||||
|
||||
// TestUpdateChangesCoversEveryNodeField guards against a new types.Node
|
||||
|
||||
@@ -210,6 +210,12 @@ type Node struct {
|
||||
// returned by Connect as a "Connect ran" sentinel for its cleanup,
|
||||
// and Disconnect logs it. Runtime-only.
|
||||
SessionEpoch uint64 `gorm:"-"`
|
||||
|
||||
// SessionStart is when the node's current run of control sessions
|
||||
// began: [State.Connect] sets it as the first of them opens, and an
|
||||
// overlapping reconnect keeps it. Primary election prefers the
|
||||
// oldest. Runtime-only.
|
||||
SessionStart time.Time `gorm:"-"`
|
||||
}
|
||||
|
||||
type Nodes []*Node
|
||||
|
||||
@@ -108,6 +108,7 @@ var _NodeCloneNeedsRegeneration = Node(struct {
|
||||
Unhealthy bool
|
||||
ActiveSessions int
|
||||
SessionEpoch uint64
|
||||
SessionStart time.Time
|
||||
}{})
|
||||
|
||||
// Clone makes a deep copy of PreAuthKey.
|
||||
|
||||
@@ -281,7 +281,13 @@ func (v NodeView) ActiveSessions() int { return v.ж.ActiveSessions }
|
||||
// returned by Connect as a "Connect ran" sentinel for its cleanup,
|
||||
// and Disconnect logs it. Runtime-only.
|
||||
func (v NodeView) SessionEpoch() uint64 { return v.ж.SessionEpoch }
|
||||
func (v NodeView) String() string { return v.ж.String() }
|
||||
|
||||
// SessionStart is when the node's current run of control sessions
|
||||
// began: [State.Connect] sets it as the first of them opens, and an
|
||||
// overlapping reconnect keeps it. Primary election prefers the
|
||||
// oldest. Runtime-only.
|
||||
func (v NodeView) SessionStart() time.Time { return v.ж.SessionStart }
|
||||
func (v NodeView) String() string { return v.ж.String() }
|
||||
|
||||
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
||||
var _NodeViewNeedsRegeneration = Node(struct {
|
||||
@@ -311,6 +317,7 @@ var _NodeViewNeedsRegeneration = Node(struct {
|
||||
Unhealthy bool
|
||||
ActiveSessions int
|
||||
SessionEpoch uint64
|
||||
SessionStart time.Time
|
||||
}{})
|
||||
|
||||
// View returns a read-only view of PreAuthKey.
|
||||
|
||||
Reference in new issue
Block a user