Skip to content

Abstract classes for bucket storage factory#515

Merged
simolus3 merged 3 commits intomainfrom
abstract-bucket-storage-factory
Feb 19, 2026
Merged

Abstract classes for bucket storage factory#515
simolus3 merged 3 commits intomainfrom
abstract-bucket-storage-factory

Conversation

@simolus3
Copy link
Contributor

This refactors a few interfaces in packages/service-core to be abstract classes instead. This allows re-using common code that is currently duplicated between the postgres and mongo bucket storage implementations:

  • PersistedSyncRulesContent.parsed is identical and can be moved into a superclass.
  • For BucketStorageFactory:
    • All implementations directly extend from BaseObserver<BucketStorageFactoryListener>, so we might as well do that in an abstract class.
    • The configureSyncRules, getActiveSyncRules and getNextSyncRules methods are identical between all implementations.

This also refactors how UpdateSyncRulesOptions (passed to configureSyncRules and updateSyncRules) are created. Soon, we'll also want to store serialized sync plans along with the YAML source. This means that, if we want to update sync rules from yaml, we'll have to parse those anyway to extract a sync plan if the new compiler is used. So, this adds two helper functions (updateSyncRulesFromConfig for when the caller already has a sync config instance and updateSyncRulesFromYaml to parse and optionally validate) that should be used instead of directly passing a YAML instance.

@simolus3 simolus3 requested a review from rkistner February 18, 2026 15:51
@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2026

🦋 Changeset detected

Latest commit: 256a104

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@powersync/service-module-postgres-storage Minor
@powersync/service-module-mongodb-storage Minor
@powersync/service-core-tests Minor
@powersync/service-module-mongodb Minor
@powersync/service-core Minor
@powersync/service-schema Minor
@powersync/service-module-mssql Patch
@powersync/service-module-mysql Patch
@powersync/service-module-postgres Patch
@powersync/service-image Minor
@powersync/service-module-core Patch
test-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simolus3 simolus3 force-pushed the abstract-bucket-storage-factory branch from c2182ab to 256a104 Compare February 19, 2026 13:38
@simolus3 simolus3 merged commit 8a4c34e into main Feb 19, 2026
31 checks passed
@simolus3 simolus3 deleted the abstract-bucket-storage-factory branch February 19, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments