home

package
v0.64.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package home owns the single-replica POSIX workspace layout beneath STELLA_HOME.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReadLimit      = errors.New("home: read limit exceeded")
	ErrUploadLimit    = errors.New("home: upload limit exceeded")
	ErrListLimit      = errors.New("home: list limit exceeded")
	ErrReadOnly       = errors.New("home: root is read-only")
	ErrOutcomeUnknown = errors.New("home: mutation outcome unknown")
)

Functions

func IsOutcomeUnknown

func IsOutcomeUnknown(err error) bool

Types

type ListOptions

type ListOptions struct{ Limit int }

type MkdirOptions

type MkdirOptions struct{ Parents bool }

type OwnerDeletion

type OwnerDeletion struct {
	// contains filtered or unexported fields
}

func NewOwnerDeletion

func NewOwnerDeletion(db *pgxpool.Pool, manager *WorkspaceManager, fencer OwnerFenceAcquirer) (*OwnerDeletion, error)

func (*OwnerDeletion) DeleteAgent

func (d *OwnerDeletion) DeleteAgent(ctx context.Context, id, actor string) error

func (*OwnerDeletion) DeleteGroup

func (d *OwnerDeletion) DeleteGroup(ctx context.Context, id, actor string) error

func (*OwnerDeletion) DeleteUser

func (d *OwnerDeletion) DeleteUser(ctx context.Context, id, actor string) error

type OwnerFenceAcquirer

type OwnerFenceAcquirer interface {
	AcquireHomeOwnerFence(context.Context, OwnerKind, string) (OwnerFenceLease, error)
}

type OwnerFenceLease

type OwnerFenceLease interface {
	Commit()
	Release()
}

type OwnerKind

type OwnerKind string
const (
	OwnerUser  OwnerKind = "user"
	OwnerGroup OwnerKind = "group"
	OwnerAgent OwnerKind = "agent"
)

type PrincipalKind

type PrincipalKind string
const (
	UserPrincipal  PrincipalKind = "user"
	GroupPrincipal PrincipalKind = "group"
)

type ProjectCoordinateReconcileResult added in v0.64.1

type ProjectCoordinateReconcileResult struct {
	Updated       int
	UnresolvedIDs []string
}

ProjectCoordinateReconcileResult reports legacy rows that cannot be mapped without guessing. They remain rejected by runtime coordinate validation, but no longer prevent unrelated Projects from being served.

type ReadOptions

type ReadOptions struct{ MaxBytes int64 }

type RemoveOptions

type RemoveOptions struct{ Recursive bool }

type RenameOptions

type RenameOptions struct {
	SyncParent bool
	NoReplace  bool
}

type Root

type Root struct {
	// contains filtered or unexported fields
}

func (*Root) Close

func (r *Root) Close() error

Close waits for active operations before releasing the owner gate. Callers must not invoke it synchronously from a Read or Write stream callback.

func (*Root) List

func (r *Root) List(ctx context.Context, name string, o ListOptions) ([]fs.DirEntry, error)

func (*Root) Lstat

func (r *Root) Lstat(ctx context.Context, name string) (fs.FileInfo, error)

func (*Root) Mkdir

func (r *Root) Mkdir(ctx context.Context, name string, mode fs.FileMode, o MkdirOptions) error

func (*Root) Read

func (r *Root) Read(ctx context.Context, name string, dst io.Writer, o ReadOptions) error
func (r *Root) Readlink(ctx context.Context, name string) (string, error)

func (*Root) Remove

func (r *Root) Remove(ctx context.Context, name string, o RemoveOptions) error

func (*Root) Rename

func (r *Root) Rename(ctx context.Context, old, new string, o RenameOptions) error

func (*Root) Stat

func (r *Root) Stat(ctx context.Context, name string) (fs.FileInfo, error)
func (r *Root) Symlink(ctx context.Context, target, name string) error

func (*Root) SyncDirectory

func (r *Root) SyncDirectory(ctx context.Context, name string) error

func (*Root) Upload

func (r *Root) Upload(ctx context.Context, name string, src io.Reader, o WriteOptions) error

func (*Root) Write

func (r *Root) Write(ctx context.Context, name string, src io.Reader, o WriteOptions) error

type RootAccess

type RootAccess uint8
const (
	RootReadOnly RootAccess = iota
	RootReadWrite
)

type RootOpener

type RootOpener interface {
	OpenRoot(context.Context, WorkspaceRequest, RootScope, RootAccess) (RootOperations, error)
}

