forge_lib_git_allocation

package
v0.53.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AllocationTypeID is the world object type identifier for a Git Worktree allocation.
	AllocationTypeID = "forge/lib/git/worktree-allocation"
)

Variables

View Source
var (
	// PredExecutionToAllocation links a Forge Execution to a Git Worktree allocation.
	PredExecutionToAllocation = quad.IRI("forge/git/execution-allocation")
	// PredPassToAllocation links a Forge Pass to a Git Worktree allocation.
	PredPassToAllocation = quad.IRI("forge/git/pass-allocation")
	// PredAllocationToRepo links an allocation to the owning Git Repo object.
	PredAllocationToRepo = quad.IRI("forge/git/allocation-repo")
	// PredAllocationToWorktree links an allocation to the allocated Git Worktree object.
	PredAllocationToWorktree = quad.IRI("forge/git/allocation-worktree")
)

Functions

func BuildObjectKey

func BuildObjectKey(executionObjectKey, repoObjectKey, baseCommitHash, pathFamily string) string

BuildObjectKey builds a deterministic allocation object key.

func ListAllocationRepos

func ListAllocationRepos(ctx context.Context, ws world.WorldState, allocationKeys ...string) ([]string, error)

ListAllocationRepos lists Repo object keys linked to allocations.

func ListAllocationWorktrees

func ListAllocationWorktrees(ctx context.Context, ws world.WorldState, allocationKeys ...string) ([]string, error)

ListAllocationWorktrees lists Worktree object keys linked to allocations.

func ListExecutionAllocations

func ListExecutionAllocations(ctx context.Context, ws world.WorldState, executionKeys ...string) ([]string, error)

ListExecutionAllocations lists allocation object keys linked to Executions.

func ListPassAllocations

func ListPassAllocations(ctx context.Context, ws world.WorldState, passKeys ...string) ([]string, error)

ListPassAllocations lists allocation object keys linked to Passes.

func NewAllocationBlock

func NewAllocationBlock() block.Block

NewAllocationBlock constructs an empty Allocation block.

Types

type Allocation

type Allocation struct {
	// ExecutionObjectKey is the owning Forge Execution object key.
	ExecutionObjectKey string `json:"executionObjectKey,omitempty"`
	// PassObjectKey is the optional owning Forge Pass object key.
	PassObjectKey string `json:"passObjectKey,omitempty"`
	// RepoObjectKey is the Git Repo object key.
	RepoObjectKey string `json:"repoObjectKey,omitempty"`
	// WorktreeObjectKey is the allocated Git Worktree object key.
	WorktreeObjectKey string `json:"worktreeObjectKey,omitempty"`
	// BaseCommitHash is the pinned base commit used for branch allocation.
	BaseCommitHash string `json:"baseCommitHash,omitempty"`
	// BranchRef is the branch/ref assigned to the allocation.
	BranchRef string `json:"branchRef,omitempty"`
	// PathFamily is the normalized visible path family that triggered allocation.
	PathFamily string `json:"pathFamily,omitempty"`
	// EvidenceObjectKey points at raw allocation Evidence when present.
	EvidenceObjectKey string `json:"evidenceObjectKey,omitempty"`
	// Status is the allocator lifecycle state.
	Status string `json:"status,omitempty"`
	// CollisionState records branch/key collision handling state.
	CollisionState string `json:"collisionState,omitempty"`
	// StaleBaseState records whether the pinned base is current for allocation.
	StaleBaseState string `json:"staleBaseState,omitempty"`
	// CleanupState records cleanup lifecycle for the allocated Worktree.
	CleanupState string `json:"cleanupState,omitempty"`
	// Timestamp is the allocation timestamp.
	Timestamp *timestamp.Timestamp `json:"timestamp,omitempty"`
}

Allocation records provenance for one Forge-owned Git Worktree allocation.

func CreateOrReuse

func CreateOrReuse(
	ctx context.Context,
	ws world.WorldState,
	args CreateArgs,
) (*Allocation, string, *bucket.ObjectRef, error)

CreateOrReuse creates an allocation object or returns the existing matching allocation.

func Lookup

func Lookup(ctx context.Context, ws world.WorldState, objKey string) (*Allocation, error)

Lookup loads an Allocation by object key.

func (*Allocation) GetBaseCommitHash

func (a *Allocation) GetBaseCommitHash() string

GetBaseCommitHash returns the base commit hash.

func (*Allocation) GetBranchRef

func (a *Allocation) GetBranchRef() string

GetBranchRef returns the branch/ref.

func (*Allocation) GetCleanupState

func (a *Allocation) GetCleanupState() string

GetCleanupState returns the cleanup state.

func (*Allocation) GetCollisionState

func (a *Allocation) GetCollisionState() string

GetCollisionState returns the branch/key collision state.

func (*Allocation) GetEvidenceObjectKey

func (a *Allocation) GetEvidenceObjectKey() string

GetEvidenceObjectKey returns the raw Evidence object key.

func (*Allocation) GetExecutionObjectKey

func (a *Allocation) GetExecutionObjectKey() string

GetExecutionObjectKey returns the owning Execution object key.

func (*Allocation) GetPassObjectKey

func (a *Allocation) GetPassObjectKey() string

GetPassObjectKey returns the optional owning Pass object key.

func (*Allocation) GetPathFamily

func (a *Allocation) GetPathFamily() string

GetPathFamily returns the visible path family.

func (*Allocation) GetRepoObjectKey

func (a *Allocation) GetRepoObjectKey() string

GetRepoObjectKey returns the Repo object key.

func (*Allocation) GetStaleBaseState

func (a *Allocation) GetStaleBaseState() string

GetStaleBaseState returns the stale-base state.

func (*Allocation) GetStatus

func (a *Allocation) GetStatus() string

GetStatus returns the allocation status.

func (*Allocation) GetTimestamp

func (a *Allocation) GetTimestamp() *timestamp.Timestamp

GetTimestamp returns the allocation timestamp.

func (*Allocation) GetWorktreeObjectKey

func (a *Allocation) GetWorktreeObjectKey() string

GetWorktreeObjectKey returns the Worktree object key.

func (*Allocation) MarshalBlock

func (a *Allocation) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary.

func (*Allocation) MarshalJSON

func (a *Allocation) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Allocation to JSON without reflection.

func (*Allocation) Reset

func (a *Allocation) Reset()

Reset resets the block.

func (*Allocation) UnmarshalBlock

func (a *Allocation) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block from binary.

func (*Allocation) UnmarshalJSON

func (a *Allocation) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Allocation from JSON without reflection.

func (*Allocation) Validate

func (a *Allocation) Validate() error

Validate validates an Allocation.

type CreateArgs

type CreateArgs struct {
	ObjectKey          string
	ExecutionObjectKey string
	PassObjectKey      string
	RepoObjectKey      string
	WorktreeObjectKey  string
	BaseCommitHash     string
	BranchRef          string
	PathFamily         string
	EvidenceObjectKey  string
	Status             string
	CollisionState     string
	StaleBaseState     string
	CleanupState       string
	Timestamp          *timestamp.Timestamp
}

CreateArgs contains inputs for creating or reusing an allocation.

Jump to

Keyboard shortcuts

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