diff options
| author | tv <tv@krebsco.de> | 2026-10-31 19:53:27 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 19:53:27 +0100 |
| commit | 6105507200231e67ba544c12aa10b988e1c23826 (patch) | |
| tree | 880530b7401cb5d43f52e06a68b4d704326aa272 /src/document/mod.rs | |
| parent | 8d7adfbdb7798cca9d9783761f290e3bd85d9a3a (diff) | |
use Automerge as Document instead of AutoCommit
This allows a lot of operations to drop mut.
Diffstat (limited to 'src/document/mod.rs')
| -rw-r--r-- | src/document/mod.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/document/mod.rs b/src/document/mod.rs index 9633241..fa1fa77 100644 --- a/src/document/mod.rs +++ b/src/document/mod.rs @@ -2,21 +2,23 @@ //! (merged-view paths over JSON) the HTTP API and remakes work with. /// The engine's types, under the names the rest of the crate uses: the document -/// (Automerge's `AutoCommit`), its changes and their hashes, and its writers (actors); -/// and what can be written like a document (`Transactable`). +/// (Automerge's `Automerge`), its changes and their hashes, and its writers (actors); +/// a write to it (`Transaction`: one change, committed or dropped whole), and what can +/// be read like a document (`ReadDoc`: the document, or a write in progress) and written +/// like one (`Transactable`). /// Only `document` and `remake` use Automerge itself (`architecture.md`, The document). -pub(crate) use automerge::transaction::Transactable; -pub(crate) use automerge::{ActorId, AutoCommit as Document, Change, ChangeHash}; +pub(crate) use automerge::transaction::{Transactable, Transaction}; +pub(crate) use automerge::{ActorId, Automerge as Document, Change, ChangeHash, ReadDoc}; /// The whole document as bytes, as the engine saves it: a backup, the document /// file's full save, the size a joining node downloads. -pub(crate) fn save(doc: &mut Document) -> Vec<u8> { +pub(crate) fn save(doc: &Document) -> Vec<u8> { doc.save() } /// The changes after `since` as bytes that, appended to a save, load with it (the /// document file's appends). -pub(crate) fn save_since(doc: &mut Document, since: &[ChangeHash]) -> Vec<u8> { +pub(crate) fn save_since(doc: &Document, since: &[ChangeHash]) -> Vec<u8> { doc.save_after(since) } |
