Skip to content

How do I incrementally update doc_state and state_vector #4

@huang12zheng

Description

@huang12zheng

It seems to update doc_state and state_vector in full every time, how can it be incremental?

https://github.com/y-crdt/yrs-persistence/blob/a94b086b987a066d98b7d36a13bd540fca1722ee/yrs-kvstore/src/lib.rs

/// Inserts or updates a document given it's read transaction and name. lib0 v1 encoding is
    /// used for storing the document.
    ///
    /// This feature requires a write capabilities from the database transaction.
    fn insert_doc<K: AsRef<[u8]> + ?Sized, T: ReadTxn>(
        &self,
        name: &K,
        txn: &T,
    ) -> Result<(), Error> {
        let doc_state = txn.encode_diff_v1(&StateVector::default());
        let state_vector = txn.state_vector().encode_v1();
        self.insert_doc_raw_v1(name.as_ref(), &doc_state, &state_vector)
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions