second-brain-api 0.13.5

HTTP API server for second-brain: REST endpoints for recall, remember, and ingest
Documentation
use std::path::Path;

use chrono::Utc;
use second_brain_core::sqlite_store::SqliteStore;
use second_brain_sync::keyring::Keyring;

use crate::health::Health;

pub fn report(sqlite: &SqliteStore, data_dir: &Path, health: &Health) {
    match Keyring::load(sqlite, data_dir) {
        Ok(keyring) => report_keyring(&keyring, health),
        Err(e) => tracing::warn!("cannot read this device's sync identity: {e:#}"),
    }
}

pub fn report_keyring(keyring: &Keyring<'_>, health: &Health) {
    match keyring.status() {
        Ok(status) => health.identity_checked(status, Utc::now()),
        Err(e) => tracing::warn!("cannot read this device's sync identity: {e:#}"),
    }
}