system

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveLegacyDatabaseSources added in v0.0.14

func ActiveLegacyDatabaseSources(configuredPath string, status masterhistorybackfill.Status) []string

func MarkHistorySourceDeleted added in v0.0.14

func MarkHistorySourceDeleted(ctx context.Context, core *gorm.DB, deletedAtUnix int64) error

func ReconcileHistorySourceDeletion added in v0.0.14

func ReconcileHistorySourceDeletion(ctx context.Context, path string, markDeleted func(context.Context) error) error

func SeedMasterSettingsSnapshot added in v0.0.15

func SeedMasterSettingsSnapshot(application app.Application) error

SeedMasterSettingsSnapshot loads the master-only settings registry once at startup. AgentSettings are intentionally excluded from this snapshot.

Types

type BYOKSystemBaseURLsResponse added in v0.0.2

type BYOKSystemBaseURLsResponse struct {
	URLs []string `json:"urls"`
}

BYOKSystemBaseURLsResponse lists code-pinned default BaseURL prefixes for BYOK. The admin Settings page renders these as "read-only system recommended" alongside the editable byok_base_url_allowlist setting (admin extra). Both are union-merged at validation time (see private_channel.validateBaseURLAllowlist).

type CleanupTableBatchRequest added in v0.0.15

type CleanupTableBatchRequest struct {
	Database       string `json:"database" binding:"required,oneof=core log"`
	Table          string `json:"table" binding:"required"`
	CutoffDate     string `json:"cutoff_date" binding:"required"`
	SnapshotMaxKey string `json:"snapshot_max_key" binding:"required"`
}

type CleanupTableBatchResponse added in v0.0.15

type CleanupTableBatchResponse struct {
	Deleted int64 `json:"deleted"`
	HasMore bool  `json:"has_more"`
}

type CleanupTablePreviewRequest added in v0.0.15

type CleanupTablePreviewRequest struct {
	Database   string `form:"database" binding:"required,oneof=core log"`
	Table      string `form:"table" binding:"required"`
	CutoffDate string `form:"cutoff_date" binding:"required"`
}

type CleanupTablePreviewResponse added in v0.0.15

type CleanupTablePreviewResponse struct {
	Database       string `json:"database"`
	Table          string `json:"table"`
	CutoffDate     string `json:"cutoff_date"`
	Total          int64  `json:"total"`
	ToDelete       int64  `json:"to_delete"`
	SnapshotMaxKey string `json:"snapshot_max_key"`
}

type ClearLogBacklogRequest added in v0.0.14

type ClearLogBacklogRequest struct {
	Confirm bool `form:"confirm"`
}

type ClearLogBacklogResponse added in v0.0.14

type ClearLogBacklogResponse struct {
	Pending int   `json:"pending"`
	Retry   int   `json:"retry"`
	Dropped int   `json:"dropped"`
	Bytes   int64 `json:"bytes"`
}

type CompleteHistoryBackfillRequest added in v0.0.14

type CompleteHistoryBackfillRequest struct {
	Confirm bool `json:"confirm"`
}

type CompleteHistoryBackfillResponse added in v0.0.14

type CompleteHistoryBackfillResponse struct {
	Completed bool `json:"completed"`
}

type DatabaseStatus added in v0.0.14

type DatabaseStatus struct {
	Status          string `json:"status"`
	Path            string `json:"path"`
	SchemaVersion   string `json:"schema_version"`
	LastError       string `json:"last_error"`
	SizeBytes       int64  `json:"size_bytes"`
	OpenConnections int    `json:"open_connections"`
}

type DeleteLegacyFileRequest added in v0.0.14

type DeleteLegacyFileRequest struct {
	Confirmation string `form:"confirmation"`
}

type DeleteLegacyFileResponse added in v0.0.14

type DeleteLegacyFileResponse struct {
	Deleted bool `json:"deleted"`
}

type GetSettingsRequest

type GetSettingsRequest struct{}

type Handler

type Handler struct {
	StatsCache                    *dao.StatsCache
	ConnectedCount                func() int
	RefreshProbeTimings           func(context.Context)
	CoreDatabasePath              string
	LogDatabasePath               string
	LegacyDatabasePath            string
	CoreDatabase                  func() *gorm.DB
	LogDatabase                   func() *gorm.DB
	LogDatabaseReady              func() bool
	LogDatabaseError              func() string
	LogQueueSnapshot              func() LogQueueStatus
	RetryLogQueue                 func()
	ClearLogQueueBacklog          func() (ClearLogBacklogResponse, error)
	LegacyArtifactSnapshot        func() (masterdatabase.LegacyArtifact, error)
	HistoryBackfillSnapshot       func() masterhistorybackfill.Status
	RetryHistoryBackfill          func()
	SkipHistoryBackfill           func(context.Context) error
	CompleteHistoryBackfill       func(context.Context) error
	DeleteLegacySource            func(string) error
	DeleteLegacyArtifact          func(string) error
	MarkHistorySourceDeleted      func(context.Context) error
	ReconcileHistorySourceDeleted func(context.Context, string) error
	// contains filtered or unexported fields
}

func (*Handler) BYOKSystemBaseURLs added in v0.0.2

func (h *Handler) BYOKSystemBaseURLs(_ *app.Context, _ api.EmptyRequest) (BYOKSystemBaseURLsResponse, error)

BYOKSystemBaseURLs returns the code-pinned system default BYOK base URLs. Pure read; no DB access. Mutating this list requires editing internal/consts/byok.go and re-deploying.

func (*Handler) CleanupTableBatch added in v0.0.15

func (*Handler) CleanupTablePreview added in v0.0.15

func (*Handler) ClearLogBacklog added in v0.0.14

