storage

package
v0.0.0-...-b6cf1f4 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateID

func GenerateID(commitSHA string, ts time.Time) string

GenerateID builds a human-readable snapshot ID combining the snapshot commit prefix and a base-36 encoded timestamp for chronological sorting.

Types

type Snapshot

type Snapshot struct {
	ID                        string    `json:"id"`                          // Unique identifier
	CommitSHA                 string    `json:"commit_sha"`                  // Ghost commit SHA
	ParentSHA                 string    `json:"parent_sha"`                  // Parent commit SHA (HEAD at snapshot time)
	Message                   string    `json:"message"`                     // Snapshot message
	Timestamp                 time.Time `json:"timestamp"`                   // When snapshot was created
	RepoRoot                  string    `json:"repo_root"`                   // Repository root path
	PreexistingUntrackedFiles []string  `json:"preexisting_untracked_files"` // Untracked files before snapshot
	PreexistingUntrackedDirs  []string  `json:"preexisting_untracked_dirs"`  // Untracked dirs before snapshot
}

Snapshot represents a stored ghost commit

type SnapshotStore

type SnapshotStore struct {
	StorageDir string
	// contains filtered or unexported fields
}

SnapshotStore manages snapshot persistence

func NewSnapshotStore

func NewSnapshotStore() (*SnapshotStore, error)

NewSnapshotStore creates a new snapshot store

func (*SnapshotStore) AddSnapshot

func (s *SnapshotStore) AddSnapshot(snapshot Snapshot) error

AddSnapshot adds a new snapshot scoped to its repository

func (*SnapshotStore) DeleteSnapshot

func (s *SnapshotStore) DeleteSnapshot(repoRoot, id string) error

DeleteSnapshot removes a snapshot by ID within the repo

func (*SnapshotStore) GetSnapshot

func (s *SnapshotStore) GetSnapshot(identifier, repoRoot string) (*Snapshot, error)

GetSnapshot retrieves a snapshot by ID or repo-scoped index (1-based for user convenience)

func (*SnapshotStore) GetSnapshotByCommit

func (s *SnapshotStore) GetSnapshotByCommit(repoRoot, commit string) (*Snapshot, error)

GetSnapshotByCommit finds a snapshot for the repo by commit SHA (prefix allowed).

func (*SnapshotStore) ListSnapshots

func (s *SnapshotStore) ListSnapshots(repoRoot string) ([]Snapshot, error)

ListSnapshots returns all snapshots for a specific repository

func (*SnapshotStore) LoadSnapshots

func (s *SnapshotStore) LoadSnapshots() ([]Snapshot, error)

LoadSnapshots loads all snapshots from all repositories

Jump to

Keyboard shortcuts

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