Documentation
¶
Index ¶
- Constants
- func DeregisterStore(storeID primitives.StoreID) error
- func EnsureGitignoreEntry(root primitives.WorkspaceRoot) (string, bool, error)
- func FindRoot(start string) (primitives.WorkspaceRoot, error)
- func RegistryPath() (string, error)
- func StateDir() (string, error)
- func StoreExists(storePath string) bool
- type BootstrapOptions
- type BootstrapResult
- type Checkpoint
- type CheckpointJournal
- type CheckpointRefInfo
- type DiffFileChange
- type DiffFileStat
- type DiffSummary
- type ImportedRef
- type LimitedDiff
- type MaterializeOptions
- type RegisteredStore
- type RegisteredWorktree
- type RekeyResult
- type Repo
- func Init(root primitives.WorkspaceRoot) (*Repo, error)
- func InitAt(root primitives.WorkspaceRoot, metadataDir string) (*Repo, error)
- func Open(root primitives.WorkspaceRoot) (*Repo, error)
- func OpenAt(root primitives.WorkspaceRoot, metadataDir string) (*Repo, error)
- func OpenAtReadOnly(root primitives.WorkspaceRoot, metadataDir string) (*Repo, error)
- func OpenReadOnly(root primitives.WorkspaceRoot) (*Repo, error)
- func (repo *Repo) BeginCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, ...) error
- func (repo *Repo) CheckpointCommit(ref primitives.CheckpointRef) (primitives.CommitSHA, error)
- func (repo *Repo) CheckpointJournalPath(sessionID primitives.SessionID, turnID primitives.TurnID, ...) (string, error)
- func (repo *Repo) CheckpointRefFor(sessionID primitives.SessionID, turnID primitives.TurnID, ...) (primitives.CheckpointRef, error)
- func (repo *Repo) ClearCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, ...) error
- func (repo *Repo) ClearImportStaging(importID primitives.ImportID) error
- func (repo *Repo) CommitFileBytes(commit primitives.CommitSHA, repoPath string) ([]byte, error)
- func (repo *Repo) CommitFileBytesIfExists(commit primitives.CommitSHA, repoPath string) ([]byte, bool, error)
- func (repo *Repo) CreateCheckpoint(sessionID primitives.SessionID, turnID primitives.TurnID, ...) (Checkpoint, error)
- func (repo *Repo) CreateCheckpointLocked(sessionID primitives.SessionID, turnID primitives.TurnID, ...) (Checkpoint, error)
- func (repo *Repo) CreateManualCheckpoint() (Checkpoint, error)
- func (repo *Repo) CreateManualCheckpointLocked() (Checkpoint, error)
- func (repo *Repo) CreateSnapshotRef(ref string, message string) (Snapshot, error)
- func (repo *Repo) CreateSnapshotRefIfAbsentLocked(ref string, message string) (Snapshot, error)
- func (repo *Repo) CreateSnapshotRefLocked(ref string, message string) (Snapshot, error)
- func (repo *Repo) CreateSyntheticSnapshotRef(ref string, message string, entries []SyntheticTreeEntry) (Snapshot, error)
- func (repo *Repo) CreateSyntheticSnapshotRefLocked(ref string, message string, entries []SyntheticTreeEntry) (Snapshot, error)
- func (repo *Repo) DeleteCheckpointRef(ref primitives.CheckpointRef) error
- func (repo *Repo) DeleteCheckpointRefLocked(ref primitives.CheckpointRef) error
- func (repo *Repo) DeletePrivateRef(ref string) error
- func (repo *Repo) DeletePrivateRefLocked(ref string) error
- func (repo *Repo) DiffCommitToWorkspace(commit primitives.CommitSHA) ([]byte, error)
- func (repo *Repo) DiffCommitsPathWithRenames(preCommit, postCommit primitives.CommitSHA, prePath, postPath string) ([]byte, error)
- func (repo *Repo) DiffNameStatusCommits(preCommit, postCommit primitives.CommitSHA) ([]DiffFileChange, error)
- func (repo *Repo) DiffNameStatusRefs(preRef, postRef primitives.CheckpointRef) ([]DiffFileChange, error)
- func (repo *Repo) DiffRefs(preRef, postRef primitives.CheckpointRef) ([]byte, error)
- func (repo *Repo) DiffRefsPath(preRef, postRef primitives.CheckpointRef, repoPath string) ([]byte, error)
- func (repo *Repo) DiffRefsPathLimited(ctx context.Context, preRef, postRef primitives.CheckpointRef, repoPath string, ...) (LimitedDiff, error)
- func (repo *Repo) DiffRefsPathWithRenames(preRef, postRef primitives.CheckpointRef, prePath, postPath string) ([]byte, error)
- func (repo *Repo) DiffStatRefs(preRef, postRef primitives.CheckpointRef) (DiffSummary, error)
- func (repo *Repo) DiffStatTurn(sessionID primitives.SessionID, turnID primitives.TurnID) (DiffSummary, error)
- func (repo *Repo) DiffTurn(sessionID primitives.SessionID, turnID primitives.TurnID) ([]byte, error)
- func (repo *Repo) EnsureCanonicalCheckpointRef(checkpointID primitives.CheckpointID, commit primitives.CommitSHA) (primitives.CheckpointRef, error)
- func (repo *Repo) EnsureImportedCheckpointAlias(ref primitives.CheckpointRef, commit primitives.CommitSHA) error
- func (repo *Repo) EventLog() eventlog.Log
- func (repo *Repo) FinalizeCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, ...) error
- func (repo *Repo) FindCheckpointIDPrefix(prefix string) ([]CheckpointRefInfo, error)
- func (repo *Repo) FindCheckpointTargets(sessionID primitives.SessionID, turnID primitives.TurnID, ...) ([]CheckpointRefInfo, error)
- func (repo *Repo) ForCaptureRoot(root string) (*Repo, error)
- func (repo *Repo) GitSyncRefFor(sessionID primitives.SessionID, turnID primitives.TurnID, ...) (string, error)
- func (repo *Repo) HasCommit(commit primitives.CommitSHA) error
- func (repo *Repo) HiddenGitBare() (bool, error)
- func (repo *Repo) Identity() StoreIdentity
- func (repo *Repo) ListAllCheckpointRefInfos() ([]CheckpointRefInfo, error)
- func (repo *Repo) ListAllPrivateRefs() ([]string, error)
- func (repo *Repo) ListCheckpointJournals() ([]CheckpointJournal, error)
- func (repo *Repo) ListCheckpointRefInfos(sessionID primitives.SessionID) ([]CheckpointRefInfo, error)
- func (repo *Repo) ListCheckpointRefs(sessionID primitives.SessionID) ([]primitives.CheckpointRef, error)
- func (repo *Repo) ListCommitTree(commit primitives.CommitSHA) ([]TreeEntry, error)
- func (repo *Repo) ListPrivateRefs(prefix string) ([]string, error)
- func (repo *Repo) ListWorktrees() ([]WorktreeIdentity, error)
- func (repo *Repo) MarkCheckpointJournalCommitted(sessionID primitives.SessionID, turnID primitives.TurnID, ...) error
- func (repo *Repo) MarkCheckpointJournalGitSync(sessionID primitives.SessionID, turnID primitives.TurnID, ...) error
- func (repo *Repo) MaterializeCommit(commit primitives.CommitSHA, root string, options MaterializeOptions) error
- func (repo *Repo) PlanRestoreCommit(commit primitives.CommitSHA) (RestorePlan, error)
- func (repo *Repo) PreflightRestoreCommit(commit primitives.CommitSHA) error
- func (repo *Repo) PromoteImportedRefs(refs []ImportedRef) error
- func (repo *Repo) PruneModeManifests() ([]string, error)
- func (repo *Repo) PruneModeManifestsLocked() ([]string, error)
- func (repo *Repo) ReadCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, ...) (CheckpointJournal, bool, error)
- func (repo *Repo) RefCommit(ref string) (primitives.CommitSHA, error)
- func (repo *Repo) RegisterStore() error
- func (repo *Repo) RekeyStore() (RekeyResult, error)
- func (repo *Repo) RepairRegistration() error
- func (repo *Repo) RestoreCheckpoint(ref primitives.CheckpointRef) error
- func (repo *Repo) RestoreCommit(commit primitives.CommitSHA) error
- func (repo *Repo) RestoreCommitLocked(commit primitives.CommitSHA) error
- func (repo *Repo) RunHiddenGitGC() error
- func (repo *Repo) StageImportRefs(sourceGitDir string, sourceStoreID primitives.StoreID, ...) ([]ImportedRef, error)
- func (repo *Repo) StreamID(sessionID primitives.SessionID) (primitives.EventStreamID, error)
- func (repo *Repo) ValidateCommit(commit primitives.CommitSHA) error
- func (repo *Repo) WithWorkspaceLock(operation string, fn func() error) error
- func (repo *Repo) WorkspaceLockHeld() bool
- func (repo *Repo) WorkspaceLockPath() string
- func (repo *Repo) WorkspaceLockStatus() (bool, error)
- func (repo *Repo) WorktreeIdentity() WorktreeIdentity
- type RestoreAction
- type RestoreChange
- type RestorePlan
- type Snapshot
- type Status
- type StoreIdentity
- type SyntheticTreeEntry
- type TreeEntry
- type UserGitIdentity
- type WorktreeIdentity
Constants ¶
const GitignoreEntry = ".turnal/"
Variables ¶
This section is empty.
Functions ¶
func DeregisterStore ¶ added in v0.0.3
func DeregisterStore(storeID primitives.StoreID) error
DeregisterStore hides a store from the machine-wide project inventory. The retained entry lets linked worktrees keep resolving their shared store, but automatic opens cannot make the project visible again. An explicit RegisterStore clears the marker. No project files or history are deleted.
func EnsureGitignoreEntry ¶
func EnsureGitignoreEntry(root primitives.WorkspaceRoot) (string, bool, error)
func FindRoot ¶
func FindRoot(start string) (primitives.WorkspaceRoot, error)
func RegistryPath ¶ added in v0.0.3
RegistryPath returns the absolute path of the user-state registry file.
func StateDir ¶ added in v0.0.3
StateDir returns the directory holding machine-wide Turnal state, honoring TURNAL_STATE_DIR and XDG_STATE_HOME the same way the registry does.
func StoreExists ¶ added in v0.0.3
StoreExists reports whether a registered store still has its hidden Git directory on disk. A registered store whose path is gone is stale, not corrupt.
Types ¶
type BootstrapOptions ¶
func DefaultBootstrapOptions ¶
func DefaultBootstrapOptions() BootstrapOptions
type BootstrapResult ¶
func Bootstrap ¶
func Bootstrap(root primitives.WorkspaceRoot) (BootstrapResult, error)
func BootstrapWithOptions ¶
func BootstrapWithOptions(root primitives.WorkspaceRoot, opts BootstrapOptions) (BootstrapResult, error)
type Checkpoint ¶
type Checkpoint struct {
ID primitives.CheckpointID
Ref primitives.CheckpointRef
CanonicalRef primitives.CheckpointRef
Commit primitives.CommitSHA
CapturedAt time.Time
WorktreeID primitives.WorktreeID
StreamID primitives.EventStreamID
}
type CheckpointJournal ¶
type CheckpointJournal struct {
Version int `json:"version"`
State string `json:"state"`
StartedAt string `json:"started_at"`
UpdatedAt string `json:"updated_at"`
SessionID primitives.SessionID `json:"session_id"`
TurnID primitives.TurnID `json:"turn_id"`
Phase primitives.CheckpointPhase `json:"phase"`
Adapter primitives.AdapterName `json:"adapter,omitempty"`
RawRef string `json:"raw_ref,omitempty"`
WorktreeID primitives.WorktreeID `json:"worktree_id,omitempty"`
StreamID primitives.EventStreamID `json:"stream_id,omitempty"`
CheckpointID primitives.CheckpointID `json:"checkpoint_id,omitempty"`
Ref primitives.CheckpointRef `json:"ref,omitempty"`
CanonicalRef primitives.CheckpointRef `json:"canonical_ref,omitempty"`
CommitSHA primitives.CommitSHA `json:"commit_sha,omitempty"`
CapturedAt string `json:"captured_at,omitempty"`
GitSyncRef string `json:"git_sync_ref,omitempty"`
GitSyncCommitSHA string `json:"git_sync_commit_sha,omitempty"`
EventSeq primitives.EventSeq `json:"event_seq,omitempty"`
EventHash primitives.EventHash `json:"event_hash,omitempty"`
}
type CheckpointRefInfo ¶
type CheckpointRefInfo struct {
ID primitives.CheckpointID
Ref primitives.CheckpointRef
CanonicalRef primitives.CheckpointRef
SessionID primitives.SessionID
TurnID primitives.TurnID
Phase primitives.CheckpointPhase
HasPhase bool
WorktreeID primitives.WorktreeID
StreamID primitives.EventStreamID
Commit primitives.CommitSHA
Time time.Time
Manual bool
}
type DiffFileChange ¶
type DiffFileStat ¶
type DiffSummary ¶
type DiffSummary struct {
Files []DiffFileStat
Additions int
Deletions int
BinaryFiles int
}
type ImportedRef ¶
type ImportedRef struct {
OriginalRef string
StagingRef string
FinalRef string
Commit primitives.CommitSHA
}
func ListSourcePrivateRefs ¶
func ListSourcePrivateRefs(sourceGitDir string, sourceStoreID primitives.StoreID) ([]ImportedRef, error)
type LimitedDiff ¶ added in v0.0.3
LimitedDiff is a patch response that retains at most the requested number of bytes while still counting the complete Git output.
type MaterializeOptions ¶
type RegisteredStore ¶ added in v0.0.3
type RegisteredStore struct {
RepoID primitives.RepoID
StoreID primitives.StoreID
StorePath string
GitCommonDir string
Worktrees []RegisteredWorktree
}
RegisteredStore is one entry from the user-state registry that turnal init writes. It is the machine-wide answer to "which projects are recorded", and is what lets tooling enumerate stores without walking the filesystem.
func ListRegisteredStores ¶ added in v0.0.3
func ListRegisteredStores() ([]RegisteredStore, error)
ListRegisteredStores reports every store in the user-state registry, sorted by store path so output is stable. Entries whose store directory is missing are still returned: recorded history can outlive a deleted working tree, and silently dropping the entry would look like the history never existed. Callers decide how to present a store whose path no longer resolves.
func (RegisteredStore) PreferredRoot ¶ added in v0.0.3
func (store RegisteredStore) PreferredRoot() string
PreferredRoot selects a usable workspace binding for read-only project access. The primary worktree wins while it exists; otherwise a live linked worktree keeps the shared store accessible after another checkout is removed.
type RegisteredWorktree ¶ added in v0.0.3
RegisteredWorktree is one workspace attached to a store. A store always has at least one, and gains more when Git worktrees are linked.
type RekeyResult ¶
type RekeyResult struct {
OldStoreID primitives.StoreID
NewStoreID primitives.StoreID
Worktrees int
}
type Repo ¶
type Repo struct {
WorkspaceRoot primitives.WorkspaceRoot
MetadataDir string
GitDir string
TmpDir string
LockTimeout time.Duration
IdentityVersion int
RepoID primitives.RepoID
StoreID primitives.StoreID
WorktreeID primitives.WorktreeID
EventProducerID primitives.EventProducerID
GitObjectFormat string
GitTopLevel string
GitCommonDir string
UserGitDir string
PrimaryWorktree bool
ScopedRefs bool
}
func Init ¶
func Init(root primitives.WorkspaceRoot) (*Repo, error)
func InitAt ¶
func InitAt(root primitives.WorkspaceRoot, metadataDir string) (*Repo, error)
func Open ¶
func Open(root primitives.WorkspaceRoot) (*Repo, error)
func OpenAt ¶
func OpenAt(root primitives.WorkspaceRoot, metadataDir string) (*Repo, error)
func OpenAtReadOnly ¶
func OpenAtReadOnly(root primitives.WorkspaceRoot, metadataDir string) (*Repo, error)
OpenAtReadOnly loads an existing store and worktree binding without writing migrations or last-seen bookkeeping.
func OpenReadOnly ¶
func OpenReadOnly(root primitives.WorkspaceRoot) (*Repo, error)
OpenReadOnly opens an existing checkpoint store without refreshing identity, registry, permissions, hidden Git configuration, or other durable metadata.
func (*Repo) BeginCheckpointJournal ¶
func (repo *Repo) BeginCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase, adapter primitives.AdapterName, rawRef string) error
func (*Repo) CheckpointCommit ¶
func (repo *Repo) CheckpointCommit(ref primitives.CheckpointRef) (primitives.CommitSHA, error)
func (*Repo) CheckpointJournalPath ¶
func (repo *Repo) CheckpointJournalPath(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) (string, error)
func (*Repo) CheckpointRefFor ¶
func (repo *Repo) CheckpointRefFor(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) (primitives.CheckpointRef, error)
func (*Repo) ClearCheckpointJournal ¶
func (repo *Repo) ClearCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) error
func (*Repo) ClearImportStaging ¶
func (repo *Repo) ClearImportStaging(importID primitives.ImportID) error
func (*Repo) CommitFileBytes ¶
func (*Repo) CommitFileBytesIfExists ¶
func (*Repo) CreateCheckpoint ¶
func (repo *Repo) CreateCheckpoint(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) (Checkpoint, error)
func (*Repo) CreateCheckpointLocked ¶
func (repo *Repo) CreateCheckpointLocked(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) (Checkpoint, error)
CreateCheckpointLocked captures a checkpoint while the caller holds the workspace lock.
func (*Repo) CreateManualCheckpoint ¶
func (repo *Repo) CreateManualCheckpoint() (Checkpoint, error)
CreateManualCheckpoint captures the current workspace without assigning the checkpoint to an agent session or turn.
func (*Repo) CreateManualCheckpointLocked ¶
func (repo *Repo) CreateManualCheckpointLocked() (Checkpoint, error)
CreateManualCheckpointLocked captures a manual checkpoint while the caller holds the workspace lock.
func (*Repo) CreateSnapshotRef ¶
func (*Repo) CreateSnapshotRefIfAbsentLocked ¶ added in v0.0.3
CreateSnapshotRefIfAbsentLocked reuses or creates a snapshot while the caller holds the workspace lock.
func (*Repo) CreateSnapshotRefLocked ¶
CreateSnapshotRefLocked creates a snapshot while the caller holds the workspace lock. It exists for compound operations that must remain atomic.
func (*Repo) CreateSyntheticSnapshotRef ¶
func (*Repo) CreateSyntheticSnapshotRefLocked ¶
func (repo *Repo) CreateSyntheticSnapshotRefLocked(ref string, message string, entries []SyntheticTreeEntry) (Snapshot, error)
CreateSyntheticSnapshotRefLocked creates a synthetic snapshot while the caller holds the workspace lock.
func (*Repo) DeleteCheckpointRef ¶
func (repo *Repo) DeleteCheckpointRef(ref primitives.CheckpointRef) error
func (*Repo) DeleteCheckpointRefLocked ¶
func (repo *Repo) DeleteCheckpointRefLocked(ref primitives.CheckpointRef) error
DeleteCheckpointRefLocked deletes a checkpoint ref while the caller holds the workspace lock.
func (*Repo) DeletePrivateRef ¶
func (*Repo) DeletePrivateRefLocked ¶
DeletePrivateRefLocked deletes a private ref while the caller holds the workspace lock.
func (*Repo) DiffCommitToWorkspace ¶
func (repo *Repo) DiffCommitToWorkspace(commit primitives.CommitSHA) ([]byte, error)
func (*Repo) DiffCommitsPathWithRenames ¶ added in v0.0.3
func (repo *Repo) DiffCommitsPathWithRenames(preCommit, postCommit primitives.CommitSHA, prePath, postPath string) ([]byte, error)
DiffCommitsPathWithRenames returns a zero-context patch between two durable snapshots while following a rename of the selected file.
func (*Repo) DiffNameStatusCommits ¶ added in v0.0.3
func (repo *Repo) DiffNameStatusCommits(preCommit, postCommit primitives.CommitSHA) ([]DiffFileChange, error)
func (*Repo) DiffNameStatusRefs ¶
func (repo *Repo) DiffNameStatusRefs(preRef, postRef primitives.CheckpointRef) ([]DiffFileChange, error)
func (*Repo) DiffRefs ¶
func (repo *Repo) DiffRefs(preRef, postRef primitives.CheckpointRef) ([]byte, error)
func (*Repo) DiffRefsPath ¶
func (repo *Repo) DiffRefsPath(preRef, postRef primitives.CheckpointRef, repoPath string) ([]byte, error)
func (*Repo) DiffRefsPathLimited ¶ added in v0.0.3
func (repo *Repo) DiffRefsPathLimited(ctx context.Context, preRef, postRef primitives.CheckpointRef, repoPath string, maxBytes int) (LimitedDiff, error)
DiffRefsPathLimited streams a path-scoped patch without buffering more than maxBytes. A non-positive limit retains the complete output.
func (*Repo) DiffRefsPathWithRenames ¶
func (repo *Repo) DiffRefsPathWithRenames(preRef, postRef primitives.CheckpointRef, prePath, postPath string) ([]byte, error)
func (*Repo) DiffStatRefs ¶
func (repo *Repo) DiffStatRefs(preRef, postRef primitives.CheckpointRef) (DiffSummary, error)
func (*Repo) DiffStatTurn ¶
func (repo *Repo) DiffStatTurn(sessionID primitives.SessionID, turnID primitives.TurnID) (DiffSummary, error)
func (*Repo) DiffTurn ¶
func (repo *Repo) DiffTurn(sessionID primitives.SessionID, turnID primitives.TurnID) ([]byte, error)
func (*Repo) EnsureCanonicalCheckpointRef ¶
func (repo *Repo) EnsureCanonicalCheckpointRef(checkpointID primitives.CheckpointID, commit primitives.CommitSHA) (primitives.CheckpointRef, error)
func (*Repo) EnsureImportedCheckpointAlias ¶
func (repo *Repo) EnsureImportedCheckpointAlias(ref primitives.CheckpointRef, commit primitives.CommitSHA) error
func (*Repo) FinalizeCheckpointJournal ¶
func (repo *Repo) FinalizeCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase, eventSeq primitives.EventSeq, eventHash primitives.EventHash) error
func (*Repo) FindCheckpointIDPrefix ¶
func (repo *Repo) FindCheckpointIDPrefix(prefix string) ([]CheckpointRefInfo, error)
func (*Repo) FindCheckpointTargets ¶
func (repo *Repo) FindCheckpointTargets(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) ([]CheckpointRefInfo, error)
func (*Repo) ForCaptureRoot ¶
ForCaptureRoot returns a repository view that snapshots root into this store while retaining the store's durable repository and worktree identity. It deliberately does not attach root as a Turnal worktree. This is used for short-lived, isolated execution directories whose files must become durable hidden-Git checkpoints in the originating store.
func (*Repo) GitSyncRefFor ¶
func (repo *Repo) GitSyncRefFor(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) (string, error)
func (*Repo) HiddenGitBare ¶
func (*Repo) Identity ¶
func (repo *Repo) Identity() StoreIdentity
func (*Repo) ListAllCheckpointRefInfos ¶
func (repo *Repo) ListAllCheckpointRefInfos() ([]CheckpointRefInfo, error)
func (*Repo) ListAllPrivateRefs ¶
func (*Repo) ListCheckpointJournals ¶
func (repo *Repo) ListCheckpointJournals() ([]CheckpointJournal, error)
func (*Repo) ListCheckpointRefInfos ¶
func (repo *Repo) ListCheckpointRefInfos(sessionID primitives.SessionID) ([]CheckpointRefInfo, error)
func (*Repo) ListCheckpointRefs ¶
func (repo *Repo) ListCheckpointRefs(sessionID primitives.SessionID) ([]primitives.CheckpointRef, error)
func (*Repo) ListCommitTree ¶
func (repo *Repo) ListCommitTree(commit primitives.CommitSHA) ([]TreeEntry, error)
func (*Repo) ListWorktrees ¶
func (repo *Repo) ListWorktrees() ([]WorktreeIdentity, error)
func (*Repo) MarkCheckpointJournalCommitted ¶
func (repo *Repo) MarkCheckpointJournalCommitted(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase, created Checkpoint) error
func (*Repo) MarkCheckpointJournalGitSync ¶
func (repo *Repo) MarkCheckpointJournalGitSync(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase, snapshot *Snapshot) error
func (*Repo) MaterializeCommit ¶
func (repo *Repo) MaterializeCommit(commit primitives.CommitSHA, root string, options MaterializeOptions) error
func (*Repo) PlanRestoreCommit ¶
func (repo *Repo) PlanRestoreCommit(commit primitives.CommitSHA) (RestorePlan, error)
func (*Repo) PreflightRestoreCommit ¶
func (repo *Repo) PreflightRestoreCommit(commit primitives.CommitSHA) error
PreflightRestoreCommit verifies every target object and the optional mode manifest before a caller records a destructive restore transition.
func (*Repo) PromoteImportedRefs ¶
func (repo *Repo) PromoteImportedRefs(refs []ImportedRef) error
func (*Repo) PruneModeManifests ¶
PruneModeManifests removes permission sidecars for commits no longer reachable from any hidden-repository ref.
func (*Repo) PruneModeManifestsLocked ¶
PruneModeManifestsLocked prunes sidecars while the caller holds the workspace lock.
func (*Repo) ReadCheckpointJournal ¶
func (repo *Repo) ReadCheckpointJournal(sessionID primitives.SessionID, turnID primitives.TurnID, phase primitives.CheckpointPhase) (CheckpointJournal, bool, error)
func (*Repo) RegisterStore ¶ added in v0.0.3
RegisterStore adds a store to the user-state registry explicitly.
Automatic registration during ensureIdentity only covers Git workspaces, because it keys stores by Git common dir. Turnal records non-Git directories too, and those projects must still appear in the machine-wide inventory, so callers that intentionally adopt a project (turnal init, the viewer's add flow) call this to cover both cases. It is idempotent.
func (*Repo) RekeyStore ¶
func (repo *Repo) RekeyStore() (RekeyResult, error)
func (*Repo) RepairRegistration ¶
func (*Repo) RestoreCheckpoint ¶
func (repo *Repo) RestoreCheckpoint(ref primitives.CheckpointRef) error
func (*Repo) RestoreCommit ¶
func (repo *Repo) RestoreCommit(commit primitives.CommitSHA) error
func (*Repo) RestoreCommitLocked ¶
func (repo *Repo) RestoreCommitLocked(commit primitives.CommitSHA) error
RestoreCommitLocked restores a checkpoint while the caller holds the workspace lock.
func (*Repo) RunHiddenGitGC ¶
func (*Repo) StageImportRefs ¶
func (repo *Repo) StageImportRefs(sourceGitDir string, sourceStoreID primitives.StoreID, importID primitives.ImportID) ([]ImportedRef, error)
func (*Repo) StreamID ¶
func (repo *Repo) StreamID(sessionID primitives.SessionID) (primitives.EventStreamID, error)
func (*Repo) ValidateCommit ¶ added in v0.0.3
func (repo *Repo) ValidateCommit(commit primitives.CommitSHA) error
ValidateCommit verifies that a captured commit still exists in the hidden repository without relying on the ref name that originally published it.
func (*Repo) WithWorkspaceLock ¶
func (*Repo) WorkspaceLockHeld ¶
func (*Repo) WorkspaceLockPath ¶
func (*Repo) WorkspaceLockStatus ¶
func (*Repo) WorktreeIdentity ¶
func (repo *Repo) WorktreeIdentity() WorktreeIdentity
type RestoreAction ¶
type RestoreAction string
const ( RestoreActionAdded RestoreAction = "added" RestoreActionModified RestoreAction = "modified" RestoreActionDeleted RestoreAction = "deleted" RestoreActionModeChanged RestoreAction = "mode-changed" )
type RestoreChange ¶
type RestoreChange struct {
Path string `json:"path"`
Action RestoreAction `json:"action"`
}
type RestorePlan ¶
type RestorePlan struct {
TargetCommit primitives.CommitSHA `json:"target_commit"`
WorkspaceTree string `json:"workspace_tree,omitempty"`
Changes []RestoreChange `json:"changes"`
}
type Snapshot ¶
type Snapshot struct {
Ref string
Commit primitives.CommitSHA
}
type Status ¶
type Status struct {
WorkspaceRoot primitives.WorkspaceRoot
MetadataDir string
RepoID primitives.RepoID
StoreID primitives.StoreID
WorktreeID primitives.WorktreeID
Attached bool
GitDir string
LogDir string
IndexDir string
TmpDir string
Version string
ConfigPath string
ConfigExists bool
GitignorePath string
GitignoreHasEntry bool
HiddenGitExists bool
HiddenGitBare bool
Problems []string
}
func Inspect ¶
func Inspect(root primitives.WorkspaceRoot) Status
type StoreIdentity ¶
type StoreIdentity struct {
Version int `json:"version"`
RepoID primitives.RepoID `json:"repo_id"`
StoreID primitives.StoreID `json:"store_id"`
GitObjectFormat string `json:"git_object_format"`
CreatedAt string `json:"created_at"`
}
func ReadStoreIdentity ¶
func ReadStoreIdentity(metadataDir string) (StoreIdentity, error)
type SyntheticTreeEntry ¶
type SyntheticTreeEntry struct {
Path string
Mode primitives.GitFileMode
Content []byte
}
type UserGitIdentity ¶
type WorktreeIdentity ¶
type WorktreeIdentity struct {
Version int `json:"version"`
WorktreeID primitives.WorktreeID `json:"worktree_id"`
ProducerID primitives.EventProducerID `json:"event_producer_id"`
Root string `json:"root"`
GitTopLevel string `json:"git_toplevel,omitempty"`
GitCommonDir string `json:"git_common_dir,omitempty"`
GitDir string `json:"git_dir,omitempty"`
Primary bool `json:"primary"`
AttachedAt string `json:"attached_at"`
LastSeenAt string `json:"last_seen_at"`
}
func ReadWorktreeIdentities ¶
func ReadWorktreeIdentities(metadataDir string) ([]WorktreeIdentity, error)