func (h *Handler) ClearLogBacklog(c *app.Context, req ClearLogBacklogRequest) (ClearLogBacklogResponse, error)

func (*Handler) CompleteHistoryBackfillNow added in v0.0.14

func (h *Handler) CompleteHistoryBackfillNow(c *app.Context, req CompleteHistoryBackfillRequest) (CompleteHistoryBackfillResponse, error)

func (*Handler) DeleteHistoryBackfillLegacyArtifact added in v0.0.14

func (h *Handler) DeleteHistoryBackfillLegacyArtifact(c *app.Context, req DeleteLegacyFileRequest) (DeleteLegacyFileResponse, error)

func (*Handler) DeleteHistoryBackfillSource added in v0.0.14

func (h *Handler) DeleteHistoryBackfillSource(c *app.Context, req DeleteLegacyFileRequest) (DeleteLegacyFileResponse, error)

func (*Handler) GetSettings

func (h *Handler) GetSettings(c *app.Context, _ GetSettingsRequest) (SettingsResponse, error)

func (*Handler) PublicConfig added in v0.0.6

func (h *Handler) PublicConfig(c *app.Context, _ api.EmptyRequest) (PublicConfigResponse, error)

PublicConfig 暴露登录前/登录后前端都需要的平台开关。公开端点,无鉴权。

func (*Handler) RetryHistoryBackfillNow added in v0.0.14

func (*Handler) RetryLogQueueNow added in v0.0.14

func (h *Handler) RetryLogQueueNow(c *app.Context, _ RetryLogQueueRequest) (RetryLogQueueResponse, error)

func (*Handler) SkipHistoryBackfillRemaining added in v0.0.14

func (h *Handler) SkipHistoryBackfillRemaining(c *app.Context, req SkipHistoryBackfillRequest) (SkipHistoryBackfillResponse, error)

func (*Handler) Stats

func (h *Handler) Stats(c *app.Context, _ StatsRequest) (StatsResponse, error)

func (*Handler) UpdateSettings

func (h *Handler) UpdateSettings(c *app.Context, req UpdateSettingsRequest) (SettingsResponse, error)

type LogQueueStatus added in v0.0.14

type LogQueueStatus struct {
	Pending       int    `json:"pending"`
	Retry         int    `json:"retry"`
	Inflight      int    `json:"inflight"`
	Bytes         int64  `json:"bytes"`
	OldestSeconds int64  `json:"oldest_seconds"`
	Dropped       uint64 `json:"dropped"`
	LastError     string `json:"last_error"`
}

func LogQueueStatusFrom added in v0.0.14

func LogQueueStatusFrom(status masterlogqueue.DeliveryStatus) LogQueueStatus

type PublicConfigResponse added in v0.0.6

type PublicConfigResponse struct {
	RegistrationEnabled bool `json:"registration_enabled"`
	InviteEnabled       bool `json:"invite_enabled"`
	// InviteUserMaxCodes 是普通用户名下有效邀请码数量上限;0 表示禁止普通用户建码。
	// 前端据此(结合 isAdmin)决定是否展示邀请入口。
	InviteUserMaxCodes int `json:"invite_user_max_codes"`
}

PublicConfigResponse 是无需鉴权即可读取的平台公开配置/特性开关。 后续同类公开 flag 直接往这里加字段。

type RetryHistoryBackfillRequest added in v0.0.14

type RetryHistoryBackfillRequest struct{}

type RetryHistoryBackfillResponse added in v0.0.14

type RetryHistoryBackfillResponse struct {
	Woken bool `json:"woken"`
}

type RetryLogQueueRequest added in v0.0.14

type RetryLogQueueRequest struct{}

type RetryLogQueueResponse added in v0.0.14

type RetryLogQueueResponse struct {
	Woken bool `json:"woken"`
}

type SettingsResponse

type SettingsResponse struct {
	Settings map[string]string `json:"settings"`
}

type SkipHistoryBackfillRequest added in v0.0.14

type SkipHistoryBackfillRequest struct {
	Confirm bool `form:"confirm"`
}

type SkipHistoryBackfillResponse added in v0.0.14

type SkipHistoryBackfillResponse struct {
	Skipped bool `json:"skipped"`
}

type StatsRequest

type StatsRequest struct{}

type StatsResponse

type StatsResponse struct {
	Tables  []TableStats  `json:"tables"`
	System  SystemInfo    `json:"system"`
	Storage StorageStatus `json:"storage"`
}

type StorageStatus added in v0.0.14

type StorageStatus struct {
	CoreDB          DatabaseStatus                `json:"core_db"`
	LogDB           DatabaseStatus                `json:"log_db"`
	LegacyDB        DatabaseStatus                `json:"legacy_db"`
	LegacyArtifact  masterdatabase.LegacyArtifact `json:"legacy_artifact"`
	LogQueue        LogQueueStatus                `json:"log_delivery_queue"`
	HistoryBackfill masterhistorybackfill.Status  `json:"history_backfill"`
}

type SystemInfo

type SystemInfo struct {
	Version      string `json:"version"`
	GoVersion    string `json:"go_version"`
	StartTime    int64  `json:"start_time"`
	UptimeSec    int64  `json:"uptime_sec"`
	MemoryAlloc  uint64 `json:"memory_alloc"`
	MemorySys    uint64 `json:"memory_sys"`
	NumGC        uint32 `json:"num_gc"`
	NumGoroutine int    `json:"num_goroutine"`
	OnlineAgents int    `json:"online_agents"`
}

type TableStats

type TableStats struct {
	Database string `json:"database"`
	Name     string `json:"name"`
	Count    int64  `json:"count"`
}

type UpdateSettingsRequest

type UpdateSettingsRequest struct {
	Settings map[string]string `json:"settings" binding:"required"`
}

Jump to

Keyboard shortcuts

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