feat: add replication plugin for external-to-internal data sync#239
Open
kartikganesh wants to merge 2 commits into
Open
feat: add replication plugin for external-to-internal data sync#239kartikganesh wants to merge 2 commits into
kartikganesh wants to merge 2 commits into
Conversation
Fixes outerbase#72. New ReplicationPlugin pulls data from external sources (Postgres, etc.) into internal DO SQLite using cursor-based incremental sync. Configurable per-table intervals, batch processing (1000 rows/pull), and DO alarm scheduling. REST API under /replication. /claim outerbase#72 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13 tests covering syncTable, syncAllTables, onAlarm, and scheduleNextAlarm with mocked external queries and DO storage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
/claim |
Author
|
Hey team — this PR implements the replication feature as a proper StarbasePlugin, following the existing plugin architecture ( Key design choices aligned with the issue requirements:
Architecture notes:
Other open PRs either don't use the plugin system (making them incompatible with StarbaseDB's architecture), skip incremental cursors, or don't handle DO alarm scheduling for continuous sync. Happy to iterate on any feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #72. New
ReplicationPluginpulls data from configured external sources (Postgres, etc.) into internal DO SQLite using cursor-based incremental sync./claim #72
Changes
plugins/replication/index.ts: Full plugin implementation with REST API, cursor-based sync, batch processing, DO alarm schedulingplugins/replication/meta.json: Plugin metadataplugins/replication/README.md: Usage documentation with examplesHow it works
POST /replication/tableswith table name, cursor column, and intervaltmp_replication_configand schedules DO alarmSELECT * FROM table WHERE cursorCol > lastCursor ORDER BY cursorCol LIMIT 1000INSERT OR REPLACEtmp_replication_stateAPI
POST /replication/tables— configure tables to replicateGET /replication/status— show sync status per tablePOST /replication/sync— trigger manual syncDELETE /replication/tables/:name— remove table from replicationTest plan