Documentation
¶
Index ¶
- Constants
- Variables
- func Init(stub cached_stub.CachedStubInterface, logLevel ...shim.LoggingLevel) ([]byte, error)
- type RBTree
- func (t *RBTree) BiggerParent(n node) (node, error)
- func (t *RBTree) DelNode(n node) error
- func (t *RBTree) DelStateCached(key string) error
- func (t *RBTree) FindMin(n node) (node, error)
- func (t *RBTree) FindRoot(n node) (node, error)
- func (t *RBTree) Get(key string) ([]byte, error)
- func (t *RBTree) GetKeyByPartialCompositeKey(objectType string, keys []string) (shim.StateQueryIteratorInterface, error)
- func (t *RBTree) GetKeyByRange(startKey, endKey string) (shim.StateQueryIteratorInterface, error)
- func (t *RBTree) GetNode(key string) (node, error)
- func (t *RBTree) GetNodeLedgerKey(n node) string
- func (t *RBTree) GetRoot() (node, error)
- func (t *RBTree) GetStateCached(key string) ([]byte, error)
- func (t *RBTree) Grandparent(n node) (node, error)
- func (t *RBTree) Insert(key string, value []byte) error
- func (t *RBTree) NewTreeIter(startKey string, endKey string, ascending bool) (*TreeIter, error)
- func (t *RBTree) Parent(n node) (node, error)
- func (t *RBTree) PrintTree(filename string, currentNode interface{}) error
- func (t *RBTree) PutStateCached(key string, value []byte) error
- func (t *RBTree) Remove(key string) error
- func (t *RBTree) RotateLeft(n node) error
- func (t *RBTree) RotateRight(n node) error
- func (t *RBTree) SaveNode(n node) error
- func (t *RBTree) SaveRoot(r node) error
- func (t *RBTree) SaveToLedger() error
- func (t *RBTree) Search(key string) (node, error)
- func (t *RBTree) SearchNext(n node) (node, error)
- func (t *RBTree) Sibling(n node) (node, error)
- func (t *RBTree) Uncle(n node) (node, error)
- type TreeIter
Constants ¶
View Source
const BLACK = "B"
View Source
const LEAF = ""
View Source
const PREFIX = "RBT_"
View Source
const RED = "R"
Variables ¶
View Source
var DEBUG_PRINT_TREE = false
* The following implementation of Red-Black tree has been implemented * following the implementation example of the following site: * https://en.wikipedia.org/wiki/Red%E2%80%93black_tree
View Source
var DEBUG_TREE = false
View Source
var NULL = node{Key: "", Value: nil, Parent: "", Color: BLACK, Left: LEAF, Right: LEAF}
Functions ¶
func Init ¶
func Init(stub cached_stub.CachedStubInterface, logLevel ...shim.LoggingLevel) ([]byte, error)
Init sets up the datastore package by adding default ledger connection.
Types ¶
type RBTree ¶
type RBTree struct { Stub cached_stub.CachedStubInterface Cache map[string][]byte ToDelete map[string]bool TreeName string Prefix string Root string }
func NewRBTree ¶
func NewRBTree(stub cached_stub.CachedStubInterface, treeName string) *RBTree
func (*RBTree) BiggerParent ¶
return the first parent whose key is greater than current node
func (*RBTree) DelStateCached ¶
func (*RBTree) GetKeyByPartialCompositeKey ¶
func (*RBTree) GetKeyByRange ¶
func (t *RBTree) GetKeyByRange(startKey, endKey string) (shim.StateQueryIteratorInterface, error)
func (*RBTree) GetNodeLedgerKey ¶
func (*RBTree) Grandparent ¶
func (*RBTree) NewTreeIter ¶
startKey (inclusive) and endKey (exclusive)
func (*RBTree) RotateLeft ¶
func (*RBTree) RotateRight ¶
func (*RBTree) SaveToLedger ¶
func (*RBTree) SearchNext ¶
search next smallest node whose key is greater than current node n
Click to show internal directories.
Click to hide internal directories.