Skip to main content

Module storage

Module storage 

Source
Expand description

Storage layer for Garmin data

This module provides time-partitioned Parquet storage for Garmin data, enabling concurrent read access during sync operations.

§Architecture

  • Parquet files: Time-partitioned storage for activities, health, performance, etc.
  • SQLite: Sync state and task queue for operational data

§Storage Layout

~/.local/share/garmin/
├── sync.db                      # SQLite for sync state + task queue
├── profiles.parquet             # Single file (small, rarely changes)
├── activities/
│   ├── 2024-W48.parquet        # Weekly partitions
│   └── ...
├── track_points/
│   ├── 2024-12-01.parquet      # Daily partitions
│   └── ...
├── daily_health/
│   ├── 2024-12.parquet         # Monthly partitions
│   └── ...
├── performance_metrics/
│   ├── 2024-12.parquet         # Monthly partitions
│   └── ...
└── weight/
    ├── 2024-12.parquet         # Monthly partitions
    └── ...

§Concurrent Access

Parquet files are written atomically (temp file + rename), so readers always see consistent data. External apps can query data using DuckDB:

SELECT * FROM 'activities/*.parquet' WHERE start_time_local > '2024-12-01';

Structs§

ParquetStore
Parquet storage for Garmin data
Storage
Storage manager combining Parquet store and sync database
SyncDb
SQLite database for sync state and task queue

Enums§

EntityType
Entity types with their partition strategies

Functions§

default_storage_path
Get the default storage path
default_sync_db_path
Get the default sync database path