Documentation
¶
Index ¶
- Constants
- type Controller
- func (c *Controller) Persist(ctx context.Context, task *GitTaskContext) (*gitcommit.PersistCommitOutput, jobdb.Artifact, error)
- func (c *Controller) PersistWithDiffs(ctx context.Context, task *GitTaskContext) (*gitcommit.PersistWithDiffsOutput, []jobdb.Artifact, error)
- func (c *Controller) Restore(ctx context.Context, task *GitTaskContext, thinPack jobdb.Artifact) error
- type FileAdapter
- func (FileAdapter) EnsureLocation(_ context.Context, baseURI string) (string, error)
- func (FileAdapter) ListBlobs(_ context.Context, baseURI, prefix string) ([]string, error)
- func (FileAdapter) PutBlob(_ context.Context, baseURI, relativePath, sourcePath string) (string, error)
- func (FileAdapter) ResolvePath(_ context.Context, baseURI, relativePath string) (string, error)
- type GitTaskContext
- func (c *GitTaskContext) GetBaseRef() string
- func (c *GitTaskContext) GetBaseRepo() string
- func (c *GitTaskContext) GetCellName() string
- func (c *GitTaskContext) GetGitAuthor() string
- func (c *GitTaskContext) GetInvokeHash() string
- func (c *GitTaskContext) GetInvokeSeq() int64
- func (c *GitTaskContext) GetNodePath() string
- func (c *GitTaskContext) GetParentHash() string
- func (c *GitTaskContext) GetPersistHash() string
- func (c *GitTaskContext) GetRecipeSourceRef() string
- func (c *GitTaskContext) GetRecipeSourceRepo() string
- func (c *GitTaskContext) GetResolvedBaseHash() string
- func (c *GitTaskContext) GetWorktreePath() string
- type GlobalGitTaskContext
- type StorageAdapter
Constants ¶
const ThinPackArtifactName = "__git_state_thin_pack__"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller orchestrates cloning, restoring, and persisting git state per activity invocation.
func NewController ¶
func NewController(adapters map[string]StorageAdapter) *Controller
NewController constructs a Controller with the supplied adapters. If nil, a default file adapter is used.
func (*Controller) Persist ¶
func (c *Controller) Persist(ctx context.Context, task *GitTaskContext) (*gitcommit.PersistCommitOutput, jobdb.Artifact, error)
Persist captures repository changes, writes thin packs, and returns the commit output and a thin pack artifact (or nil if no changes).
func (*Controller) PersistWithDiffs ¶
func (c *Controller) PersistWithDiffs(ctx context.Context, task *GitTaskContext) (*gitcommit.PersistWithDiffsOutput, []jobdb.Artifact, error)
PersistWithDiffs captures repository changes, writes thin packs and diffs, and returns the commit output with three artifacts: 1. Thin pack artifact (like Persist) 2. Diff from parent hash artifact 3. Diff from base hash artifact
func (*Controller) Restore ¶
func (c *Controller) Restore(ctx context.Context, task *GitTaskContext, thinPack jobdb.Artifact) error
Restore replays thin packs when the target persist hash differs from the workspace state. It also prepares the workspace if it doesn't yet have a local copy of the repo.
type FileAdapter ¶
type FileAdapter struct{}
FileAdapter implements StorageAdapter for file:// URIs.
func (FileAdapter) EnsureLocation ¶
EnsureLocation ensures the base directory exists and returns its local filesystem path.
func (FileAdapter) ListBlobs ¶
ListBlobs lists blobs beneath the base URI using the supplied prefix relative to the base path.
func (FileAdapter) PutBlob ¶
func (FileAdapter) PutBlob(_ context.Context, baseURI, relativePath, sourcePath string) (string, error)
PutBlob for the file adapter moves/copies the blob into the target location and returns the relative path.
func (FileAdapter) ResolvePath ¶
ResolvePath returns the absolute path for the provided relative blob path.
type GitTaskContext ¶
type GitTaskContext struct {
*GlobalGitTaskContext // Pointer embedding - shares data with global context
WorktreePath string
}
GitTaskContext is used internally by workspace_controller Uses POINTER embedding to share the global context
func NewGitTaskContext ¶
func NewGitTaskContext(tec contextual.TaskExecutionContext) *GitTaskContext
NewGitTaskContext creates a GitTaskContext from TaskExecutionContext
func (*GitTaskContext) GetBaseRef ¶
func (c *GitTaskContext) GetBaseRef() string
func (*GitTaskContext) GetBaseRepo ¶
func (c *GitTaskContext) GetBaseRepo() string
Keep ALL existing getter methods - controller and other code depends on them
func (*GitTaskContext) GetCellName ¶
func (c *GitTaskContext) GetCellName() string
func (*GitTaskContext) GetGitAuthor ¶
func (c *GitTaskContext) GetGitAuthor() string
func (*GitTaskContext) GetInvokeHash ¶
func (c *GitTaskContext) GetInvokeHash() string
func (*GitTaskContext) GetInvokeSeq ¶
func (c *GitTaskContext) GetInvokeSeq() int64
func (*GitTaskContext) GetNodePath ¶
func (c *GitTaskContext) GetNodePath() string
func (*GitTaskContext) GetParentHash ¶
func (c *GitTaskContext) GetParentHash() string
func (*GitTaskContext) GetPersistHash ¶
func (c *GitTaskContext) GetPersistHash() string
func (*GitTaskContext) GetRecipeSourceRef ¶
func (c *GitTaskContext) GetRecipeSourceRef() string
func (*GitTaskContext) GetRecipeSourceRepo ¶
func (c *GitTaskContext) GetRecipeSourceRepo() string
func (*GitTaskContext) GetResolvedBaseHash ¶
func (c *GitTaskContext) GetResolvedBaseHash() string
func (*GitTaskContext) GetWorktreePath ¶
func (c *GitTaskContext) GetWorktreePath() string
type GlobalGitTaskContext ¶
type GlobalGitTaskContext struct {
BaseRepo string
BaseRef string
ResolvedBaseHash string
RecipeSourceRepo string
RecipeSourceRef string
PersistHash string
ParentHash string
CellName string
GitAuthor string
NodePath string
InvokeSeq int64
InvokeHash string
InlineStack []contextual.InlineBoundaryFrame
}
GlobalGitTaskContext contains machine-independent git context (serializable) This can be safely serialized and sent between machines
func NewGlobalGitTaskContext ¶
func NewGlobalGitTaskContext(tec contextual.TaskExecutionContext) *GlobalGitTaskContext
NewGlobalGitTaskContext creates a GlobalGitTaskContext from TaskExecutionContext
type StorageAdapter ¶
type StorageAdapter interface {
EnsureLocation(ctx context.Context, baseURI string) (string, error)
PutBlob(ctx context.Context, baseURI, relativePath, sourcePath string) (string, error)
ResolvePath(ctx context.Context, baseURI, relativePath string) (string, error)
ListBlobs(ctx context.Context, baseURI, prefix string) ([]string, error)
}
StorageAdapter provides filesystem-agnostic primitives for thin-pack management.