mirror of
https://github.com/juanfont/headscale.git
synced 2026-05-05 03:56:10 +02:00
types: add Unhealthy and SessionEpoch fields to Node
Runtime-only (gorm:"-") fields read by the HA primary route refactor. Updates #3203
This commit is contained in:
parent
010a5564c5
commit
1fe682b141
@ -154,6 +154,16 @@ type Node struct {
|
||||
DeletedAt *time.Time
|
||||
|
||||
IsOnline *bool `gorm:"-"`
|
||||
|
||||
// Unhealthy excludes the node from primary route election while
|
||||
// online. Written by the HA prober. Runtime-only.
|
||||
Unhealthy bool `gorm:"-"`
|
||||
|
||||
// SessionEpoch identifies a poll session. Connect bumps it; a
|
||||
// Disconnect carrying a stale value is dropped, so a deferred
|
||||
// disconnect from a previous session cannot overwrite a newer
|
||||
// Connect. Runtime-only.
|
||||
SessionEpoch uint64 `gorm:"-"`
|
||||
}
|
||||
|
||||
type Nodes []*Node
|
||||
|
||||
@ -106,6 +106,8 @@ var _NodeCloneNeedsRegeneration = Node(struct {
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time
|
||||
IsOnline *bool
|
||||
Unhealthy bool
|
||||
SessionEpoch uint64
|
||||
}{})
|
||||
|
||||
// Clone makes a deep copy of PreAuthKey.
|
||||
|
||||
@ -258,7 +258,16 @@ func (v NodeView) DeletedAt() views.ValuePointer[time.Time] {
|
||||
|
||||
func (v NodeView) IsOnline() views.ValuePointer[bool] { return views.ValuePointerOf(v.ж.IsOnline) }
|
||||
|
||||
func (v NodeView) String() string { return v.ж.String() }
|
||||
// Unhealthy excludes the node from primary route election while
|
||||
// online. Written by the HA prober. Runtime-only.
|
||||
func (v NodeView) Unhealthy() bool { return v.ж.Unhealthy }
|
||||
|
||||
// SessionEpoch identifies a poll session. Connect bumps it; a
|
||||
// Disconnect carrying a stale value is dropped, so a deferred
|
||||
// disconnect from a previous session cannot overwrite a newer
|
||||
// Connect. Runtime-only.
|
||||
func (v NodeView) SessionEpoch() uint64 { return v.ж.SessionEpoch }
|
||||
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 {
|
||||
@ -285,6 +294,8 @@ var _NodeViewNeedsRegeneration = Node(struct {
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time
|
||||
IsOnline *bool
|
||||
Unhealthy bool
|
||||
SessionEpoch uint64
|
||||
}{})
|
||||
|
||||
// View returns a read-only view of PreAuthKey.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user