y-crdt / ydotnet

.NET bindings for yrs.
MIT License
29 stars 9 forks source link

Integrate new method ytransaction_alive #63

Closed SebastianStehle closed 2 weeks ago

SebastianStehle commented 8 months ago

See

/// 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
/// execute any functions using it.
#[no_mangle]
pub unsafe extern "C" fn ytransaction_alive(txn: *const Transaction, branch: *mut Branch) -> u8 {
    if branch.is_null() {
        Y_FALSE
    } else {
        let txn = txn.as_ref().unwrap();
        let branch = branch.as_ref().unwrap();
        if txn.store().is_alive(&BranchPtr::from(branch)) {
            Y_TRUE
        } else {
            Y_FALSE
        }
    }
SebastianStehle commented 8 months ago

@LSViana Can you pull the latest version to your fork so we can create new binaries?

SebastianStehle commented 8 months ago

I tried to use the official repo, not your fork, but so far my build does not work and I don't know why. I added an action to patch the Cargo.toml and it does not work. But I don't know why:

sed: can't read yrs/yffi/Cargo.toml: No such file or directory
LSViana commented 8 months ago

@SebastianStehle I just did it, can you try again now?

SebastianStehle commented 8 months ago

Sorry, I tried something else. I used the original repository and then apply a patch for the small changes that we need.

But I am not so sure if this new method brings us forward in the goal to have better pointer safety, as there are a lot of uncovered methods: https://github.com/y-crdt/y-crdt/issues/347#issuecomment-1826260014

LSViana commented 8 months ago

Hi, @SebastianStehle!

I couldn't join the meeting last week and I didn't follow the discussion closely so far either, but I'll try to get more details during the next meeting to see how I can help.