0xMiden / 0xMiden/note-transport-service

Add PostgreSQL backend support for production deployments

オープン
#111 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
3
フォーク
10
平均マージ
2時間 23分
マージ済み PR(30日)
4

説明

### What should be done?

Add PostgreSQL as a supported database backend for the note transport node, alongside the existing SQLite backend.

The node currently supports only SQLite (via Diesel), which ties the dataset to a single host's local disk. For production/mainnet deployments the service's core requirement is durable storage of unconsumed notes, and a single-writer file on one machine makes data durability dependent on that host staying alive: a node failure or a reschedule to another host means data loss or an outage. Additionally, the current default of --database-url :memory: makes it easy to run without any persistence at all.

With Postgres support, the node can run against a cluster with streaming replication and automatic failover, so losing a host no longer means losing data, and the service itself can run as stateless replicas.

### How should it be done?

- Implement a PostgreSQL DatabaseBackend alongside the existing SQLite one. The storage layer is already abstracted behind the DatabaseBackend trait, Diesel supports Postgres, and the schema is a single notes table plus migrations, so the surface area is small.
- Select the backend from the --database-url scheme (e.g. postgres://... vs a file path), keeping SQLite as-is for local development and testing.
- Port the two existing migrations to Postgres (Diesel handles per-backend migrations).

### When is this task done?

- The node runs against a Postgres database via --database-url postgres://... with all existing functionality (store/fetch by tags, cursor pagination, retention cleanup, stats).
- The existing test suite runs against both dbs.

### Additional context

Requested by Gateway.fm as part of mainnet hardening for transport layer deployments.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

既存の DatabaseBackend トレイトと SQLite 実装を見て、ストレージの抽象化を理解してください。スキーマはマイグレーション付きの単一の notes テーブルです。まず、--database-url スキーム (postgres://) で選択される PostgreSQL バックエンドを実装することから始めてください。Diesel のバックエンドごとのマイグレーションサポートを使用して、既存の 2 つのマイグレーションを Postgres に移植してください。既存のテストスイートを両方のデータベースに対して実行し、機能を検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, rust
領域
backend, database
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。