Task 12: Persistence (fluxer-platform::store) #12

Closed
opened 2026-11-11 08:01:24 +00:00 by charles · 0 comments
Owner

Files:

  • Create: crates/fluxer-platform/src/{lib.rs,paths.rs,settings.rs,secrets.rs,cache.rs}
  • Create: crates/fluxer-core/src/persist.rs
  • Test: crates/fluxer-platform/tests/{settings.rs,cache.rs}, crates/fluxer-core/tests/persist.rs

Interfaces:

  • Core side: enum PersistOp { SaveToken(SecretString), ClearToken, SaveSettings(LocalSettings), CacheMessages { channel_id, messages: Vec<Message> }, CacheReady(Box<ReadyPayload>) }, enum PersistResult { Loaded { token: Option<SecretString>, settings: LocalSettings, cached_ready: Option<ReadyPayload> }, Ok }; App::new emits nothing; the runtime sends CoreEvent::Persisted(Loaded{..}) first; if a token is present the session goes Discovering → Me → ConnectGateway, and cached ready data populates the store marked stale: true until the live READY replaces it.
  • Platform side: Paths::new(app_name: "fluxer-native") -> Paths { config_dir, data_dir, cache_dir, log_dir } via directories::ProjectDirs; LocalSettings (TOML: instance_url, installation_id: Uuid, sidebar_width, window: {x,y,w,h,maximized}, notifications_enabled: bool (default true), status_api: {enabled: bool, token: String} — token generated as 24 random bytes base64url like the Electron fork) with load(&Paths) -> LocalSettings (defaults on missing/invalid, invalid file renamed .bad) and save; Secrets::save_token/load_token/clear_token via keyring::Entry::new("fluxer-native", &instance_host); Cache::open(&Paths) -> Cache (rusqlite bundled, PRAGMA user_version = 1; on open error or version mismatch delete the file and recreate), put_messages, get_messages(channel, limit), put_ready/get_ready (JSON blob).

Plan: https://git.forked.io/charles/fluxer-native/src/branch/foundation/docs/superpowers/plans/2026-11-11-foundation.md (section "Task 12")

**Files:** - Create: `crates/fluxer-platform/src/{lib.rs,paths.rs,settings.rs,secrets.rs,cache.rs}` - Create: `crates/fluxer-core/src/persist.rs` - Test: `crates/fluxer-platform/tests/{settings.rs,cache.rs}`, `crates/fluxer-core/tests/persist.rs` **Interfaces:** - Core side: `enum PersistOp { SaveToken(SecretString), ClearToken, SaveSettings(LocalSettings), CacheMessages { channel_id, messages: Vec<Message> }, CacheReady(Box<ReadyPayload>) }`, `enum PersistResult { Loaded { token: Option<SecretString>, settings: LocalSettings, cached_ready: Option<ReadyPayload> }, Ok }`; `App::new` emits nothing; the runtime sends `CoreEvent::Persisted(Loaded{..})` first; if a token is present the session goes `Discovering` → `Me` → `ConnectGateway`, and cached ready data populates the store marked `stale: true` until the live READY replaces it. - Platform side: `Paths::new(app_name: "fluxer-native") -> Paths { config_dir, data_dir, cache_dir, log_dir }` via `directories::ProjectDirs`; `LocalSettings` (TOML: `instance_url`, `installation_id: Uuid`, `sidebar_width`, `window: {x,y,w,h,maximized}`, `notifications_enabled: bool (default true)`, `status_api: {enabled: bool, token: String}` — token generated as 24 random bytes base64url like the Electron fork) with `load(&Paths) -> LocalSettings` (defaults on missing/invalid, invalid file renamed `.bad`) and `save`; `Secrets::save_token/load_token/clear_token` via `keyring::Entry::new("fluxer-native", &instance_host)`; `Cache::open(&Paths) -> Cache` (rusqlite bundled, `PRAGMA user_version = 1`; on open error or version mismatch delete the file and recreate), `put_messages`, `get_messages(channel, limit)`, `put_ready/get_ready` (JSON blob). --- Plan: https://git.forked.io/charles/fluxer-native/src/branch/foundation/docs/superpowers/plans/2026-11-11-foundation.md (section "Task 12")
charles added this to the Foundation milestone 2026-11-11 08:01:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#12
No description provided.