Everything written this session that has not been through the device: rounds 43 to 48 (each patch adversarially verified, 43's transient-notice expectation fixed), a partial round 49, the pipeline scripts, the Android Auto design and the icon comparison mock. Also the two harness changes that were never A/B'd — adaptive waits, which may only shorten a declared wait and never lengthen it, and a ship that runs the mock walk and the deploy at the same time. The A/B and its 255-step baseline are in handoff/tools; main stays at what the phone has actually walked.
33 lines
1.5 KiB
Plaintext
33 lines
1.5 KiB
Plaintext
/// Open an EXISTING database without writing a byte to it.
|
|
///
|
|
/// [`Library::open`] cannot be used from a process that does not own the
|
|
/// library: it runs `PRAGMA journal_mode = WAL` and a batch of
|
|
/// `CREATE TABLE IF NOT EXISTS`, both writes, and on Android it may be
|
|
/// racing the real app. Android Auto browses and plays from a
|
|
/// service-started process with no Activity in it, and this is the door
|
|
/// it uses.
|
|
///
|
|
/// A read-only open of a WAL database is legal from SQLite 3.22 (this
|
|
/// tree bundles 3.46) as long as the `-shm` and `-wal` files exist and
|
|
/// are readable, OR there is write permission on the DIRECTORY holding
|
|
/// the database. The second always holds for us — the reader is the
|
|
/// app's own uid and owns `…/Library/.soulstream/` — which is why this
|
|
/// works even though `journal_mode=WAL` is persistent and every
|
|
/// SoulStream database is in it.
|
|
///
|
|
/// `NO_MUTEX` because the connection is behind this struct's own
|
|
/// `Mutex`; `URI` because the default flags carry it and dropping it
|
|
/// would quietly change how a path with a `?` in it is read.
|
|
pub fn open_read_only(db_path: &Path) -> Result<Library> {
|
|
let conn = Connection::open_with_flags(
|
|
db_path,
|
|
rusqlite::OpenFlags::SQLITE_OPEN_READ_ONLY
|
|
| rusqlite::OpenFlags::SQLITE_OPEN_NO_MUTEX
|
|
| rusqlite::OpenFlags::SQLITE_OPEN_URI,
|
|
)?;
|
|
Ok(Library {
|
|
conn: Mutex::new(conn),
|
|
})
|
|
}
|
|
|