automerge / automerge-repo-swift

Extends the Automerge-swift library, providing support for working with multiple Automerge documents at once, with pluggable network and storage providers.
https://swiftpackageindex.com/automerge/automerge-repo-swift/documentation/automergerepo
MIT License
23 stars 4 forks source link

add a Storage Provider that works against an iOS or macOS provided fileURL #97

Open heckj opened 6 months ago

heckj commented 6 months ago

Add a built-in storage provider that is initialized with a fileURL, to accomodate the following use cases:

jessegrosjean commented 6 months ago

I'm not sure if this would be right for the default file storage provider, but I've been playing with making NSDocument write to a bundle format using the general design suggested here for CloudKit .

The nice feature of this is that the format should then automatically merge. So for example you can share this on iCloud Drive and concurrent edits should converge.

Except my version seems to have bugs that I'm still figuring out :) Anyway, don't have anything fully working to share yet, just wanted to add this note for possible future implementation.

heckj commented 6 months ago

If you want to lift the logic, there's an implementation of the "partial incremental changes"/"compacted changes" in parallel in the DocumentStorage class of the repo - Following the JS impl, it was meant to ride about the provider, which is only concerned with shifting bytes onto, and off of, disk given various prefixes (used to determine locations)