Documentation
¶
Index ¶
- func CleanStaleStoreTmp(storeTmpDir string)
- func CleanStaleVendorDirs(projectDir string)
- func CreateTempDir(storeTmpDir string) (string, error)
- func DetectStrategy(storeDir, projectDir, forcedStrategy string) (Strategy, Linker)
- func ParsePIDFromTmpName(name string) (int, bool)
- func TryReflink(src, dst string) bool
- func WriteVendorState(vendorDir string, opts WriteVendorStateOpts) error
- type CopyLinker
- type FileLock
- type HardLinker
- type Linker
- type ReflinkLinker
- type Strategy
- type VendorState
- type WriteVendorStateOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanStaleStoreTmp ¶
func CleanStaleStoreTmp(storeTmpDir string)
CleanStaleStoreTmp removes leftover temp directories in store/tmp/. Only removes entries matching the current PID or entries older than 1 hour.
func CleanStaleVendorDirs ¶
func CleanStaleVendorDirs(projectDir string)
CleanStaleVendorDirs removes leftover vendor.allegro.old/ and vendor.allegro.tmp/.
func CreateTempDir ¶
CreateTempDir creates a process-unique temp directory in store/tmp/.
func DetectStrategy ¶
DetectStrategy probes the filesystem to determine the best link strategy. If forcedStrategy is non-empty, returns it directly (skipping probe).
func ParsePIDFromTmpName ¶
ParsePIDFromTmpName extracts PID from a tmp-{pid}-{random} directory name.
func TryReflink ¶
TryReflink attempts a reflink and returns whether it succeeded.
func WriteVendorState ¶
func WriteVendorState(vendorDir string, opts WriteVendorStateOpts) error
WriteVendorState writes vendor/.allegro-state.json with all Phase 2 fields.
Types ¶
type CopyLinker ¶
type CopyLinker struct{}
CopyLinker links files by copying content.
func (*CopyLinker) LinkFile ¶
func (c *CopyLinker) LinkFile(src, dst string) error
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
FileLock represents an advisory file lock on the project directory.
func AcquireLock ¶
AcquireLock creates/opens the lock file and acquires an exclusive flock. Respects context cancellation. Returns error if lock cannot be acquired within 30 seconds.
type HardLinker ¶
type HardLinker struct{}
HardLinker links files via os.Link (hardlink).
func (*HardLinker) LinkFile ¶
func (h *HardLinker) LinkFile(src, dst string) error
type ReflinkLinker ¶
type ReflinkLinker struct{}
ReflinkLinker links files via FICLONE ioctl on Linux (Btrfs/XFS).
func (*ReflinkLinker) LinkFile ¶
func (r *ReflinkLinker) LinkFile(src, dst string) error
type Strategy ¶
type Strategy int
Strategy represents the link method used.
func FormatStrategy ¶
FormatStrategy converts a string to Strategy enum.
type VendorState ¶
type VendorState struct {
AllegroVersion string `json:"allegro_version"`
SchemaVersion int `json:"schema_version,omitempty"`
LinkStrategy string `json:"link_strategy"`
LockHash string `json:"lock_hash"`
InstalledAt time.Time `json:"installed_at"`
Dev bool `json:"dev"`
DevPackages []string `json:"dev_packages"`
ScriptsExecuted bool `json:"scripts_executed"`
Packages map[string]string `json:"packages"`
PluginPackages []string `json:"plugin_packages,omitempty"`
}
VendorState represents vendor/.allegro-state.json.
func ReadVendorState ¶
func ReadVendorState(vendorDir string) (*VendorState, error)
ReadVendorState reads vendor/.allegro-state.json.
func (*VendorState) EffectiveDev ¶
func (s *VendorState) EffectiveDev() bool
EffectiveDev returns the dev mode from state, treating absent as true (Phase 1 default).
func (*VendorState) HasDevPackages ¶
func (s *VendorState) HasDevPackages() bool
HasDevPackages returns true if dev_packages info is available for incremental diff.
func (*VendorState) NeedsFullRebuildForDevSwitch ¶
func (s *VendorState) NeedsFullRebuildForDevSwitch(currentDev bool) bool
NeedsFullRebuildForDevSwitch returns true if switching dev mode requires a full rebuild because dev_packages info is missing (Phase 1 state).
type WriteVendorStateOpts ¶
type WriteVendorStateOpts struct {
Version string
Strategy Strategy
LockHash string
Packages map[string]string
Dev bool
DevPackages []string
ScriptsExecuted bool
PluginPackages []string
}
WriteVendorState writes vendor/.allegro-state.json. WriteVendorStateOpts holds all options for writing the vendor state file.