Files
VoelinClient/crates/voelin-store/src/lib.rs
T
Claude 8dcd631fab voelin-store: contacts table (schema version 3)
Home's friends list, blocking and per-person volume need a place for
people the user marked. Contacts are keyed by the client's unique id
(the same on every server) and carry a nickname hint, the relation
(friend, blocked, neutral), a note, mute and volume, when they were
added and when and where they were seen last.

Migration 3 adds the table; existing data stays. touch_contacts records
many sightings in one transaction and never moves last_seen back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-28 19:26:23 +00:00

41 lines
1.3 KiB
Rust

//! Local persistence for the client.
//!
//! One SQLite database holds identities, bookmarks, settings, contacts
//! ([`contacts`]) and the chat history ([`chat`]). Passwords and query
//! credentials never go into the database; they live in a [`Secrets`] store
//! (the OS keyring with the `keyring` feature).
//!
//! The schema is versioned (`PRAGMA user_version`): opening a database runs
//! the migrations it has not seen, each in one transaction, keeping the data.
pub mod chat;
pub mod contacts;
mod secrets;
mod store;
pub use chat::{
ChatCursor, ChatTarget, MessageSource, NewMessage, PageQuery, Reaction, RemoteInfo,
StoredMessage, SyncState, WriteOutcome, Written,
};
pub use contacts::{Contact, ContactSeen, Relation};
#[cfg(feature = "keyring")]
pub use secrets::KeyringSecrets;
pub use secrets::{MemorySecrets, Secrets};
pub use store::{Bookmark, IdentityEntry, QueryConfig, QueryTransport, Store};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("database: {0}")]
Db(#[from] rusqlite::Error),
#[error("serialization: {0}")]
Json(#[from] serde_json::Error),
#[error("{0} {1} not found")]
NotFound(&'static str, i64),
#[error("secret store: {0}")]
Secrets(String),
#[error("io: {0}")]
Io(#[from] std::io::Error),
}
pub type Result<T> = std::result::Result<T, Error>;