feat: implement Redis Streams support with stream checkpoints and update history

- Added Redis Streams operations to the message bus interface and implementation.
- Introduced StreamCheckpoint model to track last processed stream entry per document.
- Implemented UpsertStreamCheckpoint and GetStreamCheckpoint methods in the Postgres store.
- Created document_update_history table for storing update payloads for recovery and replay.
- Developed update persist worker to handle Redis Stream updates and persist them to Postgres.
- Enhanced Docker Compose configuration for Redis with persistence.
- Updated frontend API to support fetching document state with optional share token.
- Added connection stability monitoring in the Yjs document hook.
This commit is contained in:
M1ngdaXie
2026-03-08 17:13:42 -07:00
parent f319e8ec75
commit 50822600ad
22 changed files with 1371 additions and 78 deletions

View File

@@ -71,10 +71,14 @@ func SetupTestDB(t *testing.T) (*PostgresStore, func()) {
// Run migrations
scriptsDir := filepath.Join("..", "..", "scripts")
migrations := []string{
"init.sql",
"001_add_users_and_sessions.sql",
"002_add_document_shares.sql",
"003_add_public_sharing.sql",
"000_extensions.sql",
"001_init_schema.sql",
"002_add_users_and_sessions.sql",
"003_add_document_shares.sql",
"004_add_public_sharing.sql",
"005_add_share_link_permission.sql",
"010_add_stream_checkpoints.sql",
"011_add_update_history.sql",
}
for _, migration := range migrations {
@@ -107,6 +111,8 @@ func SetupTestDB(t *testing.T) (*PostgresStore, func()) {
func TruncateAllTables(ctx context.Context, store *PostgresStore) error {
tables := []string{
"document_updates",
"document_update_history",
"stream_checkpoints",
"document_shares",
"sessions",
"documents",