RootOpener is the narrow capability-minting port for direct durable file consumers. WorkspaceManager is the production implementation.

type RootOperations

RootOperations is the callback-scoped durable filesystem capability exposed to post-authorization consumers. It intentionally contains no physical root path or provider/session coordinate.

type RootScope

type RootScope uint8
const (
	RootAgentWorkspace RootScope
	RootPrincipalData
	RootSystemSkills
	RootSystemAgentSkills
	RootUserSkills
	RootUserAgentSkills
)

func ResolveLogicalCoordinate

func ResolveLogicalCoordinate(scope RootScope, value string, allowRoot bool) (RootScope, string, error)

ResolveLogicalCoordinate canonicalizes portable sandbox coordinates.

type SkillRootOpener

type SkillRootOpener interface {
	OpenSkillRoot(context.Context, WorkspaceRequest, RootScope, RootAccess) (SkillRootOperations, error)
	OpenExistingSkillRoot(context.Context, WorkspaceRequest, RootScope) (SkillRootOperations, error)
}

SkillRootOpener mints the complete immutable-publication capability for a typed Skill root. Opening an existing root never materializes a missing chain, so offline migration dry-runs remain free of Home writes.

type SkillRootOperations

type SkillRootOperations interface {
	RootOperations
	Lstat(context.Context, string) (fs.FileInfo, error)
	Symlink(context.Context, string, string) error
	Readlink(context.Context, string) (string, error)
	SyncDirectory(context.Context, string) error
}

SkillRootOperations is the POSIX-only extension needed to publish immutable Skill revisions beneath an already-authorized typed Home root.

type Workspace

type Workspace interface {
	WorkspaceView(context.Context, WorkspaceRequest) (WorkspaceView, error)
	RootOpener
}

Workspace is the complete control-plane Home boundary: callers may resolve physical roots for provider-private wiring and mint typed rooted capabilities.

type WorkspaceManager

type WorkspaceManager struct {
	// contains filtered or unexported fields
}

WorkspaceManager is the sole production materializer of typed workspace roots. PostgreSQL remains owner authority; the filesystem is layout and data authority.

func NewWorkspaceManager

func NewWorkspaceManager(db *pgxpool.Pool, base string) (*WorkspaceManager, error)

func (*WorkspaceManager) AgentIDOccupied

func (m *WorkspaceManager) AgentIDOccupied(_ context.Context, id string) (bool, error)

AgentIDOccupied reserves deterministic global Agent roots. Any entry type is occupied and inspection errors fail closed.

func (*WorkspaceManager) Close

func (m *WorkspaceManager) Close() error

Close releases the pinned STELLA_HOME descriptor. The manager must not be used after Close.

func (*WorkspaceManager) OpenExistingSkillRoot

func (m *WorkspaceManager) OpenExistingSkillRoot(ctx context.Context, req WorkspaceRequest, scope RootScope) (SkillRootOperations, error)

func (*WorkspaceManager) OpenRoot

func (m *WorkspaceManager) OpenRoot(ctx context.Context, req WorkspaceRequest, scope RootScope, access RootAccess) (RootOperations, error)

func (*WorkspaceManager) OpenSkillRoot

func (m *WorkspaceManager) OpenSkillRoot(ctx context.Context, req WorkspaceRequest, scope RootScope, access RootAccess) (SkillRootOperations, error)

func (*WorkspaceManager) ReconcileProjectCoordinates added in v0.64.1

func (m *WorkspaceManager) ReconcileProjectCoordinates(ctx context.Context) (ProjectCoordinateReconcileResult, error)

ReconcileProjectCoordinates converts every safely resolvable legacy row and leaves ambiguous rows isolated behind runtime coordinate validation. The pending CHECK continues to reject new noncanonical values; it is validated only after the final historical row has been reconciled.

func (*WorkspaceManager) WorkspaceView

func (m *WorkspaceManager) WorkspaceView(ctx context.Context, req WorkspaceRequest) (WorkspaceView, error)

type WorkspaceRequest

type WorkspaceRequest struct{ UserID, GroupID, AgentID string }

type WorkspaceView

type WorkspaceView struct {
	PrincipalRoot, DataRoot, AgentRoot string
}

type WriteOptions

type WriteOptions struct {
	Mode      fs.FileMode
	Append    bool
	Exclusive bool
	Sync      bool
	MaxBytes  int64
}

Jump to

Keyboard shortcuts

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