Standardized packet recording to SQLite via --record (roadmap: data storage & processing)

未關閉
#974 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
45/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
python, sqlite
領域
cli, data, databases

研究方向

The issue itself proposes the entry points: a Recorder class in meshtastic/recorder.py subscribed to the meshtastic.receive pubsub topic, plus a new --record [FILE] CLI flag next to --listen. Read the existing --listen handling in the CLI module and the pubsub publish path first to see where packets arrive. The proposed schema and PRAGMA user_version versioned SQLite tables (packets, nodes) and the 17 offline pytest cases describe what done looks like: storage, dedup by packet_id, NODEINFO name resolution, thread-safe writes, and history-reader ordering/limits. Note the thread is a proposal awaiting maintainer answers on schema shape, flag name, and whether a read side belongs in the same PR, so confirm direction before writing code.

由索引模型根據 Issue 內容生成。

描述

Hi! The roadmap under Call for Contributors lists "data storage &
processing", with a sqlite schema + tools as a possible starting point,
and #566 has discussion along those lines (thebentern: dirt-simple sqlite
makes sense because it's portable and queryable). I'd like to propose a
concrete minimal shape and hear whether this is wanted before I open a PR.

The gap I kept hitting: --listen shows packets once and forgets them.
Third-party tools keep their own history instead (MeshMonitor has a full db,
pdxlocations/contact stores messages in its own sqlite), so every tool
reinvents storage differently. On top of that the device-side queue only
holds ~30 packets, so whatever a client misses while disconnected is gone
unless an S&F server happens to be running.

What I've been running locally while testing (works well):

  • meshtastic/recorder.py: a small Recorder class subscribed to
    "meshtastic.receive"
  • one new flag: --record [FILE] (defaults to meshtastic.db), stays open
    like --listen, clean close on Ctrl-C
  • small versioned SQLite schema (PRAGMA user_version), stdlib only, no
    new deps; stores a numeric sender id (from_num) so identities learned
    later still resolve onto older rows:
    packets(id PK, rx_time, from_id, from_num, to_id, channel, portnum,
    text, snr, rssi, hop_limit, packet_id UNIQUE)
    nodes(node_num PK, user_id, long_name, short_name, hw_model,
    last_heard) <- upserted from NODEINFO packets, so stored history reads
    like a chat instead of hex IDs
  • WAL + busy_timeout, INSERT OR IGNORE dedup by packet_id, per-packet
    commit (crash safe)
  • 17 offline pytest cases: storage, dedup by packet id, NODEINFO name
    resolution, a cross-thread write regression, plus coverage for the
    history reader (ordering, limits, missing-db errors)

Live tested against hardware: 48 packets captured in a 3 minute window on
a busy EU_868 net with zero write failures, node names auto-learned, and
device-queue replays after reconnect land in the db automatically (they
arrive through the same pubsub path).

Questions before I open a PR:

  1. does a minimal packets/nodes schema like this match what you'd want
    standardized, or should it record raw protobuf blobs too?
  2. is --record the flag name you'd prefer, placed next to --listen?
  3. want a read side later (--history last N / filters) as a separate
    small PR?

Happy to open the PR against master with tests included if this sounds
welcome.

主要語言
Python
星號
855
分支
355
平均合併
3 天 3 小時
30 天內合併 PR
12

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

meshtastic/python 的其他 Issue

查看 meshtastic/python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。