aranet-store
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.
Features
- SQLite-based storage — Single-file database, no server needed
- Incremental history sync — Only download new records from device
- Query by device, time range — With pagination support
- Sync state tracking — Per-device progress for efficient updates
- Deduplication — Automatic deduplication of history records
Installation
[]
= "0.1"
Usage
use ;
// Open or create database at default location
let store = open_default?;
// Register a device
store.upsert_device?;
// Store a reading
store.insert_reading?;
// Query readings with filters
let query = new
.device
.limit;
let readings = store.query_readings?;
// Query cached history
let query = new
.device
.since;
let history = store.query_history?;
// Get sync state for incremental updates
let sync_state = store.get_sync_state?;
Database Location
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 |
Schema
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 |
CLI Integration
The aranet-cli tool provides commands for interacting with the store:
# Sync device history to local database
# Query cached data
Related Crates
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 |
License
MIT
Made with ❤️ by Cameron Rye