confirm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package confirm implements ports.Confirm using files on disk. Plan, lock, and blocker are all file-based for crash safety and cross-process visibility.

Index

Constants

This section is empty.

Variables

View Source
var ErrOperationInProgress = &confirmError{"another operation is in progress"}

Functions

func ReviewConfig

func ReviewConfig(baseCfg config.CommitConfig) config.CommitConfig

ReviewConfig returns a CommitConfig suitable for review operations. Uses separate file paths to avoid conflicts with commit operations.

Types

type Adapter

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

Adapter implements ports.Confirm. All paths and TTL come from config — nothing hardcoded.

func New

func New(workDir string, cfg config.CommitConfig) *Adapter

New creates a Confirm Adapter from config.

func (*Adapter) AcquireLock

func (a *Adapter) AcquireLock() error

AcquireLock creates the lock file. Returns error if already locked.

func (*Adapter) CreateBlocker

func (a *Adapter) CreateBlocker() error

CreateBlocker creates the blocker file to prevent execution until approval.

func (*Adapter) DeletePlan

func (a *Adapter) DeletePlan() error

DeletePlan removes the plan file and the blocker.

func (*Adapter) HasBlocker

func (a *Adapter) HasBlocker() bool

HasBlocker returns true if the blocker file exists.

func (*Adapter) IsPlanExpired

func (a *Adapter) IsPlanExpired() bool

IsPlanExpired returns true if the plan is older than the configured TTL.

func (*Adapter) ReadPlan

func (a *Adapter) ReadPlan() (*domain.OperationPlan, error)

ReadPlan reads the persisted operation plan.

func (*Adapter) ReleaseLock

func (a *Adapter) ReleaseLock() error

ReleaseLock removes the lock file (idempotent).

func (*Adapter) RemoveBlocker

func (a *Adapter) RemoveBlocker() error

RemoveBlocker removes the blocker file (idempotent).

func (*Adapter) WritePlan

func (a *Adapter) WritePlan(plan domain.OperationPlan) error

WritePlan persists an operation plan to disk atomically.

type InMemoryConfirm

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

func NewInMemory

func NewInMemory(ttl time.Duration) *InMemoryConfirm

func (*InMemoryConfirm) AcquireLock

func (a *InMemoryConfirm) AcquireLock() error

func (*InMemoryConfirm) CreateBlocker

func (a *InMemoryConfirm) CreateBlocker() error

func (*InMemoryConfirm) DeletePlan

func (a *InMemoryConfirm) DeletePlan() error

func (*InMemoryConfirm) HasBlocker

func (a *InMemoryConfirm) HasBlocker() bool

func (*InMemoryConfirm) IsPlanExpired

func (a *InMemoryConfirm) IsPlanExpired() bool

func (*InMemoryConfirm) ReadPlan

func (a *InMemoryConfirm) ReadPlan() (*domain.OperationPlan, error)

func (*InMemoryConfirm) ReleaseLock

func (a *InMemoryConfirm) ReleaseLock() error

func (*InMemoryConfirm) RemoveBlocker

func (a *InMemoryConfirm) RemoveBlocker() error

func (*InMemoryConfirm) WritePlan

func (a *InMemoryConfirm) WritePlan(plan domain.OperationPlan) error

Jump to

Keyboard shortcuts

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