rpc

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleAPIBreakers added in v0.0.16

func HandleAPIBreakers(reg *genericapi.APIBreakerRegistry) (any, error)

HandleAPIBreakers returns Generic API breaker snapshots without folding APIUpstream IDs into the existing LLM channel snapshot contract.

func HandleBreakers added in v0.0.11

func HandleBreakers(reg *resilience.Registry) (any, error)

HandleBreakers 返回当前所有渠道熔断器的快照(供 master 全局熔断看板聚合)。 快照已在 resilience 侧按 (source, channel_id) 确定性排序;渠道名由前端 EntityLabel 解析。

func HandleChannelTest

func HandleChannelTest(ctx context.Context, params json.RawMessage, store *cache.Store, listenAddr string, logger *zap.Logger) (any, error)

func HandleCheckConnectivity

func HandleCheckConnectivity(ctx context.Context, params json.RawMessage, logger *zap.Logger) (any, error)

func HandleDirectProbe added in v0.0.13

func HandleDirectProbe(ctx context.Context, params json.RawMessage, prober *DirectProber, gate DirectProbeGate) (any, error)

func HandleFetchModels

func HandleFetchModels(_ context.Context, params json.RawMessage) (any, error)

func HandleInflight added in v0.0.4

func HandleInflight(reg *inflight.Registry) (any, error)

HandleInflight 返回当前在途请求快照(供 master 节点管理远程查看)。

func HandleInterrupt added in v0.0.6

func HandleInterrupt(reg *inflight.Registry, params json.RawMessage) (any, error)

HandleInterrupt 按句柄 id 取消一条在途请求。reg 为 nil 或 id 不存在时 Interrupted=false。

func HandleLimiterUsage added in v0.0.8

func HandleLimiterUsage(store *limiter.MemStore, index *cache.LimiterIndex) (any, error)

HandleLimiterUsage 采样 memStore 桶级读数,join LimiterIndex 规则元数据, 产出 []protocol.LimiterBucketStat(供 master 扇出聚合 + 前端限流看板)。 store/index 为 nil 时安全降级。

func HandleRelayProbe added in v0.0.13

func HandleRelayProbe(ctx context.Context, params json.RawMessage, prober *RelayProber) (any, error)

func HandleUsageQueue added in v0.0.13

func HandleUsageQueue(rep *reporter.Reporter) (any, error)

HandleUsageQueue 返回 usage 投递两级队列(主队列+旁路重试队列)的只读快照, 供 master 侧管理看板聚合展示(Task 10)。

func HandleUsageQueueOp added in v0.0.13

func HandleUsageQueueOp(rep *reporter.Reporter, params json.RawMessage) (any, error)

HandleUsageQueueOp 只做参数搬运:反序列化 params,委托给 Reporter.QueueOp—— retry_now/degrade/drop 的语义校验和分发全在 reporter 门面里。

Types

type AddrEntry

type AddrEntry struct {
	URL string `json:"url"`
	Tag string `json:"tag"`
}

type AgentOperationHandler added in v0.0.13

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

func NewAgentOperationHandler added in v0.0.13

func NewAgentOperationHandler(sources AgentOperationSources) *AgentOperationHandler

func (*AgentOperationHandler) Handle added in v0.0.13

func (h *AgentOperationHandler) Handle(ctx context.Context, params json.RawMessage) (any, error)

type AgentOperationSources added in v0.0.13

type AgentOperationSources struct {
	Syncer   FullSyncOperator
	Tunnel   RelayReconnectOperator
	Circuits DirectCircuitOperator
	Inflight *inflight.Registry
}

type ChannelTestParams

type ChannelTestParams struct {
	ChannelID    string `json:"channel_id"`
	Model        string `json:"model"`
	EndpointType string `json:"endpoint_type"`
	Stream       bool   `json:"stream"`
}

type ChannelTestResult

type ChannelTestResult struct {
	Success    bool    `json:"success"`
	StatusCode int     `json:"status_code,omitempty"`
	Response   string  `json:"response,omitempty"`
	Error      string  `json:"error,omitempty"`
	TimeCost   float64 `json:"time_cost"`
	Model      string  `json:"model"`
}

