occupancy

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package occupancy records the checkout each running host session started in, so a verb that writes records can tell when the main working tree it is about to write into is shared with another live session (iss-2610240859590333).

On 2026-10-24 a session filed an issue, an intent, an ADR and two regenerated indexes into a main checkout another live session was working in, folding the peer's untracked draft into the indexes. The rule that a concurrent session works in its own worktree held only as prose. The session-start hook now writes one marker per session under abcd's home, naming the checkout and the host process; a record-writing verb counts the markers for its checkout whose host is still running.

A marker is keyed on the host process, not on a heartbeat, so a session that ended without a SessionEnd hook (a crash, a killed terminal, a hook the host cut short) stops counting the moment its process is gone. One host runs one session at a time, so a new marker replaces any other under the same host (a /clear or a resume whose SessionEnd never ran), and each Note prunes every marker whose host has ended.

The folder is reached through one walk from home and every file through that descriptor, with the guards the session-name register has: a symlinked ~/.abcd.noindex or folder is refused, and a marker another account owns or can write is not read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(home, root string, readTable func() (sessionname.Table, error)) error

Check is the one judgement every record writer makes before it writes into root (iss-2610240859590333): a *SharedError when root is a main working tree two or more live sessions work in, nil when it is a linked worktree or one session or none works there, and another error when the count could not be made, which the caller reports and writes past: a count it cannot make is not evidence that the checkout is shared.

func CheckPath

func CheckPath(home, path string, readTable func() (sessionname.Table, error)) error

CheckPath is Check on the working tree a file at path would be written into, for a writer that names a file rather than a checkout: the hook on the host's own file tools. A path in no checkout is nil, and so is one in that tree's local tier: it is ignored and kept for that checkout alone, so a file written there lands in no peer's index, and the SCRATCH rule sends a linked worktree's handovers and helper scripts to the main checkout's.

A path is judged twice when its spelling and the kernel can disagree: as cleaned before it is resolved (how a writer that normalizes the path first reads it) and as written (how the kernel resolves a ".." after a symlink). Either reading landing in a shared main checkout outside its tier refuses the write, so no spelling opens the exemption.

func Forget

func Forget(home, sessionID string) error

Forget removes the session's marker. A missing marker or folder is not an error.

func Note

func Note(home, sessionID, checkout string, host sessionname.Host, tab sessionname.Table) error

Note records that the session sessionID, run by host, started in checkout, an absolute working-tree top. It replaces any earlier marker for the session, removes every other marker under the same host, and prunes those whose host tab no longer shows running.

Types

type SharedError

type SharedError struct{ Sessions int }

SharedError is Check's refusal: the main working tree a record would be written into is one Sessions live sessions work in.

func (*SharedError) Error

func (e *SharedError) Error() string

Jump to

Keyboard shortcuts

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