Tags: y-crdt/y-crdt
Tags
- Biggest breaking change: TransactionMut::apply_update now returns a… … result, which can be errors for cases that previously caused panics. -UndoManager - instead of undo/redo, now we have 3 variants of each try_undo/undo_blocking/undo(async) to reflect new capabilities of asynchronous transactions. - yffi: yundo_manager_can_undo and yundo_manager_can_redo are now replaced by yundo_manager_undo_stack_len and yundo_manager_redo_stack_len - these methods can be used pretty much the same way but they are more capable and carrt more information.
New features - Async transactions #481: introduced yrs::AsyncTransact trait which works in similar way to yrs::Transact except transaction factory methods now return futures that can be awaited on. - make Awareness thread-safe by default #482: Awareness operations now can be executed without &mut Awareness reference and are thread-safe. - implement async y-sync protocol #483: y-sync AsyncProtocol introduced works just like Protocol except it uses new AsyncTransact API to handle transactions required for y-sync protocol message handling in asynchronous way. - alow direct construction of XmlDeltaPrelim #480: XmlDeltaPrelim fields are now exposed. - yffi: - yffi: tests for input and output #484: fixed issue when reading JSON map outputs caused segfaults. - yffi: add operators to interact with JSON strings #485: introduced new API functions that allow to use JSON string as input types (yinput_json), and reading any shared ref contents back as JSON (ybranch_json). Additionally ymap_get_json and yarray_get_json can be used to read individual contents of YArray and YMap as JSON strings. - yffi: ytext_insert_delta function #486: exposes ability to perform many sequential operations defined as deltas through ytext_insert_delta function - especially usefull when copy/pasting long sequences of rich-formatted text. Breaking changes - yffi: renamed YDelta → YDeltaOut. - yrs::Doc::options is no longer available. Instead options fields like auto_load/should_load etc. are now dedicated methods on Doc object. - Doc::collection_id type changed: String → Arc<str>. - yrs::Transact: transact/transact_mut/transact_mut_with methods will no longer panic when transaction cannot be acquired. Instead we'll force waiting at the current thread (which can potentially cause a deadlock). If previous behavior is desired, it can be achieved via doc.try_transact().unwrap() call. - y-sync Protocol methods no longer use &mut Awareness parameter: due to make Awareness thread-safe by default #482 all Awareness method can be called on &Awareness alone. - Awareness no longer exposes clients and meta hashmaps. If you need to access all clients or metas, you can use Awareness::iter instead. - Awareness::local_state/Awareness::state generic constraint changed: Deserialize<'de> → DeserializeOwned.
- New methods: - `Array::get_as` for casting `Out` value getter to strong Rust types. - `Map::get_as` for casting `Out` value getter to strong Rust types. - `Map::try_update` for conditional insertion of values (to prevent unnecessary tombstone generation). - `UndoManager::undo_stack` and `UndoManager::redo_stack` accessor methods to inspect corresponding undo manager data. - Removed `Clone` trait from `UndoManager` as it's unsafe for practical use.
- [x] #438 : make `BranchPtr` and by extension all shared refs, impl `Send` and `Sync`. - [x] #449 : new observers API and Awareness (**breaking changes**). - Awareness support in ywasm. - Awareness update callback signature goes back to it's old shape prior v0.18: `Fn(&Awareness, &AwarenessEvent) + Send + Sync + 'static`. - Awareness now can be generic over type of client state: `Awareness<S>`. That state should be serializable in order to send it beyond process boundaries. - While the methods themselves are still compatible with v0.18, the generic function signature changes: now it requires support for `Send` and `Sync` traits for non-wasm targets in order to support calling methods across threads without undefined behaviours (including accidental memory leaks). - [x] #448 : introduce `Text::apply_delta` method and conversion between `Delta`/`Diff` types. - [ ] ~~#444 : compile yrs into `rlib` format.~~ - [x] #447 : fix inserting nested types into yffi. - [x] #450 : fix vulnerabilities in lib0 v2 encoding. - [x] #460 : new feature flag: `sync` to convert observable callbacks to implement Send+Sync requirements. - [x] #461 : add ability to freely convert between Value and Prelim types and implement `MapRef::get_or_init` using these features. - [x] #459 : rename `Value` → `Out`, introduce `In` which is univeral equivalent for values of any kind but with `Prelim` capabilities. Also Removed generic parameters from prelim types such as `MapPrelim`, `ArrayPrelim`, `TextPrelim` etc. - [x] #462 : removed mandatory shared ref scope when creating `UndoManager`. - [x] fixed: lib0 decoding panicing when bufer size was not decoded to valid usize. - [x] fixed: when encoding document state, pending update was not included as part of an update.
PreviousNext