ledger

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ledger records what workers and producers did, one JSON object per line, so the invariant and chaos tests can check it against the database. Each record is written with a single write call on an O_APPEND file: a process killed with SIGKILL loses at most the record it was writing, never one already written (the data is in the kernel's page cache).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enqueued

type Enqueued struct {
	Key   string `json:"key"`
	JobID int64  `json:"job_id"`
}

func ReadEnqueued

func ReadEnqueued(dir string) ([]Enqueued, error)

type Run

type Run struct {
	Worker  string    `json:"worker"`
	JobID   int64     `json:"job_id"`
	Attempt int       `json:"attempt"`
	Start   time.Time `json:"start"`
	End     time.Time `json:"end"`
	Outcome string    `json:"outcome"`
	Err     string    `json:"err,omitempty"`
}

func ReadRuns

func ReadRuns(dir string) ([]Run, error)

func RunFromResult

func RunFromResult(worker string, r tasklane.Result) Run

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func Open

func Open(path string) (*Writer, error)

Open appends to path, creating it if needed. If a killed process left a torn last line (no trailing newline), Open ends that line first, so the next record starts on its own line instead of being glued onto the fragment.

func (*Writer) Append

func (w *Writer) Append(v any) error

Append writes v as one line with one write call.

func (*Writer) Close

func (w *Writer) Close() error

Jump to

Keyboard shortcuts

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