Fills in `image_cache`, which the previous commit's "On this device" filter read but nothing wrote. Also carries in-flight work that shared these files: the Android TLS root store, the settings page, and a regenerated traceability report. # Two populations, deliberately separate An original is kept here for one of two reasons, and conflating them produces the exact failure the feature exists to prevent. **Pinned** originals were asked for. Pinning a collection before a trip is a promise, so pinned rows are never evicted and never counted against the budget — a cap that could silently delete a pinned trip would make pinning worthless, because it could not be relied on without checking. **Passively cached** originals are a side effect of working: develop already downloads the whole file, so keeping it costs no bandwidth and saves the entire transfer next time. This population is what the budget bounds, evicted least-recently-used, because it otherwise grows until a day of culling fills a disk. Sharing one budget would let a large pin starve the passive cache, or let browsing evict a pin. They are separate. # What was built `dr_catalog::cache` owns the bookkeeping — held tier, size, last use, pinned — and writes the bytes; deciding to download stays with the caller, which is what keeps a crate with no network out of the network's business. Files are written to a temporary and renamed, so a dropped connection cannot leave a truncated file recorded as a complete original. They are named by image id, not filename: `Photos/IMG_0001.CR2` and `Trips/IMG_0001.CR2` are different photographs, and a flat cache keyed on the name would serve one for the other. `spawn_full_fetch` became read-through. A hit is a disk read; a miss stores what it downloads and enforces the budget. A cache that cannot be opened is a miss, not a failure to open the photograph. Pinning writes intent — `tier_desired` — without downloading, so the button responds immediately, and `spawn_pin_fetch` fills it in sequentially afterwards. Sequential because these are tens of megabytes each: the lanes that make the thumbnail sweep fast buy little against one connection's bandwidth and cost a great deal of memory. A pin interrupted by a lost connection resumes from where it stopped. Schema v5 adds `pinned` and `path`. `pinned` is a column rather than something inferred from `pinned_by_rule`, which is ON DELETE SET NULL and so cannot answer for an image whose rule was deleted. A v4 catalog migrates in place; existing rows default to unpinned, the safe direction. The budget and "keep opened originals" come from the settings page rather than a constant, and are applied at startup rather than only on change — a cache capped at 2 GB last session would otherwise spend this one filling to the default. Turning off keeping leaves what is already cached readable: those bytes are paid for, and refusing them would re-download images sitting right there, including pinned ones. Also removes a doubled `#[test]` introduced in the previous commit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
71 lines
2.8 KiB
TOML
71 lines
2.8 KiB
TOML
[package]
|
|
name = "dr-ui"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
|
|
[dependencies]
|
|
dr-types.workspace = true
|
|
# The readback feature is on because Slint's texture-import path is unwired
|
|
# until spike S1; the develop view has no other way to reach the screen. It
|
|
# must come off when S1 lands (ARCH §6.1, AC-8).
|
|
dr-gpu = { workspace = true, features = ["readback"] }
|
|
dr-decode.workspace = true
|
|
serde_json.workspace = true
|
|
tokio.workspace = true
|
|
reqwest.workspace = true
|
|
dr-plat.workspace = true
|
|
dr-sync.workspace = true
|
|
dr-sync-nextcloud.workspace = true
|
|
dr-pipeline.workspace = true
|
|
dr-catalog.workspace = true
|
|
dr-thumbs.workspace = true
|
|
# The library module writes scan results straight into the catalog, so it
|
|
# needs the same SQLite types dr-catalog exposes.
|
|
rusqlite.workspace = true
|
|
# The renderer is shared, but the backend is not: winit on desktop,
|
|
# android-activity on Android, and enabling both makes the backend selector
|
|
# pick at random. So the backend features live on the target-specific
|
|
# dependencies below rather than here.
|
|
slint = { workspace = true, features = ["compat-1-2", "renderer-femtovg"] }
|
|
wgpu.workspace = true
|
|
anyhow.workspace = true
|
|
# `SettingsError` distinguishes an io failure from a malformed file, which the
|
|
# settings page reports differently; anyhow would flatten both to a string.
|
|
thiserror.workspace = true
|
|
log.workspace = true
|
|
pollster.workspace = true
|
|
# Runtime YAML only for `live-style`; release builds read the tokens the
|
|
# Slint compiler folded in at build time and never touch style.yaml.
|
|
serde_norway = { workspace = true, optional = true }
|
|
|
|
# Backend per platform. Slint already declares its android-activity backend
|
|
# under `cfg(target_os = "android")`, so this only has to name the feature;
|
|
# cargo resolves it away entirely on desktop.
|
|
[target.'cfg(not(target_os = "android"))'.dependencies]
|
|
slint = { workspace = true, features = ["backend-winit"] }
|
|
|
|
[target.'cfg(target_os = "android")'.dependencies]
|
|
slint = { workspace = true, features = ["backend-android-activity-06"] }
|
|
# Opening the sign-in URL needs an ACTION_VIEW Intent — Android has no
|
|
# xdg-open. Version-matched to Slint's Android backend so both halves of the
|
|
# process agree on the JavaVM types; ndk-context supplies the VM and activity
|
|
# that android-activity's glue already stashed.
|
|
jni = "0.22"
|
|
ndk-context = "0.1"
|
|
|
|
[build-dependencies]
|
|
slint-build.workspace = true
|
|
# build.rs generates theme.slint from style.yaml (S2).
|
|
serde_norway.workspace = true
|
|
|
|
[features]
|
|
default = []
|
|
# Temporary CPU readback path; see dr-ui docs and spike S1.
|
|
readback = ["dr-gpu/readback"]
|
|
# Debug convenience: re-read style.yaml at startup so a palette can be tuned
|
|
# without rebuilding. Costs the constant-folding of every token, so it stays
|
|
# off by default and has no business in a release build.
|
|
live-style = ["dep:serde_norway"]
|