mechanomeld 0.1.1-aarch64-linux → 0.1.3-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -22
- data/README.md +28 -3
- data/lib/mechanomeld/3.2/mechanomeld.so +0 -0
- data/lib/mechanomeld/3.3/mechanomeld.so +0 -0
- data/lib/mechanomeld/3.4/mechanomeld.so +0 -0
- data/lib/mechanomeld/4.0/mechanomeld.so +0 -0
- data/lib/mechanomeld/document.rb +4 -2
- data/lib/mechanomeld/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 263bc88b0ede409672a1e3c01793a41198ce6061d52a091349cc86454bc8285f
|
|
4
|
+
data.tar.gz: de34a739c48a0e7e81e2b381b3da327ac03df3e86f194aeb041255363705b74d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '05479a4338538dde5580f91ab9d1cefbf81763e6e08c7ad65906cbf825a2a080bc1c35abc8f5e36f19de3cabd2bf1ded154a256e72841bfcd7d4ddd71176b43e'
|
|
7
|
+
data.tar.gz: efe99639a8fe689644024a46d363508b213a46a8d47b00db8570f3df7e6e2a851928f3d2558cb486394a91a95e7735e840cbf7db78e1be09b6817bfd8f82cffe
|
data/CHANGELOG.md
CHANGED
|
@@ -5,32 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
-
## [0.1.
|
|
8
|
+
## [0.1.3] - 2026-10-01
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
-
- Document#
|
|
13
|
-
- Document.load_repo reads a document from automerge-repo's NodeFSStorageAdapter directory (d60a3eb)
|
|
14
|
-
- Document#heads returns the document's change hashes as hex, matching JavaScript's Automerge.getHeads (d60a3eb)
|
|
15
|
-
- Document#includes_heads?(heads) reports whether a document is at or past a set of heads (d60a3eb)
|
|
16
|
-
- Mechanomeld::SyncState, the per-peer sync state, with encode and decode for persistence (eea3a51)
|
|
17
|
-
- Document#generate_sync_message and #receive_sync_message, Automerge's per-document sync protocol (eea3a51)
|
|
12
|
+
- Document#up_to_date_with?(heads), the plain-language name for includes_heads?, which stays as an alias (9c1baa6)
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- releases also publish an x86_64-linux-musl platform gem (159dd59)
|
|
22
|
-
|
|
23
|
-
## [0.1.0] - 2026-09-17
|
|
14
|
+
## [0.1.2] - 2026-09-28
|
|
24
15
|
|
|
25
16
|
### Added
|
|
26
17
|
|
|
27
|
-
-
|
|
28
|
-
- Mechanomeld::Counter, Timestamp, Uint, Bytes, and Text value classes (6df6951)
|
|
29
|
-
- Mechanomeld::Document.load reads documents saved by JavaScript Automerge (c7d31d8)
|
|
30
|
-
- Document#get, #[], and #to_h read values by path (c7d31d8)
|
|
31
|
-
- Document#keys and #length for maps, lists, and text (1d80c0b)
|
|
32
|
-
- Mechanomeld::Document.new(actor_id:) creates an empty document (bccb69c)
|
|
33
|
-
- Document#put, #[]=, #delete, and #save (bccb69c)
|
|
34
|
-
- Document#commit(message:, timestamp:) and #rollback (a8ef491)
|
|
35
|
-
- Document#change commits a block and rolls back if it raises (a8ef491)
|
|
36
|
-
- Mechanomeld::Document.from builds a committed document from a Hash (a8ef491)
|
|
18
|
+
- Document#diff(from_heads, to_heads = heads) returns Automerge's patches between two versions of a document, as Hashes (9c9bf6d)
|
data/README.md
CHANGED
|
@@ -40,15 +40,40 @@ doc = Mechanomeld::Document.load_repo("automerge-repo-data", "4NtRZtd6yUtzf8qmEp
|
|
|
40
40
|
|
|
41
41
|
### Heads
|
|
42
42
|
|
|
43
|
-
`Document#heads` is the document's version: the change hashes JavaScript's `Automerge.getHeads(doc)` returns, as lowercase hex, so the two sides compare with `==`. `Document#
|
|
43
|
+
`Document#heads` is the document's version: the change hashes JavaScript's `Automerge.getHeads(doc)` returns, as lowercase hex, so the two sides compare with `==`. `Document#up_to_date_with?(heads)` is true when the document is at the version `heads` names, or a later one: every hash in `heads` is a change the document already contains. `includes_heads?` is the same method under its older name.
|
|
44
44
|
|
|
45
45
|
```ruby
|
|
46
|
-
doc.heads
|
|
47
|
-
doc.
|
|
46
|
+
doc.heads # => ["9d434616e7af865757bad75cdebe4151bccf7e29214a71f2a65150846c2a4275"]
|
|
47
|
+
doc.up_to_date_with?(heads) # => true when the document is at or past `heads`
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Both take hex. automerge-repo's `handle.heads()` returns base58 URL heads, which are not accepted; send `Automerge.getHeads(handle.doc())` from JavaScript instead. A hash that is not 32 bytes of hex raises `Mechanomeld::Error`; a well-formed hash the document does not have is simply not included. Like `save`, both commit any pending change first.
|
|
51
51
|
|
|
52
|
+
### What changed between two versions
|
|
53
|
+
|
|
54
|
+
`Document#diff(from_heads, to_heads = doc.heads)` is Automerge's diff: the patches that take the document from one version to another, as Hashes with String keys. Both arguments are hex heads as `Document#heads` returns them; `to_heads` defaults to the current heads, and `[]` as `from_heads` diffs from the empty document.
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
before = doc.heads
|
|
58
|
+
doc.change { |d| d[["scores", "bravo"]] = 7 }
|
|
59
|
+
doc.diff(before)
|
|
60
|
+
# => [{"action" => "put", "path" => ["scores", "bravo"], "value" => 7, "conflict" => false}]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Every patch has `"action"` and `"path"`. The path addresses the property the patch touches from the root, map keys as Strings and list indexes as Integers, as JavaScript's `Automerge.diff` reports it. The other keys depend on the action:
|
|
64
|
+
|
|
65
|
+
| action | keys |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `put` | `value`, `conflict` (true when this value won a concurrent write) |
|
|
68
|
+
| `delete` | `index` and `length` when deleting from a list; nothing more for a map key |
|
|
69
|
+
| `insert` | `values`, the elements inserted at `path`'s index, in order |
|
|
70
|
+
| `splice_text` | `value`, the String spliced into a `Text` at `path`'s index |
|
|
71
|
+
| `increment` | `value`, the amount a `Counter` changed by, which may be negative |
|
|
72
|
+
| `conflict` | nothing more: a concurrent write now conflicts at `path` |
|
|
73
|
+
| `mark` | `marks`, each `{"name", "value", "start", "end"}` on a `Text` |
|
|
74
|
+
|
|
75
|
+
Putting or inserting a map, list, or `Text` yields the empty container (`{}`, `[]`, or `Mechanomeld::Text.new("")`); its contents follow as their own patches. Values use the same Ruby types as `get`. A head that is not hex, or that names a change the document does not contain, raises `Mechanomeld::Error`. Like `save`, `diff` commits any pending change first.
|
|
76
|
+
|
|
52
77
|
### Syncing with a peer
|
|
53
78
|
|
|
54
79
|
`Document#generate_sync_message` and `Document#receive_sync_message` run Automerge's per-document sync protocol, so a Ruby document can exchange just the changes each side lacks with another Automerge peer: JavaScript's `Automerge.generateSyncMessage` / `receiveSyncMessage`, or another Ruby document. A `Mechanomeld::SyncState` tracks what one peer is known to have; keep one per peer for each document.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/mechanomeld/document.rb
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Mechanomeld
|
|
4
4
|
# Native methods (new, load, load_incremental, get, keys, length, put, delete, commit,
|
|
5
|
-
# rollback, save, heads,
|
|
6
|
-
# are defined in ext/mechanomeld/src/document.rs.
|
|
5
|
+
# rollback, save, heads, up_to_date_with?, diff, generate_sync_message,
|
|
6
|
+
# receive_sync_message) are defined in ext/mechanomeld/src/document.rs.
|
|
7
7
|
class Document
|
|
8
8
|
def self.from(hash, actor_id: nil)
|
|
9
9
|
raise ArgumentError, "Automerge document root must be a Hash" unless hash.is_a?(Hash)
|
|
@@ -40,6 +40,8 @@ module Mechanomeld
|
|
|
40
40
|
end
|
|
41
41
|
alias_method :to_hash, :to_h
|
|
42
42
|
|
|
43
|
+
alias_method :includes_heads?, :up_to_date_with?
|
|
44
|
+
|
|
43
45
|
def change(message: nil, timestamp: nil)
|
|
44
46
|
yield self
|
|
45
47
|
commit(message: message, timestamp: timestamp)
|
data/lib/mechanomeld/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mechanomeld
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Jim Gay
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A native extension wrapping the Rust automerge crate so Ruby can load,
|
|
14
14
|
read, create, and save Automerge documents shared with JavaScript.
|