Closed LSViana closed 1 year ago
Hi, @Horusiath!
I'd like you to take a look at the work I'm doing to create the .NET bindings for Yrs.
The "core" of the work has been happening mostly on the Doc
and DocChannel
classes. They're the public and the native binding classes, respectively.
Everything else around them are tests or helper definitions to interact with the FFI exposed by YFFI. I've been moving slow because I can only work on this in my spare time (and this is not my only side project), but there's been steady progress here.
What do you think?
Also, I'd like to ask you about the Guid()
method exposed by YFFI as ydoc_guid
.
I noticed that, sometimes, the UUID v4 generated contains some internal values like 11
(decimal) that are translated to 0B
. Then, when they're formatted to string, it becomes B
(or b
) instead of 0B
and the final string doesn't match the GUID format that C# expects (it's like characters are missing). Is that fixable somehow? I'd not like to touch (or request changes to) the Yrs code, then if you have a less invasive suggestion, that'd be nice.
I noticed that, sometimes, the UUID v4 generated contains some internal values like
11
(decimal) that are translated to0B
. Then, when they're formatted to string, it becomesB
(orb
) instead of0B
and the final string doesn't match the GUID format that C# expects (it's like characters are missing). Is that fixable somehow? I'd not like to touch (or request changes to) the Yrs code, then if you have a less invasive suggestion, that'd be nice.
I think it should be doable. However keep in mind that the source of that uuid is originally in JavaScript, so it's possible that someone is using arbitrary strings in there - which is also a reason why I went with string representation in Rust.
Implement the bindings for the
Doc
struct based on the exposed bindings.ydoc_new
ydoc_clone
ydoc_destroy
ydoc_new_with_options
ydoc_id
ydoc_guid
ydoc_collection_id
ydoc_should_load
ydoc_auto_load
ydoc_observe_updates_v1
ydoc_unobserve_updates_v1
ydoc_observe_updates_v2
ydoc_unobserve_updates_v2
ydoc_observe_after_transaction
ydoc_unobserve_after_transaction
ydoc_clear
ydoc_observe_clear
ydoc_unobserve_clear
ydoc_read_transaction
ydoc_write_transaction
ydoc_load
ydoc_observe_subdocs
ydoc_unobserve_subdocs
For each bound method, the implementation and unit tests must be written.