Module service

Module service 

Source

FunctionsΒ§

compensate_via_reducer πŸ”’
Compensation helper: dispatch a command into the reducer and apply its emitted events to wstore best-effort. Used when an earlier sync apply partially wrote SQLite and we need to undo the leaked rows. SQLite errors during compensation are logged but ignored β€” the caller is already returning an error to the client; throwing on the cleanup just hides the original cause. (codex P1 + reagent P2 #616 β€” partial-write cleanup.)
dispatch_service πŸ”’
dispatch_to_reducer πŸ”’
Dispatch a command into the srv reducer and return the emitted events. Locks the reducer mutex briefly; the lock is released before any I/O (caller is responsible for publishing the events to the broadcast bus).
find_tab_for_layout πŸ”’
Phase E.4 (Option A) β€” reverse lookup: given a LayoutState.oid, find the Tab.oid that owns it (i.e., the tab whose layoutstate field matches). Returns None when the layout is unowned (legacy or partially-migrated row) or the wstore read fails β€” caller treats either as β€œskip the reducer dispatch and fall through to the wcore write.” Linear scan over all tabs; acceptable here because the layout-update path is low-frequency relative to drag-resize and the reducer mutex itself is held for sub-millisecond intervals.
get_object_by_oref πŸ”’
Resolve an β€œotype:oid” string to the corresponding wave object JSON.
handle_service πŸ”’
publish_events πŸ”’
Publish each event on the srv broadcast bus. Failures (no subscribers) are non-fatal.
queue_source_layout_delete πŸ”’
Phase E.5.5 β€” append a layout-delete action to the source tab’s LayoutState.pendingbackendactions so the source window’s frontend tears the moved block out of its layout tree on next poll. Mirrors the action-queueing portion of wcore::tear_off_block. Layout migration is E.4.
setup_torn_off_block_layout πŸ”’
Phase E.5.5 β€” set up the layout tree for a tab that just received its first block via the TearOffBlock saga. Called from the TearOffBlock RPC handler after the saga’s reducer-state portion (CreateTab + MoveBlock) completes. Mirrors the layout-rootnode
update_object πŸ”’
Update a wave object by replacing it wholesale in the store. The incoming value must have otype and oid fields. Matches Go’s ObjectService.UpdateObject behavior. Returns (otype, oid, updated_value_with_new_version) on success.
update_object_meta πŸ”’
Update object meta by oref string. Merges meta into existing object.
wstore_workspace_exists πŸ”’
Existence check used by DeleteWorkspace to decide whether to run the wcore delete path. Propagates StoreError so the caller can surface real I/O / corruption failures instead of misclassifying them as β€œnot found” (codex P2 #615 carryover β€” the prior bool return collapsed Err(_) into false, which led to silent successes when SQLite was unhealthy: reducer would delete its own copy and report success while the disk row was never touched).