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 ¶
- Variables
- func ReviewConfig(baseCfg config.CommitConfig) config.CommitConfig
- type Adapter
- func (a *Adapter) AcquireLock() error
- func (a *Adapter) CreateBlocker() error
- func (a *Adapter) DeletePlan() error
- func (a *Adapter) HasBlocker() bool
- func (a *Adapter) IsPlanExpired() bool
- func (a *Adapter) ReadPlan() (*domain.OperationPlan, error)
- func (a *Adapter) ReleaseLock() error
- func (a *Adapter) RemoveBlocker() error
- func (a *Adapter) WritePlan(plan domain.OperationPlan) error
- type InMemoryConfirm
- func (a *InMemoryConfirm) AcquireLock() error
- func (a *InMemoryConfirm) CreateBlocker() error
- func (a *InMemoryConfirm) DeletePlan() error
- func (a *InMemoryConfirm) HasBlocker() bool
- func (a *InMemoryConfirm) IsPlanExpired() bool
- func (a *InMemoryConfirm) ReadPlan() (*domain.OperationPlan, error)
- func (a *InMemoryConfirm) ReleaseLock() error
- func (a *InMemoryConfirm) RemoveBlocker() error
- func (a *InMemoryConfirm) WritePlan(plan domain.OperationPlan) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
AcquireLock creates the lock file. Returns error if already locked.
func (*Adapter) CreateBlocker ¶
CreateBlocker creates the blocker file to prevent execution until approval.
func (*Adapter) DeletePlan ¶
DeletePlan removes the plan file and the blocker.
func (*Adapter) HasBlocker ¶
HasBlocker returns true if the blocker file exists.
func (*Adapter) IsPlanExpired ¶
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 ¶
ReleaseLock removes the lock file (idempotent).
func (*Adapter) RemoveBlocker ¶
RemoveBlocker removes the blocker file (idempotent).
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