Documentation
¶
Index ¶
- func DeriveRunnerID() string
- type Backend
- type ClaimResult
- type FileStateBackend
- func (f *FileStateBackend) AppendStepLog(_ context.Context, _, _, _ string) error
- func (f *FileStateBackend) ClaimJob(_ context.Context, _ string, _ model.PlanJob, _ string) (*ClaimResult, error)
- func (f *FileStateBackend) Close(_ context.Context) error
- func (f *FileStateBackend) Heartbeat(_ context.Context, _, _, _ string) (*HeartbeatResult, error)
- func (f *FileStateBackend) InitRun(_ context.Context, plan *model.Plan, opts InitRunOptions) (*RunHandle, error)
- func (f *FileStateBackend) LoadRunState(_ context.Context, runID string) (*state.ExecState, *state.ExecMetadata, error)
- func (f *FileStateBackend) ReadJobLog(_ context.Context, runID string, jobID string) (string, error)
- func (f *FileStateBackend) RunnableJobs(_ context.Context, _ string) ([]string, error)
- func (f *FileStateBackend) UpdateJob(_ context.Context, _, _, _ string, _ JobStatus, _ string) error
- type HeartbeatResult
- type InitRunOptions
- type JobStatus
- type RemoteStateBackend
- func (r *RemoteStateBackend) AppendStepLog(ctx context.Context, runID string, jobID string, content string) error
- func (r *RemoteStateBackend) ClaimJob(ctx context.Context, runID string, job model.PlanJob, runnerID string) (*ClaimResult, error)
- func (r *RemoteStateBackend) Close(_ context.Context) error
- func (r *RemoteStateBackend) Heartbeat(ctx context.Context, runID string, jobID string, runnerID string) (*HeartbeatResult, error)
- func (r *RemoteStateBackend) InitRun(ctx context.Context, plan *model.Plan, opts InitRunOptions) (*RunHandle, error)
- func (r *RemoteStateBackend) LoadRunState(ctx context.Context, runID string) (*state.ExecState, *state.ExecMetadata, error)
- func (r *RemoteStateBackend) ReadJobLog(ctx context.Context, runID string, jobID string) (string, error)
- func (r *RemoteStateBackend) RunnableJobs(ctx context.Context, runID string) ([]string, error)
- func (r *RemoteStateBackend) UpdateJob(ctx context.Context, runID string, jobID string, runnerID string, ...) error
- type RunHandle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveRunnerID ¶
func DeriveRunnerID() string
DeriveRunnerID builds a stable runner identifier from the environment. In GitHub Actions it includes the GITHUB_JOB and GITHUB_RUN_ID so that concurrent matrix jobs have distinct identifiers.
Types ¶
type Backend ¶
type Backend interface {
// InitRun creates or joins a run for the given plan. Returns the run handle.
InitRun(ctx context.Context, plan *model.Plan, opts InitRunOptions) (*RunHandle, error)
// ClaimJob attempts to claim a job for this runner. The caller must inspect
// ClaimResult to decide whether to execute, wait, or exit.
ClaimJob(ctx context.Context, runID string, job model.PlanJob, runnerID string) (*ClaimResult, error)
// Heartbeat signals that the runner is still alive for the given job.
Heartbeat(ctx context.Context, runID string, jobID string, runnerID string) (*HeartbeatResult, error)
// UpdateJob sends the terminal status for a job.
UpdateJob(ctx context.Context, runID string, jobID string, runnerID string, status JobStatus, errText string) error
// AppendStepLog appends step output to the job-level log.
AppendStepLog(ctx context.Context, runID string, jobID string, content string) error
// RunnableJobs returns the list of job IDs that are currently runnable for the given run.
RunnableJobs(ctx context.Context, runID string) ([]string, error)
// LoadRunState reads run state for display (status/logs commands).
LoadRunState(ctx context.Context, runID string) (*state.ExecState, *state.ExecMetadata, error)
// ReadJobLog retrieves the combined log for a job.
ReadJobLog(ctx context.Context, runID string, jobID string) (string, error)
// Close releases any resources held by the backend.
Close(ctx context.Context) error
}
Backend is the state backend seam. Local filesystem state and remote HTTP state each implement this interface so the runner and commands can use either without embedding transport details.
type ClaimResult ¶
type ClaimResult struct {
Claimed bool
Takeover bool
CurrentStatus string // backend job status when not claimed
DepsWaiting bool
DepsBlocked bool
}
ClaimResult describes the outcome of a ClaimJob call.
type FileStateBackend ¶
FileStateBackend implements Backend using the local .orun/ filesystem store. It is a thin adapter so that status and logs commands can use the same interface regardless of whether remote state is active.
func NewFileStateBackend ¶
func NewFileStateBackend(store *state.Store) *FileStateBackend
NewFileStateBackend wraps an existing state.Store.
func (*FileStateBackend) AppendStepLog ¶
func (f *FileStateBackend) AppendStepLog(_ context.Context, _, _, _ string) error
AppendStepLog is a no-op locally — the runner writes logs via writeStepLog.
func (*FileStateBackend) ClaimJob ¶
func (f *FileStateBackend) ClaimJob(_ context.Context, _ string, _ model.PlanJob, _ string) (*ClaimResult, error)
ClaimJob always succeeds locally — there is no concurrent runner to compete with.
func (*FileStateBackend) Heartbeat ¶
func (f *FileStateBackend) Heartbeat(_ context.Context, _, _, _ string) (*HeartbeatResult, error)
Heartbeat is a no-op locally.
func (*FileStateBackend) InitRun ¶
func (f *FileStateBackend) InitRun(_ context.Context, plan *model.Plan, opts InitRunOptions) (*RunHandle, error)
func (*FileStateBackend) LoadRunState ¶
func (f *FileStateBackend) LoadRunState(_ context.Context, runID string) (*state.ExecState, *state.ExecMetadata, error)
func (*FileStateBackend) ReadJobLog ¶
func (f *FileStateBackend) ReadJobLog(_ context.Context, runID string, jobID string) (string, error)
ReadJobLog concatenates all per-step log files for the given job.
func (*FileStateBackend) RunnableJobs ¶
RunnableJobs is a no-op locally — all jobs are considered runnable.
type HeartbeatResult ¶
type HeartbeatResult struct {
OK bool
}
HeartbeatResult is returned by Heartbeat.
type InitRunOptions ¶
InitRunOptions carries options for InitRun.
type RemoteStateBackend ¶
type RemoteStateBackend struct {
// contains filtered or unexported fields
}
RemoteStateBackend implements Backend using the orun-backend HTTP API.
func NewRemoteStateBackend ¶
func NewRemoteStateBackend(client *remotestate.Client, runnerID string) *RemoteStateBackend
NewRemoteStateBackend creates a RemoteStateBackend with the given HTTP client and runner identifier. runnerID should be unique per runner instance.
func (*RemoteStateBackend) AppendStepLog ¶
func (*RemoteStateBackend) ClaimJob ¶
func (r *RemoteStateBackend) ClaimJob(ctx context.Context, runID string, job model.PlanJob, runnerID string) (*ClaimResult, error)
func (*RemoteStateBackend) Heartbeat ¶
func (r *RemoteStateBackend) Heartbeat(ctx context.Context, runID string, jobID string, runnerID string) (*HeartbeatResult, error)
func (*RemoteStateBackend) InitRun ¶
func (r *RemoteStateBackend) InitRun(ctx context.Context, plan *model.Plan, opts InitRunOptions) (*RunHandle, error)
func (*RemoteStateBackend) LoadRunState ¶
func (r *RemoteStateBackend) LoadRunState(ctx context.Context, runID string) (*state.ExecState, *state.ExecMetadata, error)