Commit graph

64 commits

Author SHA1 Message Date
Jason Kankiewicz
bfa85050b8 Fix Rust code formatting violations. 2022-06-07 00:29:58 -07:00
Jason Kankiewicz
1c78aab5f0 Fixed the AMsyncStateDecode() documentation. 2022-06-07 00:23:41 -07:00
Jason Kankiewicz
ad7dd07cf7 Simplify the names of the unit test suites' source
files.
2022-06-07 00:21:22 -07:00
Jason Kankiewicz
2e84c6e9ef Added AMlistIncrement(). 2022-06-07 00:15:37 -07:00
Jason Kankiewicz
0ecb9e7dce Added AMmapIncrement(). 2022-06-07 00:14:42 -07:00
Jason Kankiewicz
99ab5b4ed7 Added AMgetChangesAdded().
Added `AMpendingOps()`.
Added `AMrollback()`.
Added `AMsaveIncremental()`.
Fixed the `AMmerge()` documentation.
2022-06-07 00:14:11 -07:00
Jason Kankiewicz
8222ec1705 Move the AMsyncHaves.ptr field into the
`sync::haves::Detail` struct.
Change `AMsyncHavesAdvance()`, `AMsyncHavesNext()` and `AMsyncHavesPrev()`
to interpret their `n` argument relatively instead of absolutely.
Renamed `AMsyncHavesReverse()` to `AMsyncHavesReversed()`.
Updated the C API's documentation for the `AMsyncHaves` struct.
2022-06-05 14:41:48 -07:00
Jason Kankiewicz
74632a0512 Move the AMchanges.ptr field into the
`changes::Detail` struct.
Change `AMchangesAdvance()`, `AMchangesNext()` and `AMchangesPrev()` to
interpret their `n` argument relatively instead of absolutely.
Renamed `AMchangesReverse()` to `AMchangesReversed()`.
Updated the C API's documentation for the `AMchanges` struct.
2022-06-05 14:37:32 -07:00
Jason Kankiewicz
7e1ae60bdc Move the AMchangeHashes.ptr field into the
`change_hashes::Detail` struct.
Change `AMchangeHashesAdvance()`, `AMchangeHashesNext()` and
`AMchangeHashesPrev()` to interpret their `n` argument relatively
instead of absolutely.
Renamed `AMchangeHashesReverse()` to `AMchangeHashesReversed()`.
Updated the C API's documentation for the `AMchangeHashes` struct.
2022-06-05 14:32:55 -07:00
Jason Kankiewicz
92d6fff22f Compensate for the removal of the AMchanges.ptr
member.
2022-06-05 14:28:33 -07:00
Jason Kankiewicz
92f3efd6e0 Removed the 0 argument from AMresultValue()
calls.
2022-06-04 22:31:15 -07:00
Jason Kankiewicz
31fe8dbb36 Renamed the AMresult::Scalars variant to
`AMresult::Value`.
Removed the `Vec` wrapping the 0th field of an `AMresult::Value`.
Removed the `index` argument from `AMresultValue()`.
2022-06-04 22:24:02 -07:00
Jason Kankiewicz
d4d1b64cf4 Compensate for cbindgen issue #252. 2022-06-04 19:18:47 -07:00
Jason Kankiewicz
92b1216101 Obfuscated most implementation details of the
`AMsyncHaves` struct.
Added `AMsyncHavesReverse()`.
2022-06-04 19:14:31 -07:00
Jason Kankiewicz
1990f29c60 Obfuscated most implementation details of the
`AMChanges` struct.
Added `AMchangesReverse()`.
2022-06-04 19:13:22 -07:00
Jason Kankiewicz
b38be0750b Obfuscated most implementation details of the
`AMChangeHashes` struct.
Added `AMchangeHashesReverse()`.
2022-06-04 18:51:57 -07:00
Jason Kankiewicz
afddf7d508 Fix "fmt" script violations.
Fix "lint" script violations.
2022-06-01 23:34:28 -07:00
Jason Kankiewicz
ca383f03e4 Wrapped all newly-allocated values in an AMresult struct.
Removed `AMfree()`.
Renamed `AMresultFree()` to `AMfree()`.
Removed type names from brief descriptions.
2022-06-01 23:10:23 -07:00
Jason Kankiewicz
fbdb5da508 Ported 17 synchronization unit test cases from JS
to C.
2022-05-30 23:17:44 -07:00
Jason Kankiewicz
cdcd5156db Added the synchronization unit test suite to the
CTest suite.
2022-05-30 23:16:14 -07:00
Jason Kankiewicz
d08eeeed61 Renamed AMfreeDoc() to AMFree(). 2022-05-30 23:15:20 -07:00
Jason Kankiewicz
472b5dc348 Added the synchronization unit test suite to the
CTest suite.
2022-05-30 23:14:38 -07:00
Jason Kankiewicz
846b96bc9a Renamed AMfreeResult() to AMresultFree(). 2022-05-30 23:11:56 -07:00
Jason Kankiewicz
4cb7481a1b Moved the AMsyncState struct into its own
source file.
Added `AMsyncStateDecode()`.
Added `AMsyncStateEncode()`.
Added `AMsyncStateEqual()`.
Added `AMsyncStateSharedHeads()`.
Added `AMsyncStateLastSentHeads()`.
Added `AMsyncStateTheirHaves()`.
Added `AMsyncStateTheirHeads()`.
Added `AMsyncStateTheirNeeds()`.
2022-05-30 23:07:55 -07:00
Jason Kankiewicz
3c11946c16 Moved the AMsyncMessage struct into its own
source file.
Added `AMsyncMessageChanges()`.
Added `AMsyncMessageDecode()`.
Added `AMsyncMessageEncode()`.
Added `AMsyncMessageHaves()`.
Added `AMsyncMessageHeads()`.
Added `AMsyncMessageNeeds()`.
2022-05-30 22:58:45 -07:00
Jason Kankiewicz
c5d3d1b0a0 Added the AMsyncHaves struct.
Added `AMsyncHavesAdvance()`.
Added `AMsyncHavesNext()`.
Added `AMsyncHavesPrev()`.
Added `AMsyncHavesSize()`.
2022-05-30 22:55:34 -07:00
Jason Kankiewicz
be3c7d6233 Added the AMsyncHave struct.
Added `AMsyncHaveLastSync()`.
2022-05-30 22:54:02 -07:00
Jason Kankiewicz
9213d43850 Grouped some common macros and functions into
their own source file.
2022-05-30 22:53:09 -07:00
Jason Kankiewicz
18ee9b71e0 Grouped the AMmap*() functions into their own
source file.
2022-05-30 22:52:02 -07:00
Jason Kankiewicz
a9912d4b9f Grouped the AMlist*() functions into their own
source file.
2022-05-30 22:51:41 -07:00
Jason Kankiewicz
d9bf29e8fd Grouped AMsyncMessage and AMsyncState into
separate source files.
2022-05-30 22:50:26 -07:00
Jason Kankiewicz
546b6ccbbd Moved AMobjId into its own source file.
Added the `AMvalue::SyncState` variant.
Enabled `AMchange` structs to be lazily created.
Added the `AMresult::SyncState` variant.
Added an `Option<&automerge::Change>` conversion for `AMresult`.
Added a `Result<automerge::Change, automerge::DecodingError>` conversion
for `AMresult`.
Added a `Result<automerge::sync::Message, automerge::DecodingError>`
conversion for `AMresult`.
Added a `Result<automerge::sync::State, automerge::DecodingError>`
conversion for `AMresult`.
Moved `AMerrorMessage()` and `AMresult*()` into the source file for
`AMresult`.
2022-05-30 22:49:23 -07:00
Jason Kankiewicz
bb0b023c9a Moved AMobjId into its own source file. 2022-05-30 22:37:22 -07:00
Jason Kankiewicz
c3554199f3 Grouped related AM*() functions into separate source files. 2022-05-30 22:36:26 -07:00
Jason Kankiewicz
e56fe64a18 Added AMapplyChanges().
Fixed `AMdup()`.
Added `AMequal()`.
Renamed `AMfreeDoc()` to `AMfree()`.
Added `AMgetHeads()`.
Added `AMgetMissingDeps()`.
Added `AMgetLastLocalChange()`.
2022-05-30 22:34:01 -07:00
Jason Kankiewicz
007253d6ae Updated the file dependencies of the CMake custom
command for Cargo.
2022-05-30 22:27:14 -07:00
Jason Kankiewicz
e8f1f07f21 Changed AMchanges to lazily create AMchange structs.
Renamed `AMadvanceChanges()` to `AMchangesAdvance()`.
Added `AMchangesEqual()`.
Renamed `AMnextChange()` to `AMchangesNext()`.
Renamed `AMprevChange()` to `AMchangesPrev()`.
2022-05-30 22:24:53 -07:00
Jason Kankiewicz
3ad979a178 Added AMchangeActorId().
Added `AMchangeCompress()`.
Added `AMchangeDeps()`.
Added `AMchangeExtraBytes()`.
Added `AMchangeFromBytes()`.
Added `AMchangeHash()`.
Added `AMchangeIsEmpty()`.
Added `AMchangeMaxOp()`.
Added `AMchangeMessage()`.
Added `AMchangeSeq()`.
Added `AMchangeSize()`.
Added `AMchangeStartOp()`.
Added `AMchangeTime()`.
Added `AMchangeRawBytes()`.
Added `AMchangeLoadDocument()`.
2022-05-30 22:19:54 -07:00
Jason Kankiewicz
fb0ea2c7a4 Renamed AMadvanceChangeHashes() to AMchangeHashesAdvance().
Added `AMchangeHashesCmp()`.
Renamed `AMnextChangeHash()` to `AMchangeHashesNext()`.
2022-05-30 22:12:03 -07:00
Jason Kankiewicz
a31a65033f Renamed AMfreeResult() to AMresultFree().
Renamed `AMfreeDoc()` to `AMfree()`.
Renamed `AMnextChange()` to `AMchangesNext()`.
Renamed `AMgetMessage()` to `AMchangeMessage()`.
2022-05-30 22:08:27 -07:00
Jason Kankiewicz
5765fea771 Renamed AMfreeResult() to AMresultFree().
Remove the `&AMchange` conversion for `AMbyteSpan`.
Add a `&automerge::ActorId` conversion to for `AMbyteSpan`.
Remove the `&Vec<u8>` conversion for `AMbyteSpan`.
Add a `&[u8]` conversion for `AMbyteSpan`.
2022-05-30 22:06:22 -07:00
Jason Kankiewicz
4bed03f008 Added the AMsyncMessage struct.
Added the `AMsyncState` struct.
Added the `AMfreeSyncState()` function.
Added the `AMgenerateSyncMessage()` function.
Added the `AMinitSyncState()` function.
Added the `AMreceiveSyncMessage()` function.
2022-05-30 08:22:17 -07:00
Andrew Jeffery
933bf5ee07 Return an error when getting clock for missing hash 2022-05-20 10:05:08 +01:00
Jason Kankiewicz
fdd3880bd3 Renamed AMalloc() to AMcreate().
Renamed `AMload()` to `AMloadIncremental()`.
Added the `AMload()` function.
2022-05-07 09:55:05 -05:00
Jason Kankiewicz
b56464c2e7 Switched to C comment delimiting. 2022-05-06 04:59:47 -05:00
Jason Kankiewicz
bb3d75604a Improved the documentation slightly. 2022-05-06 04:51:44 -05:00
Jason Kankiewicz
eb3155e49b Sorted main() to the top. Documented test(). 2022-05-06 04:50:02 -05:00
Jason Kankiewicz
944e5d8001 Trap and report all errors. 2022-05-05 21:21:46 -05:00
Orion Henry
dc441a1a61
Merge pull request #360 from jkankiewicz/add_quickstart
Add a port of Rust's quickstart to the C API
2022-05-04 10:28:14 -04:00
Jason Kankiewicz
729752dac2 De-emphasized the AMload() call's result. 2022-05-04 08:27:15 -05:00