0xMiden / 0xMiden/note-transport-service
Add PostgreSQL backend support for production deployments
- Lenguaje dominante
- Rust
- Estrellas
- 3
- Forks
- 10
- Merge medio
- 2 h 23 min
- PR fusionados (30 d)
- 4
Descripción
### 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.
Guía de contribución
Línea de trabajo
Observe el trait DatabaseBackend existente y la implementación de SQLite para comprender la abstracción de almacenamiento. El esquema es una única tabla de notas con migraciones. Comience implementando un backend de PostgreSQL, seleccionándolo mediante el esquema de --database-url (postgres://). Migre las dos migraciones existentes a Postgres utilizando el soporte de migraciones por backend de Diesel. Ejecute la suite de pruebas existente contra ambas bases de datos para verificar la funcionalidad.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- postgresql, rust
- Área
- backend, database
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 65/100