agent

package
v1.7.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AckV2Events

func AckV2Events(uuid string, ackIDs []string)

func DeleteClientConditionally

func DeleteClientConditionally(uuid string, connToRemove *connection.SafeConn)

func DeleteConnectedClients

func DeleteConnectedClients(uuid string)

func DeleteLatestReport

func DeleteLatestReport(uuid string)

func DeleteV2EventQueue added in v1.6.29

func DeleteV2EventQueue(uuid string)

DeleteV2EventQueue retires this generation and wakes its long polls. Ordinary disconnects must keep pending, unexpired commands for reconnect delivery.

func DispatchPing

func DispatchPing(uuid string, params v2.PingParams) bool

func DispatchV2Event

func DispatchV2Event(uuid, method string, params any) bool

func EnqueueV2Event

func EnqueueV2Event(uuid, method string, params any) v2.Event

func GetAllOnlineUUIDs

func GetAllOnlineUUIDs() []string

GetAllOnlineUUIDs returns a de-duplicated list of online UUIDs from both WebSocket and non-WebSocket agents.

func GetConnectedClient added in v0.1.16

func GetConnectedClient(uuid string) *connection.SafeConn

GetConnectedClient 返回指定节点的连接;节点不在线时返回 nil。

为什么单独开一个单键访问器:GetConnectedClients 会复制整张连接表,调用方却 大多只查一个 key。adminExec 这类每个客户端查一次、每个在线客户端再查一次的 路径,用整表复制就是每个请求复制整表好几遍。

func GetConnectedClients

func GetConnectedClients() map[string]*connection.SafeConn

func GetLatestReport

func GetLatestReport(ids ...string) map[string]*v2.Report

func GetRecentReports

func GetRecentReports(uuid string) []v2.Report

func IsAgentOnline

func IsAgentOnline(uuid string) bool

func IsV2Client

func IsV2Client(uuid string) bool

func KeepAlivePresence

func KeepAlivePresence(uuid string, connectionID int64, ttl time.Duration)

SetPresence sets or clears presence for non-WebSocket agents. When present=false, it only clears if the connectionID matches current one. KeepAlivePresence sets presence with TTL for non-WebSocket agents.

func MarkV2Client

func MarkV2Client(uuid string)

func NoteReportClamp added in v1.6.29

func NoteReportClamp(uuid, fields string) bool

NoteReportClamp emits one warning per resource set until a valid sample recovers or the node is removed. Call only after the report is accepted.

func RecordReport

func RecordReport(report v2.Report)

RecordReport updates the latest runtime state and keeps only the short raw window used by recent-status compatibility endpoints.

func ResetClient added in v1.7.0

func ResetClient(uuid string)

ResetClient retires connection/presence/commands but preserves measurements. Transport close bypasses the writer mutex so a stalled peer cannot pin reset.

func SetConnectedClients

func SetConnectedClients(uuid string, conn *connection.SafeConn)

func SetPresence

func SetPresence(uuid string, connectionID int64, present bool)

SetPresence keeps compatibility with existing callers.

func SweepV2EventQueues added in v1.6.29

func SweepV2EventQueues()

SweepV2EventQueues runs on the panel's existing scheduler, not a new worker.

func TakeV2Events

func TakeV2Events(uuid string, ackIDs []string, limit int) []v2.Event

func WaitV2Events

func WaitV2Events(uuid string, ackIDs []string, timeout time.Duration) []v2.Event

Types

type V2EventWait added in v1.7.0

type V2EventWait struct {
	// contains filtered or unexported fields
}

V2EventWait captures queue identity during credential admission, but never holds that admission while waiting or returns another generation's work.

func PrepareV2EventWait added in v1.7.0

func PrepareV2EventWait(uuid string, ackIDs []string) V2EventWait

func (V2EventWait) Wait added in v1.7.0

func (wait V2EventWait) Wait(ctx context.Context, timeout time.Duration) []v2.Event

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL