Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing logical collection pointers #393

Merged
merged 30 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cd15621
moved Branch, BranchPtr to branch.rs
Horusiath Feb 11, 2024
877499a
introduced RootRefs
Horusiath Feb 15, 2024
4ab1faf
exposed Root and Nested types
Horusiath Feb 16, 2024
73d2626
Working YArray on ywasm
Horusiath Feb 22, 2024
7afa7b9
ywasm: YDoc and YTransaction methods
Horusiath Feb 22, 2024
c1f1ce4
ywasm: working YArray
Horusiath Feb 24, 2024
fb8073c
ywasm: prepared UndoManager
Horusiath Feb 24, 2024
6c38c3d
ywasm: prepared WeakLink
Horusiath Feb 24, 2024
3e98907
ywasm: flattened YDoc
Horusiath Feb 24, 2024
d33f946
ywasm: make YDoc compilable through wasm-interpreter
Horusiath Feb 29, 2024
064444c
ywasm: support YWeakLink
Horusiath Feb 29, 2024
5d24059
ywasm: support YMap
Horusiath Feb 29, 2024
ddf8a8a
ywasm: support YText
Horusiath Feb 29, 2024
5b1f1d8
ywasm: support XML types
Horusiath Mar 2, 2024
d45b345
ywasm: support for snapshots and sticky indexes
Horusiath Mar 3, 2024
7d60a01
ywasm: first batch of fixes
Horusiath Mar 7, 2024
9054653
ywasm: second batch of fixes
Horusiath Mar 7, 2024
56c8963
ywasm: third batch of fixes
Horusiath Mar 8, 2024
7f137df
ywasm: fourth batch of fixes
Horusiath Mar 8, 2024
b07878e
ywasm: fixed remaining tests
Horusiath Mar 8, 2024
19cdcd8
exposed logical IDs in ywasm API
Horusiath Mar 8, 2024
9b70f79
added documentation
Horusiath Mar 8, 2024
e732534
fixed doc.rs example
Horusiath Mar 8, 2024
7d50569
updated yffi tests
Horusiath Mar 8, 2024
9ed4e5d
added BranchID to yffi
Horusiath Mar 8, 2024
80dbfba
yffi: fixed one test
Horusiath Mar 8, 2024
10e6f1c
yffi: fixed event target resolution
Horusiath Mar 8, 2024
a105298
wtf 1
Horusiath Mar 8, 2024
00f8e48
added test for logical branches
Horusiath Mar 9, 2024
10f3b6d
fixed c ffi tests
Horusiath Mar 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated yffi tests
  • Loading branch information
Horusiath committed Mar 8, 2024
commit 7d50569ca55416e0c4ad8952fc4b81139ac098bb
40 changes: 3 additions & 37 deletions tests-ffi/include/libyrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,12 @@ typedef struct YOptions {
} YOptions;

/**
* A Yrs document type. Documents are most important units of collaborative resources management.
* A Yrs document type. Documents are the most important units of collaborative resources management.
* All shared collections live within a scope of their corresponding documents. All updates are
* generated on per document basis (rather than individual shared type). All operations on shared
* generated on per-document basis (rather than individual shared type). All operations on shared
* collections happen via `YTransaction`, which lifetime is also bound to a document.
*
* Document manages so called root types, which are top-level shared types definitions (as opposed
* Document manages so-called root types, which are top-level shared types definitions (as opposed
* to recursively nested types).
*/
typedef YDoc YDoc;
Expand Down Expand Up @@ -1114,26 +1114,6 @@ YTransaction *ydoc_read_transaction(YDoc *doc);
*/
YTransaction *ydoc_write_transaction(YDoc *doc, uint32_t origin_len, const char *origin);

/**
* Starts a new read-write transaction on a given branches document. All other operations happen in
* context of a transaction. Yrs transactions do not follow ACID rules. Once a set of operations is
* complete, a transaction can be finished using `ytransaction_commit` function.
*
* Returns `NULL` if read-write transaction couldn't be created, i.e. when another transaction is
* already opened.
*/
YTransaction *ybranch_write_transaction(Branch *branch);

/**
* Starts a new read-only transaction on a given branches document. All other operations happen in
* context of a transaction. Yrs transactions do not follow ACID rules. Once a set of operations is
* complete, a transaction can be finished using `ytransaction_commit` function.
*
* Returns `NULL` if read-only transaction couldn't be created, i.e. when another read-write
* transaction is already opened.
*/
YTransaction *ybranch_read_transaction(Branch *branch);

/**
* Check if current branch is still alive (returns `Y_TRUE`, otherwise `Y_FALSE`).
* If it was deleted, this branch pointer is no longer a valid pointer and cannot be used to
Expand Down Expand Up @@ -1197,27 +1177,13 @@ Branch *yarray(YDoc *doc,
*/
Branch *ymap(YDoc *doc, const char *name);

/**
* Gets or creates a new shared `YXmlElement` data type instance as a root-level type of a given
* document. This structure can later be accessed using its `name`, which must be a null-terminated
* UTF-8 compatible string.
*/
Branch *yxmlelem(YDoc *doc, const char *name);

/**
* Gets or creates a new shared `YXmlElement` data type instance as a root-level type of a given
* document. This structure can later be accessed using its `name`, which must be a null-terminated
* UTF-8 compatible string.
*/
Branch *yxmlfragment(YDoc *doc, const char *name);

/**
* Gets or creates a new shared `YXmlText` data type instance as a root-level type of a given
* document. This structure can later be accessed using its `name`, which must be a null-terminated
* UTF-8 compatible string.
*/
Branch *yxmltext(YDoc *doc, const char *name);

/**
* Returns a state vector of a current transaction's document, serialized using lib0 version 1
* encoding. Payload created by this function can then be send over the network to a remote peer,
Expand Down
9 changes: 6 additions & 3 deletions tests-ffi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ TEST_CASE("YMap basic") {

TEST_CASE("YXmlElement basic") {
YDoc* doc = ydoc_new_with_id(1);
Branch* xml = yxmlelem(doc, "test");
Branch* frag = yxmlfragment(doc, "test");
YTransaction* txn = ydoc_write_transaction(doc, 0, NULL);
Branch* xml = yxmlelem_insert_elem(frag, txn, 0, "div");

// XML attributes API
yxmlelem_insert_attr(xml, txn, "key1", "value1");
Expand Down Expand Up @@ -832,8 +833,9 @@ void yxmltext_test_clean(YXmlTextEventTest* t) {

TEST_CASE("YXmlText observe") {
YDoc* doc = ydoc_new_with_id(1);
Branch* txt = yxmltext(doc, "test");
Branch* frag = yxmlfragment(doc, "test");
YTransaction* txn = ydoc_write_transaction(doc, 0, NULL);
Branch* txt = yxmlelem_insert_text(frag, txn, 0);

YXmlTextEventTest* t = yxmltext_event_test_new();
YSubscription* sub = yxmltext_observe(txt, (void*)t, &yxmltext_test_observe);
Expand Down Expand Up @@ -926,8 +928,9 @@ void yxml_test_clean(YXmlEventTest* t) {

TEST_CASE("YXmlElement observe") {
YDoc* doc = ydoc_new_with_id(1);
Branch* xml = yxmlelem(doc, "test");
Branch *frag = yxmlfragment(doc, "test");
YTransaction* txn = ydoc_write_transaction(doc, 0, NULL);
Branch* xml = yxmlelem_insert_elem(frag, txn, 0, "div");

YXmlEventTest* t = yxml_event_test_new();
YSubscription* sub = yxmlelem_observe(xml, (void*)t, &yxml_test_observe);
Expand Down
Loading