Documentation
¶
Overview ¶
Package daemon holds vev's server-side session multiplexer use case.
Lock ordering: never acquire sendMu or session/daemon locks while holding a pane lock. Coordinator callbacks and timer methods run without coordinator.mu; see the lock-specific comments on attachedClient and renderCoordinator.
Package daemon holds vev's server-side session multiplexer use case: the accept loop, the ephemeral/named session registry, the per-tab PTY reader and VT screen, and the per-client debounced render coordinator.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Package daemon holds vev's server-side session multiplexer use case.
Index ¶
- Constants
- Variables
- func SnapshotShutdownTimeout() time.Duration
- type CommandRequestOutcome
- type CommandRequestTracker
- func (t *CommandRequestTracker) Complete(generation uint64, result ports.CommandResult)
- func (t *CommandRequestTracker) Fail(requestID, generation uint64, err error)
- func (t *CommandRequestTracker) PendingCount() int
- func (t *CommandRequestTracker) Publish(generation uint64) (uint64, <-chan CommandRequestOutcome)
- func (t *CommandRequestTracker) Remove(requestID, generation uint64)
- func (t *CommandRequestTracker) Track(requestID, generation uint64) (<-chan CommandRequestOutcome, bool)
- func (t *CommandRequestTracker) Wait(ctx context.Context, clock ports.Clock, requestID, generation uint64, ...) (ports.CommandResult, error)
- type Daemon
- func (d *Daemon) ApplyConfig(cfg domain.Config)
- func (d *Daemon) CollectStartupGarbage(ctx context.Context) error
- func (d *Daemon) NotifyGlobal(sev domain.NoticeSeverity, code domain.NoticeCode, msg string, cause error)
- func (d *Daemon) Serve(ctx context.Context, l ports.Listener) error
- func (d *Daemon) StopDurableWriters(ctx context.Context) []string
- func (d *Daemon) WaitDurableWriters()
- type Guarded
- type Option
- func WithBarScriptCommandRunner(runner ports.ShellCommandRunner) Option
- func WithCatalogue(catalogue ports.Catalogue, records []domain.CatalogueRecord) Option
- func WithConfig(cfg domain.Config) Option
- func WithCwdReader(fn func(int) (string, error)) Option
- func WithDirOrHome(fn func(string) string) Option
- func WithDurableMaintenance(catalogue ports.Catalogue, repository ports.SnapshotRepository) Option
- func WithNoticeStore(store ports.NoticeStore) Option
- func WithProcessInspector(ins ports.ProcessInspector) Option
- func WithRecoveryCoordinator(coordinator *recoveryusecase.Coordinator) Option
- func WithRemoteDiscovery(store ports.RemoteHostStore, catalog ports.RemoteCatalogClient, ...) Option
- func WithRemotePreview(client ports.RemotePreviewClient) Option
- func WithResumeParkGrace(grace time.Duration) Option
- func WithRuntimeObserver(observer ports.SerializedRuntimeObserver) Option
- func WithShell(cmd string, args []string) Option
- func WithSnapshotRepository(repository ports.SnapshotRepository) Option
- func WithTempDir(dir string) Option
Constants ¶
const CommandRequestTimeout = 10 * time.Second
Variables ¶
var ( ErrCommandRequestTimeout = errors.New("command request timed out") )
Functions ¶
func SnapshotShutdownTimeout ¶
SnapshotShutdownTimeout reports the shared final-checkpoint shutdown budget.
Types ¶
type CommandRequestOutcome ¶ added in v0.2.0
type CommandRequestOutcome struct {
Result ports.CommandResult
Err error
}
CommandRequestOutcome is the result delivered for one tracked request.
type CommandRequestTracker ¶ added in v0.2.0
type CommandRequestTracker struct {
// contains filtered or unexported fields
}
CommandRequestTracker correlates request results for one connection. The generation is part of every pending entry so a reused request ID from an older connection cannot complete a newer request.
func NewCommandRequestTracker ¶ added in v0.2.0
func NewCommandRequestTracker() *CommandRequestTracker
NewCommandRequestTracker constructs an empty per-connection tracker.
func (*CommandRequestTracker) Complete ¶ added in v0.2.0
func (t *CommandRequestTracker) Complete(generation uint64, result ports.CommandResult)
Complete accepts only the exact request generation. Unknown, late, and old generation results are safe no-ops.
func (*CommandRequestTracker) Fail ¶ added in v0.2.0
func (t *CommandRequestTracker) Fail(requestID, generation uint64, err error)
Fail completes the exact request with a transport or decode failure.
func (*CommandRequestTracker) PendingCount ¶ added in v0.2.0
func (t *CommandRequestTracker) PendingCount() int
PendingCount is intended for deterministic lifecycle tests.
func (*CommandRequestTracker) Publish ¶ added in v0.2.0
func (t *CommandRequestTracker) Publish(generation uint64) (uint64, <-chan CommandRequestOutcome)
Publish allocates and records a request before its bytes are sent.
func (*CommandRequestTracker) Remove ¶ added in v0.2.0
func (t *CommandRequestTracker) Remove(requestID, generation uint64)
Remove abandons only the exact request generation.
func (*CommandRequestTracker) Track ¶ added in v0.2.0
func (t *CommandRequestTracker) Track(requestID, generation uint64) (<-chan CommandRequestOutcome, bool)
Track records an existing wire request ID, as used by an inbound one-shot command connection. It rejects duplicate IDs on that connection.
func (*CommandRequestTracker) Wait ¶ added in v0.2.0
func (t *CommandRequestTracker) Wait(ctx context.Context, clock ports.Clock, requestID, generation uint64, outcome <-chan CommandRequestOutcome) (ports.CommandResult, error)
Wait waits without holding the tracker or connection sender lock. Timeout and cancellation remove only the matching request.
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
func New ¶
New constructs a Daemon. ptys spawns PTY-backed children, clock drives the render debounce, and log receives diagnostics (defaults to slog.Default).
func (*Daemon) ApplyConfig ¶
ApplyConfig validates and atomically swaps daemon runtime configuration.
func (*Daemon) CollectStartupGarbage ¶
CollectStartupGarbage runs the one coordinator-owned GC pass before the daemon socket is published.
func (*Daemon) NotifyGlobal ¶
func (d *Daemon) NotifyGlobal(sev domain.NoticeSeverity, code domain.NoticeCode, msg string, cause error)
NotifyGlobal raises a daemon-wide notice from outside the daemon package.
func (*Daemon) Serve ¶
Serve runs the accept loop over l, owning it for the loop's lifetime. It returns when the last session is removed or ctx is cancelled; on the latter path attached clients are detached with ReasonServerShutdown.
func (*Daemon) StopDurableWriters ¶
StopDurableWriters stops maintenance scheduling, cancels cooperative maintenance calls, stops snapshot admission, and requests the snapshot worker's final drain. The context bounds checkpoint success only: cancellation never detaches a writer from its owner.
func (*Daemon) WaitDurableWriters ¶
func (d *Daemon) WaitDurableWriters()
WaitDurableWriters is the unconditional ownership barrier. It has no timeout or status branch: every writer goroutine must exit before Serve may return. Restoration is joined with the others because it mutates durable state too; it observes serveCtx cancellation, so waiting for it cannot outlive an uncooperative repository call any longer than the snapshot worker does.
type Guarded ¶
type Guarded[T any] struct { // contains filtered or unexported fields }
Guarded protects one value behind a mutex.
type Option ¶
type Option func(*Daemon)
func WithBarScriptCommandRunner ¶
func WithBarScriptCommandRunner(runner ports.ShellCommandRunner) Option
WithBarScriptCommandRunner installs the shell command runner used by bar scripts.
func WithCatalogue ¶
func WithCatalogue(catalogue ports.Catalogue, records []domain.CatalogueRecord) Option
WithCatalogue installs the singular catalogue and the strictly opened records that define the daemon's expected-session registry at startup.
func WithConfig ¶
WithConfig applies the initial user configuration.
func WithCwdReader ¶
WithCwdReader overrides the process cwd reader used for persistence tests.
func WithDirOrHome ¶
WithDirOrHome installs path fallback behavior from the application layer.
func WithDurableMaintenance ¶
func WithDurableMaintenance(catalogue ports.Catalogue, repository ports.SnapshotRepository) Option
WithDurableMaintenance retains the application wiring for the one pre-publication GC pass. Standalone users without an explicitly supplied coordinator receive the same canonical coordinator path.
func WithNoticeStore ¶
func WithNoticeStore(store ports.NoticeStore) Option
WithNoticeStore enables persisting undeliverable notices across daemon restarts. A nil store keeps the daemon in no-op notice-persistence mode.
func WithProcessInspector ¶
func WithProcessInspector(ins ports.ProcessInspector) Option
WithProcessInspector installs the platform process-inspection implementation.
func WithRecoveryCoordinator ¶
func WithRecoveryCoordinator(coordinator *recoveryusecase.Coordinator) Option
WithRecoveryCoordinator installs the durable recovery coordinator.
func WithRemoteDiscovery ¶ added in v0.2.0
func WithRemoteDiscovery(store ports.RemoteHostStore, catalog ports.RemoteCatalogClient, cache ports.RemoteCatalogCache, dialer ports.RemoteDialerFactory, mode ports.RemoteTransportMode) Option
WithRemoteDiscovery installs the remote discovery ports used by the daemon. The composition root validates mode before constructing the daemon.
func WithRemotePreview ¶ added in v0.2.0
func WithRemotePreview(client ports.RemotePreviewClient) Option
WithRemotePreview installs the optional non-attaching remote viewport client.
func WithResumeParkGrace ¶
WithResumeParkGrace overrides how long detached resume-capable clients stay parked for reconnection. Non-positive durations keep the default.
func WithRuntimeObserver ¶
func WithRuntimeObserver(observer ports.SerializedRuntimeObserver) Option
WithRuntimeObserver accepts only a composition-root serialized observer. The application owns its lifecycle; the daemon never creates or closes a second reporting worker around it.
func WithShell ¶
WithShell overrides the command (and its args) each session spawns. The default is $SHELL (or /bin/sh) with no arguments; tests use this to run a deterministic program.
func WithSnapshotRepository ¶
func WithSnapshotRepository(repository ports.SnapshotRepository) Option
WithSnapshotRepository enables content-addressed incremental snapshots.
func WithTempDir ¶
WithTempDir overrides the directory clipboard-image-transfer writes temp files into (production default: os.TempDir()); tests use this with t.TempDir() so writes are isolated and auto-cleaned.
Source Files
¶
- attachment_connection.go
- attachment_effect_freeze.go
- attachment_effect_gate.go
- attachment_registry.go
- attachment_transition.go
- attachment_transition_publish.go
- attention.go
- bar_refresh.go
- bar_script.go
- client.go
- client_frame_routing.go
- client_transport_errors.go
- clipboard.go
- command_tracker.go
- config.go
- control.go
- copy_mouse_input.go
- copy_mouse_map.go
- copymode.go
- daemon.go
- dir_fallback.go
- floating.go
- floating_render.go
- guarded.go
- handshake.go
- identity.go
- input.go
- layout_mutation.go
- maintenance.go
- modal_compose.go
- mouse_panes.go
- move.go
- move_attachments.go
- move_lifecycle.go
- move_pane_admission.go
- move_pane_candidate.go
- move_pane_commit.go
- move_pane_postcommit.go
- move_picker.go
- move_rejection.go
- move_resize_fences.go
- move_tab.go
- navigation_overflow.go
- notices_overlay.go
- notify.go
- output_state_stream.go
- overlay.go
- overlay_backdrop.go
- overlay_runtime.go
- palette.go
- pane.go
- pane_actions.go
- pane_owner.go
- pane_rearrange.go
- pane_sync_owner.go
- pane_titles.go
- picker.go
- process_restore.go
- prompt.go
- recent_route_presentation.go
- recent_route_snapshot.go
- recovery_observability.go
- remote_attach.go
- remote_catalog_state.go
- remote_picker.go
- remote_preview.go
- remote_preview_cache.go
- render.go
- render_capture.go
- render_coordinator.go
- render_coordinator_support.go
- render_coordinator_types.go
- render_pipeline.go
- render_resize_deadline.go
- render_timer.go
- resize_mode.go
- resize_publication.go
- resize_retry_token.go
- resume.go
- session.go
- session_back.go
- session_capabilities.go
- session_core.go
- session_geometry.go
- session_view.go
- snapshot.go
- snapshot_capture.go
- snapshot_coordinator.go
- snapshot_incremental.go
- snapshot_queue.go
- snapshot_restore.go
- snapshot_restore_incremental.go
- snapshot_scheduler.go
- snapshot_worker.go
- status.go
- theme_resolve.go
- transactional_resize.go
- wire.go