Documentation
¶
Index ¶
- func IsRuntimeMonitoring(runtimeID string) bool
- func MarkIfNotMonitoring(runtimeID string) bool
- func MarkRuntimeMonitoring(runtimeID string)
- func RuntimeMonitoringSnapshot() map[string]int
- func SetMonitoringRegistry(reg MonitoringRegistry)
- func UnmarkRuntimeMonitoring(runtimeID string)
- type MonitoringRegistry
- type Registry
- type Runtime
- type RuntimeDescriber
- type RuntimeDescription
- type RuntimeEvent
- type RuntimeEventHandler
- type RuntimeImageManager
- type RuntimeInspection
- type RuntimeInspector
- type RuntimeMonitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRuntimeMonitoring ¶
IsRuntimeMonitoring reports whether runtimeID is currently monitored.
func MarkIfNotMonitoring ¶
MarkIfNotMonitoring atomically marks runtimeID as monitored if it is not already. Returns true if the runtimeID was newly marked.
func MarkRuntimeMonitoring ¶
func MarkRuntimeMonitoring(runtimeID string)
MarkRuntimeMonitoring marks runtimeID as actively monitored. It is reference-counted so multiple monitor goroutines for the same runtimeID can coexist safely.
func RuntimeMonitoringSnapshot ¶
RuntimeMonitoringSnapshot returns a copy of the process-global monitoring table. Key is runtimeID and value is monitoring reference count.
func SetMonitoringRegistry ¶
func SetMonitoringRegistry(reg MonitoringRegistry)
SetMonitoringRegistry replaces the process-global monitoring registry. Passing nil is ignored.
func UnmarkRuntimeMonitoring ¶
func UnmarkRuntimeMonitoring(runtimeID string)
UnmarkRuntimeMonitoring releases one monitoring reference for runtimeID.
Types ¶
type MonitoringRegistry ¶
type MonitoringRegistry interface {
Mark(runtimeID string)
Unmark(runtimeID string)
IsMonitoring(runtimeID string) bool
MarkIfNotMonitoring(runtimeID string) bool
Snapshot() map[string]int
}
MonitoringRegistry abstracts runtime monitoring membership operations. Implementations can be in-memory, Redis-backed, etc.
func NewInMemoryMonitoringRegistry ¶
func NewInMemoryMonitoringRegistry() MonitoringRegistry
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
type Runtime ¶
type Runtime interface {
Name() string
Create(ctx context.Context, spec *types.ContainerSpec) (string, error)
Start(ctx context.Context, runtimeID string) error
Stop(ctx context.Context, runtimeID string) error
Pause(ctx context.Context, runtimeID string) error
Resume(ctx context.Context, runtimeID string) error
Delete(ctx context.Context, runtimeID string) error
Logs(ctx context.Context, runtimeID string, tail int) (string, error)
SetEventHandler(handler RuntimeEventHandler)
Exec(ctx context.Context, runtimeID string, cmd []string) (string, error)
}
type RuntimeDescriber ¶ added in v0.1.4
type RuntimeDescriber interface {
Describe(ctx context.Context, runtimeID string) (*RuntimeDescription, error)
}
RuntimeDescriber 是可选扩展接口。实现该接口的运行时可通过 runtimeID 返回 资源的详情(docker inspect / kubectl describe)。
type RuntimeDescription ¶ added in v0.1.4
type RuntimeDescription struct {
// Kind 标识资源类型,例如 container / deployment / job / service。
Kind string `json:"kind"`
// Name 资源名称(docker 容器名,或 k8s workload/service 名)。
Name string `json:"name"`
// Format 描述 Raw 的格式,便于前端渲染,例如 json / yaml / text。
Format string `json:"format"`
// Raw 原始 inspect/describe 输出,保持后端运行时的原生格式。
Raw string `json:"raw"`
}
RuntimeDescription 描述一个运行时的详情信息(对应 docker inspect / kubectl describe)。
type RuntimeEvent ¶
type RuntimeEventHandler ¶
type RuntimeEventHandler interface {
OnEvent(event RuntimeEvent)
}
type RuntimeImageManager ¶
type RuntimeImageManager interface {
EnsureImage(ctx context.Context, image string, pullPolicy string) error
}
RuntimeImageManager is an optional extension interface for runtime-side image lifecycle operations used by ImageManager.
type RuntimeInspection ¶
RuntimeInspection carries runtime-specific inspect data used by manager/service.
type RuntimeInspector ¶
type RuntimeInspector interface {
Inspect(ctx context.Context, runtimeID string) (*RuntimeInspection, error)
}
RuntimeInspector is an optional extension interface. Implementations can expose inspect metadata (such as container internal IP) without forcing all runtimes.