Documentation
¶
Overview ¶
Package workspacedb owns per-workspace SQLite database lifecycle helpers.
Index ¶
- func ImportLegacyJournal(ctx context.Context, homeDir, sourceID string, profiles []string) (resultErr error)
- func MigrationStream() store.MigrationStream
- type DB
- func (d *DB) Close(ctx context.Context) error
- func (d *DB) DB() *sql.DB
- func (d *DB) InsertTerminalArtifact(ctx context.Context, artifact TerminalArtifactWrite) error
- func (d *DB) InsertTerminalCommand(ctx context.Context, row TerminalCommandWrite) error
- func (d *DB) LinkTerminalRecording(ctx context.Context, recording TerminalRecordingWrite) error
- func (d *DB) Path() string
- func (d *DB) SweepExpiredTerminalFiles(ctx context.Context, expiresAt int64, remove func(string) error) error
- func (d *DB) TerminalArtifact(ctx context.Context, id string) (TerminalArtifactRecord, error)
- func (d *DB) TerminalCommandIDExists(ctx context.Context, id string) (bool, error)
- func (d *DB) TerminalRecording(ctx context.Context, id string) (TerminalRecordingRecord, error)
- func (d *DB) TerminalRecordingIDExists(ctx context.Context, id string) (bool, error)
- func (d *DB) WorkspaceID() string
- func (d *DB) WorkspaceRoot() string
- type Options
- type Pool
- func (p *Pool) Close(ctx context.Context) error
- func (p *Pool) CloseWorkspace(ctx context.Context, workspaceID string) error
- func (p *Pool) Open(ctx context.Context, workspaceID string) (*DB, error)
- func (p *Pool) PrepareWorkspaceRemoval(ctx context.Context, workspaceID string) (*WorkspaceRemovalPreparation, error)
- func (p *Pool) RemoveWorkspace(ctx context.Context, workspaceID string) error
- type ResolvedRoot
- type RootResolver
- type TerminalArtifactRecord
- type TerminalArtifactWrite
- type TerminalCommandWrite
- type TerminalRecordingRecord
- type TerminalRecordingWrite
- type WorkspaceRemovalPreparation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImportLegacyJournal ¶
func ImportLegacyJournal(ctx context.Context, homeDir, sourceID string, profiles []string) (resultErr error)
ImportLegacyJournal copies profile-owned rows before the source registration can be retired.
func MigrationStream ¶
func MigrationStream() store.MigrationStream
MigrationStream returns the embedded workspace database migration stream.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is an open per-workspace Compozy database handle.
func Open ¶
Open resolves the workspace identity and opens <home>/workspaces/<registration-id>/compozy.db.
func (*DB) InsertTerminalArtifact ¶
func (d *DB) InsertTerminalArtifact(ctx context.Context, artifact TerminalArtifactWrite) error
InsertTerminalArtifact retains metadata for one command spill artifact.
func (*DB) InsertTerminalCommand ¶
func (d *DB) InsertTerminalCommand(ctx context.Context, row TerminalCommandWrite) error
InsertTerminalCommand appends one immutable terminal command.
func (*DB) LinkTerminalRecording ¶
func (d *DB) LinkTerminalRecording(ctx context.Context, recording TerminalRecordingWrite) error
LinkTerminalRecording inserts recording metadata and links covered commands atomically.
func (*DB) SweepExpiredTerminalFiles ¶
func (d *DB) SweepExpiredTerminalFiles( ctx context.Context, expiresAt int64, remove func(string) error, ) error
SweepExpiredTerminalFiles removes expired rows after their unshared files are removed.
func (*DB) TerminalArtifact ¶
TerminalArtifact returns retained metadata by id.
func (*DB) TerminalCommandIDExists ¶
TerminalCommandIDExists reports whether an immutable command identity is already durable.
func (*DB) TerminalRecording ¶
TerminalRecording returns retained recording metadata by id.
func (*DB) TerminalRecordingIDExists ¶
TerminalRecordingIDExists reports whether an immutable recording identity is already durable.
func (*DB) WorkspaceID ¶
WorkspaceID reports the resolved workspace identity.
func (*DB) WorkspaceRoot ¶
WorkspaceRoot reports the workspace root used to open the database.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool owns lazy, reusable database handles for daemon-known workspaces.
func NewPool ¶
func NewPool(homeDir string, resolveRoot RootResolver) (*Pool, error)
NewPool constructs an empty per-workspace database pool.
func (*Pool) CloseWorkspace ¶
CloseWorkspace closes and forgets one workspace handle.
func (*Pool) PrepareWorkspaceRemoval ¶
func (p *Pool) PrepareWorkspaceRemoval( ctx context.Context, workspaceID string, ) (*WorkspaceRemovalPreparation, error)
PrepareWorkspaceRemoval captures the database path independently of the project directory.
type ResolvedRoot ¶
ResolvedRoot binds a public workspace registration to its durable on-disk identity.
type RootResolver ¶
type RootResolver func(ctx context.Context, workspaceID string) (ResolvedRoot, error)
RootResolver resolves a public workspace id to its root and durable identity.
type TerminalArtifactRecord ¶
type TerminalArtifactRecord struct {
ID, CommandID, ProfileID, Digest, Path string
TerminalID *string
Bytes, ExpiresAt int64
}
TerminalArtifactRecord is stored metadata for one retained command artifact.
type TerminalArtifactWrite ¶
type TerminalArtifactWrite struct {
ID, CommandID, ProfileID, Digest, Path string
TerminalID *string
Bytes, ExpiresAt int64
}
TerminalArtifactWrite is the storage boundary for retained command output.
type TerminalCommandWrite ¶
type TerminalCommandWrite struct {
ID, ProfileID, ActorKind, ActorID string
Command, Cwd, ExitCause string
DetectedBy, Approval string
TerminalID, SessionID, RunID *string
ArgvDigest, ExitSignal *string
RecordingID *string
StartedAt, OutputBytes int64
DurationMs *int64
ExitCode *int
Truncated bool
}
TerminalCommandWrite is the storage boundary for one immutable command row.
type TerminalRecordingRecord ¶
type TerminalRecordingRecord struct {
ID, TerminalID, ProfileID, Digest, Path string
StartedAt, Bytes, ExpiresAt int64
StoppedAt *int64
}
TerminalRecordingRecord is stored metadata for one retained recording.
type TerminalRecordingWrite ¶
type TerminalRecordingWrite struct {
ID, TerminalID, ProfileID, Digest, Path string
StartedAt, Bytes, ExpiresAt int64
StoppedAt *int64
}
TerminalRecordingWrite is the storage boundary for one retained recording.
type WorkspaceRemovalPreparation ¶
type WorkspaceRemovalPreparation struct {
// contains filtered or unexported fields
}
WorkspaceRemovalPreparation owns a sealed database removal until commit or rollback.
func (*WorkspaceRemovalPreparation) BeforeDelete ¶
func (p *WorkspaceRemovalPreparation) BeforeDelete(context.Context) error
BeforeDelete seals this workspace against new database admission.