Skip to content

A single-user database for Mac and iOS that provides multi-client synchronization using cloud storage

Notifications You must be signed in to change notification settings

allenu/slouchdb4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SlouchDB4

SlouchDB4 is a CRDT-style distributed journal-based database for single-user/multi-device scenarios. It is written in Swift and so is currently only available for macOS and iOS clients.

How it Works

SlouchDB4 lets you write an app that saves diff changes to its own local journal. It can interop with a shared file storage (such as Dropbox, OneDrive, iCloud) and upload its own journal files as well as download journal files generated by other clients. It will then merge the remote changes into its local journal history to update the state of the database.

Why single-user/multi-device?

This database is meant for single-user only because it uses a very primitive conflict-resolution system: the last update wins. Additionally, the clock it uses to order edits across multiple platforms is not synchronized. It is assumed that each peer uses a clock that's "pretty close" to the other peers. In other words, we are relying on a single user to be slow enough in making edits across multiple devices that clock synchronization is not an issue.

History

This is a rewrite of SlouchDB. It is the 4th version. SlouchDB2 was another attempt and was being updated as well as used in my own personal apps. However, I soon noticed it would not scale to large databases since all data was loaded into memory. I wanted it to support massive databases and ensure everything could be stored to disk and cached in-mem only as necessary. SlouchDB3 (never released) was started to handle this at the beginning of January 2020. After a couple of weeks of implementation, I realized the architecture could be even more improved, so rewrote it again before it got too far. Hence, SlouchDB4.

WIP

This is a work in progress. See TODOs.md for regular updates (adding of new tasks as well as marking old tasks done). It's in a pre-alpha stage, but progress is being made quickly. Short term goals:

  • get PeopleApp example app (from SlouchDB v1 and v2) building and running again on macOS and iOS using SlouchDB4
  • wrap everything up in a CocoaPod
  • test it out with a massive list of diffs and large data to verify that it has small mem footprint and is fast

About

A single-user database for Mac and iOS that provides multi-client synchronization using cloud storage

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published