github.com/BlockABC/godash@v0.0.0-20191112120524-f4aa3a32c566/database/internal/treap/README.md (about)

     1  treap
     2  =====
     3  
     4  [![Build Status](https://travis-ci.org/dashpay/godash.png?branch=master)]
     5  (https://travis-ci.org/dashpay/godash)
     6  
     7  Package treap implements a treap data structure that is used to hold ordered
     8  key/value pairs using a combination of binary search tree and heap semantics.
     9  It is a self-organizing and randomized data structure that doesn't require
    10  complex operations to to maintain balance.  Search, insert, and delete
    11  operations are all O(log n).  Both mutable and immutable variants are provided.
    12  
    13  The mutable variant is typically faster since it is able to simply update the
    14  treap when modifications are made.  However, a mutable treap is not safe for
    15  concurrent access without careful use of locking by the caller and care must be
    16  taken when iterating since it can change out from under the iterator.
    17  
    18  The immutable variant works by creating a new version of the treap for all
    19  mutations by replacing modified nodes with new nodes that have updated values
    20  while sharing all unmodified nodes with the previous version.  This is extremely
    21  useful in concurrent applications since the caller only has to atomically
    22  replace the treap pointer with the newly returned version after performing any
    23  mutations.  All readers can simply use their existing pointer as a snapshot
    24  since the treap it points to is immutable.  This effectively provides O(1)
    25  snapshot capability with efficient memory usage characteristics since the old
    26  nodes only remain allocated until there are no longer any references to them.
    27  
    28  Package treap is licensed under the copyfree ISC license.
    29  
    30  ## Usage
    31  
    32  This package is only used internally in the database code and as such is not
    33  available for use outside of it.
    34  
    35  ## Documentation
    36  
    37  [![GoDoc](https://godoc.org/github.com/dashpay/godash/database/internal/treap?status.png)]
    38  (http://godoc.org/github.com/dashpay/godash/database/internal/treap)
    39  
    40  Full `go doc` style documentation for the project can be viewed online without
    41  installing this package by using the GoDoc site here:
    42  http://godoc.org/github.com/dashpay/godash/database/internal/treap
    43  
    44  You can also view the documentation locally once the package is installed with
    45  the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to
    46  http://localhost:6060/pkg/github.com/dashpay/godash/database/internal/treap
    47  
    48  ## License
    49  
    50  Package treap is licensed under the [copyfree](http://copyfree.org) ISC
    51  License.