Class BTree<TKey, TValue>
In memory B+Tree.
This class is thread-safe.
Inheritance
BTree<TKey, TValue>
Assembly: ZoneTree.dll
Syntax
public sealed class BTree<TKey, TValue>
Type Parameters
Name |
Description |
TKey |
Key Type
|
TValue |
Value Type
|
Constructors
|
Improve this Doc
View Source
BTree(IRefComparer<TKey>, BTreeLockMode, IIncrementalIdProvider, int, int)
Declaration
public BTree(IRefComparer<TKey> comparer, BTreeLockMode lockMode, IIncrementalIdProvider indexOpProvider = null, int nodeSize = 128, int leafSize = 128)
Parameters
Fields
|
Improve this Doc
View Source
Comparer
Declaration
public readonly IRefComparer<TKey> Comparer
Field Value
|
Improve this Doc
View Source
LockMode
Declaration
public readonly BTreeLockMode LockMode
Field Value
Properties
|
Improve this Doc
View Source
IsReadOnly
Declaration
public bool IsReadOnly { get; set; }
Property Value
|
Improve this Doc
View Source
LastOpIndex
Declaration
public long LastOpIndex { get; }
Property Value
|
Improve this Doc
View Source
Length
Declaration
public int Length { get; }
Property Value
|
Improve this Doc
View Source
OpIndexProvider
Declaration
public IIncrementalIdProvider OpIndexProvider { get; }
Property Value
Methods
|
Improve this Doc
View Source
AddOrUpdate(in TKey, AddDelegate, UpdateDelegate, out long)
Declaration
public AddOrUpdateResult AddOrUpdate(in TKey key, BTree<TKey, TValue>.AddDelegate adder, BTree<TKey, TValue>.UpdateDelegate updater, out long opIndex)
Parameters
Returns
|
Improve this Doc
View Source
ContainsKey(in TKey)
Declaration
public bool ContainsKey(in TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Returns
|
Improve this Doc
View Source
GetFirstIterator()
Declaration
public BTree<TKey, TValue>.NodeIterator GetFirstIterator()
Returns
|
Improve this Doc
View Source
GetFrozenFirstIterator()
Declaration
public BTree<TKey, TValue>.FrozenNodeIterator GetFrozenFirstIterator()
Returns
|
Improve this Doc
View Source
GetFrozenIteratorWithFirstKeyGreaterOrEqual(in TKey)
Declaration
public BTree<TKey, TValue>.FrozenNodeIterator GetFrozenIteratorWithFirstKeyGreaterOrEqual(in TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Returns
|
Improve this Doc
View Source
GetFrozenIteratorWithLastKeySmallerOrEqual(in TKey)
Declaration
public BTree<TKey, TValue>.FrozenNodeIterator GetFrozenIteratorWithLastKeySmallerOrEqual(in TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Returns
|
Improve this Doc
View Source
GetFrozenLastIterator()
Declaration
public BTree<TKey, TValue>.FrozenNodeIterator GetFrozenLastIterator()
Returns
|
Improve this Doc
View Source
GetIteratorWithFirstKeyGreaterOrEqual(in TKey)
Declaration
public BTree<TKey, TValue>.NodeIterator GetIteratorWithFirstKeyGreaterOrEqual(in TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Returns
|
Improve this Doc
View Source
GetIteratorWithLastKeySmallerOrEqual(in TKey)
Declaration
public BTree<TKey, TValue>.NodeIterator GetIteratorWithLastKeySmallerOrEqual(in TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Returns
|
Improve this Doc
View Source
GetLastIterator()
Declaration
public BTree<TKey, TValue>.NodeIterator GetLastIterator()
Returns
|
Improve this Doc
View Source
SetNextOpIndex(long)
Declaration
public void SetNextOpIndex(long nextId)
Parameters
Type |
Name |
Description |
long |
nextId |
|
|
Improve this Doc
View Source
SetTreeReadOnlyAndLockFree()
Converts BTree to lock-free BTree by removing top level locks and
all locks from nodes. It is caller's responsibility
to not to modify the tree after this method is called.
It is also caller's responsibility to ensure all ongoing writes
are already finished.
Declaration
public void SetTreeReadOnlyAndLockFree()
|
Improve this Doc
View Source
TryGetValue(in TKey, out TValue)
Declaration
public bool TryGetValue(in TKey key, out TValue value)
Parameters
Type |
Name |
Description |
TKey |
key |
|
TValue |
value |
|
Returns
|
Improve this Doc
View Source
TryInsert(in TKey, in TValue, out long)
Declaration
public bool TryInsert(in TKey key, in TValue value, out long opIndex)
Parameters
Type |
Name |
Description |
TKey |
key |
|
TValue |
value |
|
long |
opIndex |
|
Returns
|
Improve this Doc
View Source
Upsert(in TKey, in TValue, out long)
Declaration
public bool Upsert(in TKey key, in TValue value, out long opIndex)
Parameters
Type |
Name |
Description |
TKey |
key |
|
TValue |
value |
|
long |
opIndex |
|
Returns
|
Improve this Doc
View Source
Validate()
Declaration
|
Improve this Doc
View Source
ValidateLeafs()
Declaration
public void ValidateLeafs()
|
Improve this Doc
View Source
WriteLock()
Declaration
|
Improve this Doc
View Source
WriteUnlock()
Declaration
public void WriteUnlock()