Skip to main content

Crate io_pimdir

Crate io_pimdir 

Source
Expand description

§io-pimdir

Rust implementation of the pimdir standard: the store on disk and the sync engine that keeps it an offline replica of every source. The I/O-free core holds the whole logic; SQLite and the filesystem enter behind the client feature.

§The store

A store is a SQLite database plus a content-addressed blob directory (STORAGE.md). sql inlines the canonical schema and statements, codec the column encodings and the queue payload, hash names a body, and summary derives what a writer records about an item before its row reaches the store (Annex A): its key, its summary row with the people it names, and its sort key. security holds the text rules of STORAGE.md §18: a name made a path component, an error’s credentials scrubbed.

§The model

collection, object and placement are the shared item model: a body stored once, a placement per source per collection pinned by a handle and keyed across collections by a link id, at one rung of the detail ladder, reconciled against a per-source base. hub is the shared item with a binding per source, which a store projects for one source and absorbs a source’s writes back into (SYNC.md §3, §9). reference links one item to another across kinds and collections (STORAGE.md §14.2), and property keeps an item’s local state, a label among it, which no source carries (STORAGE.md §4.3).

§The engine

The five verbs are I/O-free coroutines under the coroutine contract: open, upgrade, mutate, sync and rekey (SYNC.md §1). Each yields requests to the two seams, load and change on the storage side and remote on the connector side, and a caller resumes it with the answers. Nothing here opens a socket or a file.

§The client

client (feature client) is the std store, one handle per profile STORAGE.md names: one owner that runs the statements against SQLite and the blob files and runs the verbs against a consumer’s remote::PimdirRemote, any number of producers that enqueue under the staging lock, and readers that take no lock. The pimdir binary (feature cli) is the operator tool over it.

§Search

search holds the query language of SEARCH.md and the coverage of an answer, with no feature. mail, contact and calendar add each domain’s extraction (and contact the card matcher); search reads the index, client::search; indexer builds and refreshes it, over every domain. A reader built without a domain’s feature still finds that domain’s hits, but cuts them no snippet and reads them, in PimdirIndex::item, from their summary as a bodiless item reads: no error says so, so a reader showing a kind takes its domain’s feature.

§Conventions

The crate is no_std with alloc; std enters behind client. Public items carry the Pimdir prefix. Section references (§n) are to STORAGE.md unless prefixed, and the crate’s own design history is under cairn/.

Modules§

capability
Capabilities
change
Changes and writes
clientclient
Client
codec
Encodings
collection
Collection
coroutine
Coroutine contract
hash
Content hash
hub
Multi-source hub
intent
Intents
load
Storage seam
mutate
Local mutation
object
Object
open
Open
placement
Placement
property
Property
reference
Reference
rekey
Rekey coroutine
remote
Remote seam
search
Search
security
Security
sql
Canonical SQL
summary
Summaries
sync
Sync coroutine
upgrade
Upgrade coroutine
version
Versions