Documentation
¶
Index ¶
- func GenerateRandomID(prefix string) string
- type AddressProbeResult
- type AgentDetailResponse
- type AgentIDQuery
- type AgentResponse
- type AllInflightResponse
- type ConnectivityReport
- type ConnectivityRequest
- type ConnectivityResult
- type CreateRequest
- type DetailRequest
- type EnrollRequest
- type EnrollResponse
- type FailedAgent
- type FullSyncRequest
- type FullSyncResponse
- type FullSyncResult
- type GenerateEnrollmentTokenRequest
- type GenerateEnrollmentTokenResponse
- type GlobalInflightRow
- type Handler
- func (h *Handler) CheckConnectivity(c *app.Context, req ConnectivityRequest) (ConnectivityReport, error)
- func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.Agent], error)
- func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
- func (h *Handler) Detail(c *app.Context, req DetailRequest) (AgentDetailResponse, error)
- func (h *Handler) Enroll(c *app.Context, req EnrollRequest) (api.Created[EnrollResponse], error)
- func (h *Handler) FullSync(c *app.Context, req FullSyncRequest) (FullSyncResponse, error)
- func (h *Handler) GenerateEnrollmentToken(c *app.Context, req GenerateEnrollmentTokenRequest) (GenerateEnrollmentTokenResponse, error)
- func (h *Handler) Get(c *app.Context, req api.IDPathRequest) (models.Agent, error)
- func (h *Handler) GetAllInflight(c *app.Context, _ api.EmptyRequest) (AllInflightResponse, error)
- func (h *Handler) GetConnectivity(c *app.Context, req ConnectivityRequest) (*ConnectivityReport, error)
- func (h *Handler) GetGoroutines(c *app.Context, req AgentIDQuery) (json.RawMessage, error)
- func (h *Handler) GetInflight(c *app.Context, req AgentIDQuery) (json.RawMessage, error)
- func (h *Handler) Interrupt(c *app.Context, req InterruptRequest) (InterruptResponse, error)
- func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[AgentResponse], error)
- func (h *Handler) Online(c *app.Context, _ api.EmptyRequest) ([]OnlineAgentInfo, error)
- func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.Agent, error)
- type InterruptRequest
- type InterruptResponse
- type ListRequest
- type OnlineAgentInfo
- type RuntimeInfo
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomID ¶
Types ¶
type AddressProbeResult ¶
type AgentDetailResponse ¶
type AgentDetailResponse struct {
models.Agent
Runtime *RuntimeInfo `json:"runtime"`
ConfiguredHTTPAddresses string `json:"configured_http_addresses,omitempty"`
EffectiveHTTPAddresses string `json:"effective_http_addresses,omitempty"`
}
type AgentIDQuery ¶ added in v0.0.4
type AgentIDQuery struct {
ID string `form:"id" binding:"required"`
}
AgentIDQuery uses ?id= query parameter (no dynamic route segment per project convention).
type AgentResponse ¶
type AgentResponse struct {
ID uint `json:"id"`
AgentID string `json:"agent_id"`
Name string `json:"name"`
Status int `json:"status"`
LastSeen int64 `json:"last_seen"`
CreatedAt int64 `json:"created_at"`
HTTPAddresses string `json:"http_addresses,omitempty"` // Legacy: effective addresses
ConfiguredHTTPAddresses string `json:"configured_http_addresses,omitempty"` // DB-configured addresses
EffectiveHTTPAddresses string `json:"effective_http_addresses,omitempty"` // Merged effective addresses
Tags string `json:"tags"`
}
type AllInflightResponse ¶ added in v0.0.6
type AllInflightResponse struct {
Requests []GlobalInflightRow `json:"requests"`
FailedAgents []FailedAgent `json:"failed_agents"`
}
AllInflightResponse 是 GetAllInflight 的响应体。
type ConnectivityReport ¶
type ConnectivityReport struct {
AgentID string `json:"agent_id"`
CheckedAt int64 `json:"checked_at"`
Results []ConnectivityResult `json:"results"`
}
type ConnectivityRequest ¶
type ConnectivityRequest struct {
ID string `uri:"id" binding:"required"`
}
type ConnectivityResult ¶
type ConnectivityResult struct {
TargetAgentID string `json:"target_agent_id"`
TargetName string `json:"target_name"`
Results []AddressProbeResult `json:"results"`
}
type CreateRequest ¶
type DetailRequest ¶
type DetailRequest struct {
ID string `uri:"id" binding:"required"`
}
type EnrollRequest ¶
type EnrollResponse ¶
type FailedAgent ¶ added in v0.0.6
type FailedAgent struct {
AgentID uint `json:"agent_id"`
AgentName string `json:"agent_name"`
Error string `json:"error"`
}
FailedAgent 记录某节点拉取失败的原因。
type FullSyncRequest ¶
type FullSyncResponse ¶
type FullSyncResponse struct {
Results []FullSyncResult `json:"results"`
}
type FullSyncResult ¶
type GenerateEnrollmentTokenRequest ¶
type GenerateEnrollmentTokenRequest struct {
TTL int64 `json:"ttl"`
}
type GlobalInflightRow ¶ added in v0.0.6
type GlobalInflightRow struct {
inflight.Snapshot
AgentID uint `json:"agent_id"`
AgentName string `json:"agent_name"`
}
GlobalInflightRow 是单条在途请求,附带节点标识。
type Handler ¶
type Handler struct {
GetOnlineAgentIDs func() []string
GetRuntime func(agentID string) *msync.AgentRuntime
HubCall func(agentID string, method string, params any, timeout time.Duration) (json.RawMessage, error)
Hub *msync.Hub // 用于获取合并后的地址
}
func (*Handler) CheckConnectivity ¶
func (h *Handler) CheckConnectivity(c *app.Context, req ConnectivityRequest) (ConnectivityReport, error)
func (*Handler) Delete ¶
func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
func (*Handler) Detail ¶
func (h *Handler) Detail(c *app.Context, req DetailRequest) (AgentDetailResponse, error)
func (*Handler) Enroll ¶
func (h *Handler) Enroll(c *app.Context, req EnrollRequest) (api.Created[EnrollResponse], error)
func (*Handler) FullSync ¶
func (h *Handler) FullSync(c *app.Context, req FullSyncRequest) (FullSyncResponse, error)
func (*Handler) GenerateEnrollmentToken ¶
func (h *Handler) GenerateEnrollmentToken(c *app.Context, req GenerateEnrollmentTokenRequest) (GenerateEnrollmentTokenResponse, error)
func (*Handler) GetAllInflight ¶ added in v0.0.6
func (h *Handler) GetAllInflight(c *app.Context, _ api.EmptyRequest) (AllInflightResponse, error)
GetAllInflight 并发拉取所有在线节点的 agent.inflight,合并成扁平列表; 某节点出错/超时进 failed_agents,不阻塞其余节点。
func (*Handler) GetConnectivity ¶
func (h *Handler) GetConnectivity(c *app.Context, req ConnectivityRequest) (*ConnectivityReport, error)
func (*Handler) GetGoroutines ¶ added in v0.0.4
func (h *Handler) GetGoroutines(c *app.Context, req AgentIDQuery) (json.RawMessage, error)
GetGoroutines fetches a goroutine dump from a remote agent (admin only).
func (*Handler) GetInflight ¶ added in v0.0.4
func (h *Handler) GetInflight(c *app.Context, req AgentIDQuery) (json.RawMessage, error)
GetInflight fetches the in-flight request snapshot from a remote agent.
func (*Handler) Interrupt ¶ added in v0.0.6
func (h *Handler) Interrupt(c *app.Context, req InterruptRequest) (InterruptResponse, error)
Interrupt 把打断指令转发给目标节点的 agent.interrupt RPC。
func (*Handler) List ¶
func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[AgentResponse], error)
func (*Handler) Online ¶
func (h *Handler) Online(c *app.Context, _ api.EmptyRequest) ([]OnlineAgentInfo, error)
type InterruptRequest ¶ added in v0.0.6
type InterruptRequest struct {
AgentID uint `json:"agent_id" binding:"required"`
ID int64 `json:"id" binding:"required"`
}
InterruptRequest 指定要打断的节点 DB id 和在途请求 id。
type InterruptResponse ¶ added in v0.0.6
type InterruptResponse struct {
Interrupted bool `json:"interrupted"`
}
InterruptResponse 反映打断是否成功。
type ListRequest ¶
type ListRequest struct {
api.PaginationQuery
Search string `form:"search"`
Status string `form:"status"`
}
type OnlineAgentInfo ¶
type OnlineAgentInfo struct {
AgentID string `json:"agent_id"`
Name string `json:"name"`
Tags string `json:"tags"`
HTTPAddresses string `json:"http_addresses,omitempty"` // Legacy: effective addresses
ConfiguredHTTPAddresses string `json:"configured_http_addresses,omitempty"` // DB-configured addresses
EffectiveHTTPAddresses string `json:"effective_http_addresses,omitempty"` // Merged effective addresses
LastSeen int64 `json:"last_seen"`
}
type RuntimeInfo ¶
type RuntimeInfo struct {
Uptime int64 `json:"uptime"`
CachedTokens int `json:"cached_tokens"`
CachedChannels int `json:"cached_channels"`
CachedModels int `json:"cached_models"`
ActiveConnections int `json:"active_connections"`
Version int64 `json:"version"`
MasterVersion int64 `json:"master_version"`
CacheStats map[string]protocol.CacheEntityStats `json:"cache_stats,omitempty"`
}
type UpdateRequest ¶
type UpdateRequest struct {
ID string `uri:"id" binding:"required"`
Fields map[string]any `json:"-"`
}
func (*UpdateRequest) SetBodyMap ¶
func (r *UpdateRequest) SetBodyMap(fields map[string]any)
Click to show internal directories.
Click to hide internal directories.