github share/sharedb v1.0.0-beta.12

latest releases: v5.0.0, v4.1.5, v4.1.4...
5 years ago

Changes

  • #236 - Add milestone snapshots, which are persisted snapshots of documents at previous versions, used to speed up Backend#fetchSnapshot. (@alecgibson)

About MilestoneDB

This adds a new MilestoneDB class, which handles persisting milestone snapshots, with a default no-op base implementation. Methods:

  • MilestoneDB.getMilestoneSnapshot(collection, id, version, callback): void
  • MilestoneDB.saveMilestoneSnapshot(collection, snapshot, callback): void

To persist milestone snapshots:

  • Pass in a real implementation of MilestoneDB (to come later) when constructing Backend: new Backend({milestoneDb})
  • When constructing a real MilestoneDB, decide whether to save milestone snapshots by default for all collections:
    • Pass in the interval option to save milestone snapshots every interval versions by default.
    • Or don't pass the interval option to turn off saving of milestone snapshots by default.
  • For fine-grained control over when to save a milestone snapshot, register middleware on the 'commit' action and set the request.saveMilestoneSnapshot property to true or false to explicitly enable or disable milestone snapshot saving on that commit. If the property is left at its default value of null, then the default interval is used, if that was specified when constructing the MilestoneDB.

Don't miss a new sharedb release

NewReleases is sending notifications on new releases.