feat(M6): localOnly forward option (loopback→LAN rewrite for cluster, local direct), canvas diff-based create/revoke commands, revoke task semantics, topology derived canvas on sync nodes, LAN addr helper

This commit is contained in:
2026-08-18 09:44:38 +08:00
parent bf602016b4
commit 40980944e5
12 changed files with 364 additions and 13 deletions

View File

@ -15,6 +15,8 @@ type AppHandler struct {
LoadFn func() (memPct, netPct float64)
// ClaimFn creates the forward on this node (persist + spawn worker).
ClaimFn func(ctx context.Context, tk *Task) error
// RevokeFn cancels the forward on this node (stop worker + drop from store).
RevokeFn func(ctx context.Context, tk *Task) error
}
// RuntimeLoad implements Handler.
@ -34,6 +36,14 @@ func (a *AppHandler) Claim(ctx context.Context, tk *Task) error {
return a.ClaimFn(ctx, tk)
}
// Revoke implements Handler.
func (a *AppHandler) Revoke(ctx context.Context, tk *Task) error {
if a.RevokeFn == nil {
return nil
}
return a.RevokeFn(ctx, tk)
}
// SampleMemLoad returns a cheap memory-usage percentage (0..100).
func SampleMemLoad() float64 {
var m runtime.MemStats