rollback

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeginOptions

type BeginOptions struct {
	Workspace string
	SessionID string
	TaskID    string
	TraceID   string
	ToolName  string
	Actor     string
}

type FileChange

type FileChange struct {
	Path             string `json:"path"`
	AbsPath          string `json:"abs_path,omitempty"`
	NewPath          string `json:"new_path,omitempty"`
	NewAbsPath       string `json:"new_abs_path,omitempty"`
	OpType           OpType `json:"op_type"`
	FileAbsentBefore bool   `json:"file_absent_before,omitempty"`
	FileAbsentAfter  bool   `json:"file_absent_after,omitempty"`
	BeforeHash       string `json:"before_hash,omitempty"`
	AfterHash        string `json:"after_hash,omitempty"`
	BeforeSnapshot   string `json:"before_snapshot,omitempty"`
	SizeBytes        int64  `json:"size_bytes,omitempty"`
}

type FileTarget

type FileTarget struct {
	Path       string
	AbsPath    string
	NewPath    string
	NewAbsPath string
	OpType     OpType
}

type OpType

type OpType string
const (
	OpTypeAdd    OpType = "add"
	OpTypeUpdate OpType = "update"
	OpTypeDelete OpType = "delete"
	OpTypeMove   OpType = "move"
)

type Operation

type Operation struct {
	OperationID      string       `json:"operation_id"`
	SessionID        string       `json:"session_id,omitempty"`
	TaskID           string       `json:"task_id,omitempty"`
	TraceID          string       `json:"trace_id,omitempty"`
	Workspace        string       `json:"workspace"`
	ToolName         string       `json:"tool_name"`
	Actor            string       `json:"actor,omitempty"`
	CreatedAt        time.Time    `json:"created_at"`
	UpdatedAt        time.Time    `json:"updated_at"`
	Status           Status       `json:"status"`
	AffectedFiles    []FileChange `json:"affected_files"`
	RollbackAttempts int          `json:"rollback_attempts"`
	LastError        string       `json:"last_error,omitempty"`
}

type Status

type Status string
const (
	StatusPending        Status = "pending"
	StatusCommitted      Status = "committed"
	StatusRolledBack     Status = "rolled_back"
	StatusRollbackFailed Status = "rollback_failed"
	StatusAborted        Status = "aborted"
)

type Store

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

func NewDefaultStore

func NewDefaultStore() (*Store, error)

func NewStore

func NewStore(root string) (*Store, error)

func (*Store) Abort

func (s *Store) Abort(ctx context.Context, op *Operation, reason string) error

func (*Store) AbortAndRestore

func (s *Store) AbortAndRestore(ctx context.Context, op *Operation, reason string, writableRoots ...string) error

func (*Store) Begin

func (s *Store) Begin(ctx context.Context, opts BeginOptions, targets []FileTarget) (*Operation, error)

func (*Store) Commit

func (s *Store) Commit(ctx context.Context, op *Operation) error

func (*Store) ListRecent

func (s *Store) ListRecent(ctx context.Context, workspace string, limit int) ([]Operation, error)

func (*Store) Rollback

func (s *Store) Rollback(ctx context.Context, workspace, operationID string, writableRoots ...string) (*Operation, error)

func (*Store) RollbackLast

func (s *Store) RollbackLast(ctx context.Context, workspace string, writableRoots ...string) (*Operation, error)

Jump to

Keyboard shortcuts

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