mirror of
https://gitcode.com/JianFeeeee/webui4frpc.git
synced 2026-09-20 08:57:55 +00:00
feat(web): cluster page shows token ring — ring topology/leader/load, pending tasks, active forward topology with owner, incremental log sync view (e2e verified)
This commit is contained in:
@ -78,12 +78,12 @@ type State struct {
|
||||
|
||||
// Token is the circulating message: one physical token, two phases per cycle.
|
||||
type Token struct {
|
||||
Cycle int64 `json:"cycle"`
|
||||
Phase int `json:"phase"`
|
||||
State State `json:"state"`
|
||||
Cycle int64 `json:"cycle"`
|
||||
Phase int `json:"phase"`
|
||||
State State `json:"state"`
|
||||
Log []LogEntry `json:"logDelta,omitempty"`
|
||||
Passed []string `json:"passed,omitempty"`
|
||||
SentAt int64 `json:"sentAt,omitempty"`
|
||||
Passed []string `json:"passed,omitempty"`
|
||||
SentAt int64 `json:"sentAt,omitempty"`
|
||||
}
|
||||
|
||||
// ---- 环图操作 ---- //
|
||||
|
||||
@ -41,8 +41,8 @@ type Engine struct {
|
||||
send func(ctx context.Context, next string, tk *Token) error
|
||||
|
||||
// inflight tracks token-in-flight state (leader only).
|
||||
inflight inFlight
|
||||
Log *ClusterLog
|
||||
inflight inFlight
|
||||
Log *ClusterLog
|
||||
lastLogSent int64
|
||||
// lastRingStart time of the previous cycle launch (leader throttle).
|
||||
lastRingStart time.Time
|
||||
|
||||
@ -29,19 +29,19 @@ const (
|
||||
|
||||
// LogEntry is one immutable, append-only cluster operation.
|
||||
type LogEntry struct {
|
||||
Seq int64 `json:"seq"`
|
||||
Node string `json:"node"`
|
||||
Kind string `json:"kind"`
|
||||
Data json.RawMessage `json:"data,omitempty"`
|
||||
At int64 `json:"at"`
|
||||
Seq int64 `json:"seq"`
|
||||
Node string `json:"node"`
|
||||
Kind string `json:"kind"`
|
||||
Data json.RawMessage `json:"data,omitempty"`
|
||||
At int64 `json:"at"`
|
||||
}
|
||||
|
||||
// ClusterLog is a node's local operation log with a sync watermark.
|
||||
type ClusterLog struct {
|
||||
mu sync.Mutex
|
||||
Seq int64 // highest local seq issued
|
||||
Log []LogEntry // append-only
|
||||
Synced int64 // watermark: entries <= this are known to remote nodes
|
||||
mu sync.Mutex
|
||||
Seq int64 // highest local seq issued
|
||||
Log []LogEntry // append-only
|
||||
Synced int64 // watermark: entries <= this are known to remote nodes
|
||||
}
|
||||
|
||||
// NewClusterLog creates an empty log with initial sequence.
|
||||
|
||||
Reference in New Issue
Block a user