1.0.0-dev.20210630 • Published 4 years ago

@nkisi/collections v1.0.0-dev.20210630

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 years ago

Nkisi Collections Library

The Nkisi Collections library implements immutable, structure sharing collections, including B-trees and S-trees (sequence trees).

Overview

B-trees

The BTree class implements the OrderedMap interface from @nkisi/util, and compares keys using Objects.compare, also from @nkisi/util. BTree is internally immutable, enabling lightweight snapshotting via BTree.clone, and non-destructive mutation via BTree.updated, and BTree.removed.

BTree also implements the ReducedMap interface from @nkisi/util, providing storage of sub-tree reductions in b-tree nodes to support log time recomputation of whole tree reductions after incremental updates.

S-trees

The STree class implements a sequential list data type that's backed by an implicitly indexed b-tree. Like BTree, STree supports lightweight snapshotting via STree.clone.

STree associated a unique ID with each list item, which can be used to reconcile concurrent, conflicting updates to the same logical list.