Skip to main content

Module registry

Module registry 

Source
Expand description

The source registry (spec/sync/README.md §2): adapters, sources, attachments (sync_state is reserved — only delete_source touches it), ensure_repo with the <slug>-fs source, and the config → argv rendering an adapter is spawned with.

Structs§

AdapterRow
An adapters row.
NewSource
What create_source takes.
SourceRow
A sources row with its JSON columns parsed.

Constants§

FS_ADAPTER
The fs adapter as ensure_repo registers it.
FS_ADAPTER_COMMAND
Its command.

Functions§

attach
Attach a source to a repo (INSERT OR IGNORE).
create_source
Create a named source over an adapter: mints src; a taken name or an unknown adapter fails (UNIQUE / FK). Returns the id.
delete_source
Delete a source: its attachments, its sync_state rows, the row.
detach
Detach a source from a repo.
ensure_adapter
Insert or update an adapter by name.
ensure_repo
§2 ensure_repo: an existing slug returns its id; else mint rp, insert with default settings, and with a root register the filesystem source — INSERT OR IGNORE the fs adapter, find or create (mint src) <slug>-fs with config {"root": <root>}, attach it.
js_string
JavaScript String(value) for a JSON value: strings as is, numbers as JS prints them, booleans, null → "null", arrays comma-joined (with null elements empty, as Array.prototype.toString), objects [object Object].
list_adapters
Every adapter, by name.
list_sources
Every source, by name.
register_fs_source
The <slug>-fs source at root, registered idempotently and attached.
render_config_flags
§2 render_config_flags: for each entry in the object’s order, skip null; true → --key; false → nothing; else --key, String(value).
source_by_id
The source with source_id, if any.
source_by_name
The source named name, if any.
sources_for_repo
The sources attached to a repo, ordered by name.