type ConnResult

type ConnResult struct {
	TargetAgentID string        `json:"target_agent_id"`
	TargetName    string        `json:"target_name"`
	Results       []ProbeResult `json:"results"`
}

type ConnTarget

type ConnTarget struct {
	AgentID       string          `json:"agent_id"`
	Name          string          `json:"name"`
	HTTPAddresses json.RawMessage `json:"http_addresses"`
}

type DirectCircuitOperator added in v0.0.13

type DirectCircuitOperator interface {
	ResetCircuit(targetAgentID, addressFingerprint string)
}

type DirectProbeGate added in v0.0.13

type DirectProbeGate interface {
	BindProbeTarget(protocol.DirectProbeTarget)
	MarkChecking(targetAgentID, addressFingerprint string)
	ApplyProbeResult(protocol.DirectProbeResult)
}

type DirectProbeMetricRecorder added in v0.0.13

type DirectProbeMetricRecorder interface {
	IncDirectProbe(pkgmetrics.ProbeResult)
}

type DirectProber added in v0.0.13

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

func NewDirectProber added in v0.0.13

func NewDirectProber(opts DirectProberOptions) *DirectProber

func (*DirectProber) Probe added in v0.0.13

type DirectProberOptions added in v0.0.13

type DirectProberOptions struct {
	Pool    agentproxy.DirectProbeStreamOpener
	Now     func() time.Time
	Timeout time.Duration
	Metrics DirectProbeMetricRecorder
}

type FetchModelsParams

type FetchModelsParams struct {
	BaseURL   string `json:"base_url"`
	Key       string `json:"key"`
	Type      int    `json:"type"`
	Endpoints string `json:"endpoints"`
	ProxyURL  string `json:"proxy_url"`
}

type FetchModelsResult

type FetchModelsResult struct {
	Models []string `json:"models"`
	Error  string   `json:"error,omitempty"`
}

type FullSyncOperator added in v0.0.13

type FullSyncOperator interface {
	FullSync(ctx context.Context) error
}

type GoroutineDump added in v0.0.4

type GoroutineDump struct {
	Count int    `json:"count"`
	Dump  string `json:"dump"`
}

GoroutineDump 是 goroutine 栈快照载体。

func HandleGoroutines added in v0.0.4

func HandleGoroutines() (GoroutineDump, error)

HandleGoroutines 抓取全部 goroutine 栈(诊断卡死阻塞点用)。

type InterruptResult added in v0.0.6

type InterruptResult struct {
	Interrupted bool `json:"interrupted"`
}

InterruptResult 是 agent.interrupt 的返回体。

type ProbeResult

type ProbeResult struct {
	URL       string `json:"url"`
	Tag       string `json:"tag"`
	Reachable bool   `json:"reachable"`
	LatencyMs int    `json:"latency_ms"`
	Error     string `json:"error"`
}

type RelayProbeMetricRecorder added in v0.0.13

type RelayProbeMetricRecorder interface {
	IncConnectivityProbe(pkgmetrics.PathKind, pkgmetrics.ProbeResult)
}

type RelayProber added in v0.0.13

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

func NewRelayProber added in v0.0.13

func NewRelayProber(opts RelayProberOptions) *RelayProber

func (*RelayProber) Probe added in v0.0.13

type RelayProberOptions added in v0.0.13

type RelayProberOptions struct {
	Link            app.ProbeStreamOpener
	RelayGeneration func() uint64
	Now             func() time.Time
	Timeout         time.Duration
	Metrics         RelayProbeMetricRecorder
}

type RelayReconnectOperator added in v0.0.13

type RelayReconnectOperator interface {
	Reconnect(ctx context.Context) error
}

type UsageQueueOpParams added in v0.0.13

type UsageQueueOpParams struct {
	Op         string   `json:"op"`
	QueueIDs   []string `json:"queue_ids"`
	RequestIDs []string `json:"request_ids,omitempty"`
	Level      int      `json:"level,omitempty"`
}

type UsageQueueOpResult added in v0.0.13

type UsageQueueOpResult struct {
	Affected int `json:"affected"`
}

Jump to

Keyboard shortcuts

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