Documentation
¶
Index ¶
- func AddPingTask(clients []string, defaultOn bool, name string, target, task_type string, ...) (uint, error)
- func AddPingTaskPinned(ctx context.Context, task *models.PingTask) error
- func AddPingTaskPinnedDraft(ctx context.Context, db *gorm.DB, task *models.PingTask, reload func() error) error
- func ClearTaskResultsByTimeBefore(before time.Time) error
- func CreateClientWithDefaultPing(ctx context.Context, db *gorm.DB, client *models.Client) (bool, error)
- func CreateTask(taskId string, clients []string, command string) error
- func DeleteAllPingRecords() error
- func DeletePingRecords(id []uint) error
- func DeletePingTask(id []uint) error
- func EditPingTask(edits []PingTaskEdit) error
- func EditPingTasksPinnedDraft(ctx context.Context, db *gorm.DB, edits []PingTaskEdit, reload func() error) error
- func GetAllPingTasks() ([]models.PingTask, error)
- func GetAllTasks() ([]models.Task, error)
- func GetPingRecords(uuid string, taskId int, start, end time.Time) ([]models.PingRecord, error)
- func GetPingRecordsBatch(uuids []string, taskId int, start, end time.Time) (map[string][]models.PingRecord, error)
- func GetPingTasksByClient(uuid string) []models.PingTask
- func GetSpecificTaskResult(taskId, clientId string) (*models.TaskResult, error)
- func GetTaskByTaskId(taskId string) (*models.Task, error)
- func GetTaskResultsByTaskId(taskId string) ([]models.TaskResult, error)
- func GetTasksByClientId(clientId string) ([]models.Task, error)
- func PingScheduleReloadPending() bool
- func ReconcilePingDeletions(ctx context.Context) (int, error)
- func ReconcilePingSchedule() (bool, error)
- func ReloadPingSchedule() error
- func SaveTaskResult(taskId, clientId, result string, exitCode int, timestamp time.Time) error
- func SaveTaskResultContext(ctx context.Context, taskId, clientId, result string, exitCode int, ...) error
- func UpdatePingTaskOrder(order map[uint]int) error
- type PingDeletionPendingError
- type PingTaskEdit
- type PingTaskValidationError
- type ScheduleReloadPendingError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPingTask ¶
func AddPingTask(clients []string, defaultOn bool, name string, target, task_type string, interval int, reference string) (uint, error)
AddPingTask 创建延迟监测任务。defaultOn 表示新加入的服务器是否自动开启此监测。
func AddPingTaskPinned ¶ added in v1.7.30
AddPingTaskPinned creates a family-pinned task using the production DB and reloads the schedule after the transaction commits.
func AddPingTaskPinnedDraft ¶ added in v1.7.30
func AddPingTaskPinnedDraft(ctx context.Context, db *gorm.DB, task *models.PingTask, reload func() error) error
AddPingTaskPinnedDraft accepts an explicit DB and scheduler for isolated tests.
func CreateClientWithDefaultPing ¶ added in v1.7.30
func CreateClientWithDefaultPing(ctx context.Context, db *gorm.DB, client *models.Client) (bool, error)
CreateClientWithDefaultPing atomically creates a node and its default-on assignments. The caller holds the roster fence and the new node's guard; task creation/edit takes the same roster fence before node/task guards.
func DeleteAllPingRecords ¶
func DeleteAllPingRecords() error
func DeletePingRecords ¶
func DeletePingTask ¶
func EditPingTasksPinnedDraft ¶ added in v1.7.30
func EditPingTasksPinnedDraft(ctx context.Context, db *gorm.DB, edits []PingTaskEdit, reload func() error) error
EditPingTasksPinnedDraft accepts an explicit DB and scheduler for isolated tests.
func GetAllPingTasks ¶
func GetAllTasks ¶
func GetPingRecords ¶
func GetPingRecordsBatch ¶ added in v0.1.16
func GetPingRecordsBatch(uuids []string, taskId int, start, end time.Time) (map[string][]models.PingRecord, error)
GetPingRecordsBatch 一次查询取回多个节点的 ping 记录(见 metricstore 里的说明)。
func GetPingTasksByClient ¶
GetPingTasksByClient 获取指定服务器需要执行的延迟监测任务。
func GetSpecificTaskResult ¶
func GetSpecificTaskResult(taskId, clientId string) (*models.TaskResult, error)
func GetTaskResultsByTaskId ¶
func GetTaskResultsByTaskId(taskId string) ([]models.TaskResult, error)
func PingScheduleReloadPending ¶ added in v1.7.30
func PingScheduleReloadPending() bool
PingScheduleReloadPending reports whether the last complete reload failed. It does not prove individual probes are executing successfully.
func ReconcilePingDeletions ¶ added in v1.7.30
ReconcilePingDeletions retries a bounded batch after a crash or failed metric cleanup. All supported task creation paths must reject reserved IDs.
func ReconcilePingSchedule ¶ added in v1.7.30
ReconcilePingSchedule retries a failed reload without disturbing healthy timers. Startup performs an ordinary reload, so a restart cannot clear a failure without attempting to load the persisted configuration again.
func ReloadPingSchedule ¶
func ReloadPingSchedule() error
func SaveTaskResult ¶
func SaveTaskResultContext ¶ added in v1.7.0
func UpdatePingTaskOrder ¶
Types ¶
type PingDeletionPendingError ¶ added in v1.7.30
type PingDeletionPendingError struct{ Err error }
PingDeletionPendingError means the tasks are already deleted. Their IDs remain reserved after historical metric cleanup or schedule reload retries.
func (*PingDeletionPendingError) Error ¶ added in v1.7.30
func (e *PingDeletionPendingError) Error() string
func (*PingDeletionPendingError) Unwrap ¶ added in v1.7.30
func (e *PingDeletionPendingError) Unwrap() error
type PingTaskEdit ¶ added in v1.7.30
PingTaskEdit distinguishes omitted optional fields from explicit clears.
type PingTaskValidationError ¶ added in v1.7.30
type PingTaskValidationError struct{ Err error }
func (*PingTaskValidationError) Error ¶ added in v1.7.30
func (e *PingTaskValidationError) Error() string
func (*PingTaskValidationError) Unwrap ¶ added in v1.7.30
func (e *PingTaskValidationError) Unwrap() error
type ScheduleReloadPendingError ¶ added in v1.7.30
ScheduleReloadPendingError means the database mutation has already committed. Callers must not retry a create blindly: TaskID identifies the saved task, while the schedule still needs reconciliation.
func (*ScheduleReloadPendingError) Error ¶ added in v1.7.30
func (e *ScheduleReloadPendingError) Error() string
func (*ScheduleReloadPendingError) Unwrap ¶ added in v1.7.30
func (e *ScheduleReloadPendingError) Unwrap() error