| Crates.io | aranet-store |
| lib.rs | aranet-store |
| version | 0.1.9 |
| created_at | 2026-01-18 05:14:11.013842+00 |
| updated_at | 2026-01-22 03:18:58.218803+00 |
| description | Local data persistence for Aranet sensor readings |
| homepage | |
| repository | https://github.com/cameronrye/aranet |
| max_upload_size | |
| id | 2051806 |
| size | 83,971 |
Local data persistence for Aranet sensor readings using SQLite.
This crate provides SQLite-based storage for Aranet sensor data, enabling offline access, history caching, and efficient queries without requiring a device connection.
[dependencies]
aranet-store = "0.1"
use aranet_store::{Store, ReadingQuery, HistoryQuery};
// Open or create database at default location
let store = Store::open_default()?;
// Register a device
store.upsert_device("AA:BB:CC:DD:EE:FF", Some("Living Room"))?;
// Store a reading
store.insert_reading("AA:BB:CC:DD:EE:FF", &reading)?;
// Query readings with filters
let query = ReadingQuery::new()
.device("AA:BB:CC:DD:EE:FF")
.limit(100);
let readings = store.query_readings(&query)?;
// Query cached history
let query = HistoryQuery::new()
.device("AA:BB:CC:DD:EE:FF")
.since(one_hour_ago);
let history = store.query_history(&query)?;
// Get sync state for incremental updates
let sync_state = store.get_sync_state("AA:BB:CC:DD:EE:FF")?;
By default, the database is stored at platform-specific locations:
| Platform | Path |
|---|---|
| Linux | ~/.local/share/aranet/data.db |
| macOS | ~/Library/Application Support/aranet/data.db |
| Windows | C:\Users\<user>\AppData\Local\aranet\data.db |
The database contains four tables:
| Table | Description |
|---|---|
devices |
Known devices and their metadata (name, firmware, model) |
readings |
Current readings captured over time |
history |
Historical records downloaded from device memory |
sync_state |
Tracks incremental sync progress per device |
The aranet-cli tool provides commands for interacting with the store:
# Sync device history to local database
aranet sync --device <ADDRESS>
# Query cached data
aranet cache devices # List cached devices
aranet cache stats # Show cache statistics
aranet cache history # Query cached history
aranet cache info # Show database info
This crate is part of the aranet workspace:
| Crate | crates.io | Description |
|---|---|---|
| aranet-core | Core BLE library for device communication | |
| aranet-types | Shared types for sensor data | |
| aranet-cli | Command-line interface | |
| aranet-tui | Terminal UI dashboard | |
| aranet-service | - | Background collector and REST API |
| aranet-gui | - | Desktop GUI application |
| aranet-wasm | - | WebAssembly module |
MIT
Made with ❤️ by Cameron Rye