Documentation
¶
Overview ¶
Package journal owns terminal command persistence and retained byte artifacts.
Index ¶
- type Options
- type Service
- func (s *Service) Artifact(ctx context.Context, workspaceID string, scope store.ReadScope, id string) (io.ReadCloser, error)
- func (s *Service) CloseTerminal(ctx context.Context, info terminalpkg.Info) error
- func (s *Service) ConsumeMarkerFacts(ctx context.Context, info terminalpkg.Info, facts []terminalpkg.MarkerFacts) error
- func (s *Service) LinkRecording(ctx context.Context, workspaceID string, terminalID terminalpkg.ID, ...) error
- func (s *Service) ObserveInput(info terminalpkg.Info, actor terminalpkg.Actor, input []byte)
- func (s *Service) ObserveOutput(info terminalpkg.Info, output []byte)
- func (s *Service) PendingCount(info terminal.Info) int64
- func (s *Service) PersistRecording(ctx context.Context, workspaceID string, terminalID terminalpkg.ID, ...) (terminalpkg.RecordingRef, error)
- func (s *Service) PrepareWorkspaceRemoval(ctx context.Context, workspaceID string) (workspacepkg.UnregisterPreparation, error)
- func (s *Service) PrepareWorkspaceRemovalAt(ctx context.Context, workspaceID string, rootDir string) (workspacepkg.UnregisterPreparation, error)
- func (s *Service) Query(ctx context.Context, workspaceID string, scope store.ReadScope, ...) (*terminalpkg.Page, error)
- func (s *Service) Record(ctx context.Context, workspaceID string, row terminalpkg.CommandRow) error
- func (s *Service) RecordQueued(ctx context.Context, info terminalpkg.Info, row terminalpkg.CommandRow) error
- func (s *Service) Recording(ctx context.Context, workspaceID string, scope store.ReadScope, id string) (*terminalpkg.RecordingRef, io.ReadCloser, error)
- func (s *Service) RegisterTerminal(info terminalpkg.Info, setBlocked func(bool), emit func(terminalpkg.Event))
- func (s *Service) ReleaseCommandID(workspaceID, commandID string)
- func (s *Service) ReleaseRecordingID(workspaceID, recordingID string)
- func (s *Service) RemoveWorkspace(ctx context.Context, workspaceID string) error
- func (s *Service) ReserveCommandID(ctx context.Context, workspaceID string) (string, error)
- func (s *Service) ReserveInput(info terminalpkg.Info, input terminalpkg.JournalInput) (terminalpkg.JournalInputReservation, bool)
- func (s *Service) ReserveRecordingID(ctx context.Context, workspaceID string) (string, error)
- func (s *Service) Shutdown(ctx context.Context) error
- func (s *Service) SweepExpired(ctx context.Context, workspaceID string, at time.Time) error
- func (s *Service) WriteArtifact(ctx context.Context, workspaceID, profileID, commandID string, ...) (terminalpkg.SpillRef, error)
- func (s *Service) WriteFailureCount() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Databases *workspacedb.Pool
HomeDir string
Logger *slog.Logger
Now func() time.Time
Entropy io.Reader
}
Options configures the durable terminal journal.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the terminal journal over per-workspace SQLite stores.
func (*Service) Artifact ¶
func (s *Service) Artifact( ctx context.Context, workspaceID string, scope store.ReadScope, id string, ) (io.ReadCloser, error)
Artifact opens a profile-scoped spill artifact after containment validation.
func (*Service) CloseTerminal ¶
CloseTerminal flushes and removes the writer lane owned by one terminal.
func (*Service) ConsumeMarkerFacts ¶
func (s *Service) ConsumeMarkerFacts( ctx context.Context, info terminalpkg.Info, facts []terminalpkg.MarkerFacts, ) error
ConsumeMarkerFacts assembles authenticated shell facts without parsing bytes again.
func (*Service) LinkRecording ¶
func (s *Service) LinkRecording( ctx context.Context, workspaceID string, terminalID terminalpkg.ID, recording terminalpkg.RecordingRef, ) error
LinkRecording persists a recording and links commands captured in its window.
func (*Service) ObserveInput ¶
func (s *Service) ObserveInput(info terminalpkg.Info, actor terminalpkg.Actor, input []byte)
ObserveInput records accepted human input as an approximate fallback candidate.
func (*Service) ObserveOutput ¶
func (s *Service) ObserveOutput(info terminalpkg.Info, output []byte)
ObserveOutput postpones approximate completion while the terminal is still producing bytes.
func (*Service) PendingCount ¶
PendingCount reports retained, not-yet-durable rows for one terminal.
func (*Service) PersistRecording ¶
func (s *Service) PersistRecording( ctx context.Context, workspaceID string, terminalID terminalpkg.ID, ref terminalpkg.RecordingRef, contents []byte, ) (terminalpkg.RecordingRef, error)
PersistRecording writes a redacted asciicast artifact and records its durable metadata.
func (*Service) PrepareWorkspaceRemoval ¶
func (s *Service) PrepareWorkspaceRemoval( ctx context.Context, workspaceID string, ) (workspacepkg.UnregisterPreparation, error)
PrepareWorkspaceRemoval captures the database path before registration deletion makes the resolver unable to resolve it again.
func (*Service) PrepareWorkspaceRemovalAt ¶
func (s *Service) PrepareWorkspaceRemovalAt( ctx context.Context, workspaceID string, rootDir string, ) (workspacepkg.UnregisterPreparation, error)
PrepareWorkspaceRemovalAt reconstructs removal ownership from a durable workspace snapshot.
func (*Service) Query ¶
func (s *Service) Query( ctx context.Context, workspaceID string, scope store.ReadScope, query terminalpkg.Query, ) (*terminalpkg.Page, error)
Query returns one opaque-cursor page in descending start/id order.
func (*Service) Record ¶
func (s *Service) Record(ctx context.Context, workspaceID string, row terminalpkg.CommandRow) error
Record appends one immutable command row.
func (*Service) RecordQueued ¶
func (s *Service) RecordQueued( ctx context.Context, info terminalpkg.Info, row terminalpkg.CommandRow, ) error
RecordQueued persists one command through the bounded retry lane.
func (*Service) Recording ¶
func (s *Service) Recording( ctx context.Context, workspaceID string, scope store.ReadScope, id string, ) (*terminalpkg.RecordingRef, io.ReadCloser, error)
Recording opens a profile-scoped recording and its asciicast artifact.
func (*Service) RegisterTerminal ¶
func (s *Service) RegisterTerminal( info terminalpkg.Info, setBlocked func(bool), emit func(terminalpkg.Event), )
RegisterTerminal creates the bounded writer lane before terminal bytes flow.
func (*Service) ReleaseCommandID ¶
ReleaseCommandID releases an identity after persistence or abandoned admission.
func (*Service) ReleaseRecordingID ¶
ReleaseRecordingID releases an identity after persistence or abandoned admission.
func (*Service) RemoveWorkspace ¶
RemoveWorkspace closes and removes the workspace database during unregister.
func (*Service) ReserveCommandID ¶
ReserveCommandID returns an identity that is absent from durable and in-flight commands.
func (*Service) ReserveInput ¶
func (s *Service) ReserveInput( info terminalpkg.Info, input terminalpkg.JournalInput, ) (terminalpkg.JournalInputReservation, bool)
ReserveInput reserves bounded journal capacity before input reaches the PTY.
func (*Service) ReserveRecordingID ¶
ReserveRecordingID returns an identity absent from durable and in-flight recordings.
func (*Service) SweepExpired ¶
SweepExpired removes expired rows and their retained files.
func (*Service) WriteArtifact ¶
func (s *Service) WriteArtifact( ctx context.Context, workspaceID, profileID, commandID string, terminalID *terminalpkg.ID, contents []byte, expiresAt time.Time, ) (terminalpkg.SpillRef, error)
WriteArtifact redacts and retains one content-addressed spill artifact.
func (*Service) WriteFailureCount ¶
WriteFailureCount reports durable append failures observed by retry workers.