Skip to main content

initialize_file

Function initialize_file 

Source
pub fn initialize_file<E, F>(
    connection: &Connection,
    busy_timeout: Duration,
    schema: SchemaVersion,
    initialize: F,
) -> Result<(), InitializationError<E>>
where F: FnOnce(&Transaction<'_>) -> Result<(), E>,
Expand description

Initialize a file-backed Harn database exactly once per schema version.

The lock identity comes from the connection’s VFS-resolved main-database filename, so callers cannot accidentally serialize a different path. Initialization serializes WAL promotion and the schema transaction across processes. The callback and version marker commit atomically. Ready opens observe WAL plus the exact marker and do not acquire the sidecar lock. The callback is invoked at most once by this function and should keep all persistent effects inside the supplied transaction so an error rolls them back with the marker.