serializable-bptree 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/cjs/index.cjs +436 -121
- package/dist/esm/index.mjs +436 -121
- package/dist/types/BPTreeAsync.d.ts +3 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -479,7 +479,15 @@ To solve this problem, it's necessary to update the cached nodes. The forceUpdat
|
|
|
479
479
|
|
|
480
480
|
### Concurrency Issue in Asynchronous Trees
|
|
481
481
|
|
|
482
|
-
This issue occurs only in asynchronous trees and can also occur in a 1:1 relationship between remote storage and client.
|
|
482
|
+
This issue occurs only in asynchronous trees and can also occur in a 1:1 relationship between remote storage and client.
|
|
483
|
+
|
|
484
|
+
Since version 5.x.x, **serializable-bptree** provides a built-in read/write lock for the `BPTreeAsync` class to prevent data inconsistency during concurrent operations. Calling public methods like `insert`, `delete`, `where`, `exists`, `keys`, `setHeadData`, and `forceUpdate` will automatically acquire the appropriate lock.
|
|
485
|
+
|
|
486
|
+
However, please be aware of the following technical limitations:
|
|
487
|
+
- **Locking is only applied to public methods**: The internal `protected` methods (e.g., `_insertInParent`, `_deleteEntry`, etc.) do not automatically acquire locks.
|
|
488
|
+
- **Inheritance Caution**: If you extend the `BPTreeAsync` class and call `protected` methods directly, you must manually manage the locks using `readLock` or `writeLock` to ensure data integrity.
|
|
489
|
+
|
|
490
|
+
Despite these safeguards, it is still recommended to avoid unnecessary concurrent operations whenever possible to maintain optimal performance and predictability.
|
|
483
491
|
|
|
484
492
|
## LICENSE
|
|
485
493
|
|