heartbeat

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package heartbeat writes live phase execution progress to a status file on disk so long-running operations (such as Ansible modules) can be monitored externally in real-time.

Index

Constants

View Source
const EnvStatusFile = "CARGOSHIP_STATUS_FILE"

EnvStatusFile defines an optional environment variable specifying the path to write heartbeat status.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear removes the status file after successful execution.

func Init

func Init(path string)

Init initializes the heartbeat file target.

func Update

func Update(phase string, index, total int, state string, err error)

Update writes the current phase progress to the status file if configured.

Types

type Status

type Status struct {
	Phase     string    `json:"phase"`
	Index     int       `json:"index"`
	Total     int       `json:"total"`
	Status    string    `json:"status"` // "running", "completed", "failed"
	Timestamp time.Time `json:"timestamp"`
	Error     string    `json:"error,omitempty"`
}

Status holds the real-time progress of a phase run.

Jump to

Keyboard shortcuts

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