BTreeDBM class
B+tree implementation of SortedDBM. Stores tree nodes as entries in an underlying DBM (typically HashDBM).
Node IDs are sequential uint64s encoded as 8-byte big-endian keys. ID 0 is reserved for the meta record.
- Implemented types
Constructors
- BTreeDBM(RandomAccessFile file, {int order = 128, int buckets = 49999, bool flush = true, bool crc = false, int cache = 256, KeyComparator? comparator})
-
Create a new BTreeDBM that owns a HashDBM built from
file. - BTreeDBM.wrap(DBM store, {int order = 128, int cache = 256, KeyComparator? comparator})
-
Wrap an existing DBM as storage. The caller retains ownership
of
storeand is responsible for closing it.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
ceiling(
Uint8List key) → MapEntry< Uint8List, Uint8List> ? -
Return the smallest entry with key greater than or equal to
key, or null if no such entry exists.override -
clear(
) → void -
Erases all data and resets the internal structure, but does not reclaim
storage.
override
-
close(
) → void -
flush() and close the underlying file.
override
-
compact(
) → int -
Truncate trailing free blocks at end-of-file and return bytes reclaimed.
override
-
count(
) → int -
Get the number of records stored in the database as a
Uint64override -
entries(
) → Iterator< MapEntry< Uint8List, Uint8List> > -
Iterate over all keys and values in the database
override
-
first(
) → MapEntry< Uint8List, Uint8List> ? -
Return the first (smallest) entry, or null if empty.
override
-
floor(
Uint8List key) → MapEntry< Uint8List, Uint8List> ? -
Return the greatest entry with key less than or equal to
key, or null if no such entry exists.override -
flush(
) → void -
Flush all data to external storage.
override
-
get(
Uint8List key) → Uint8List? -
Get a value from the database using
key, or else returnnulloverride -
last(
) → MapEntry< Uint8List, Uint8List> ? -
Return the last (largest) entry, or null if empty.
override
-
modified(
) → DateTime -
Get the last time the database was opened or modified.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
Uint8List key, Uint8List value) → Uint8List? -
Add a
key,valuepair to the underlying store, overwriting any existing values. Returns the old value if one existed, otherwise returns the new value.override -
putIfAbsent(
Uint8List key, Uint8List value) → Uint8List -
Add a
key,valuepair to the underlying store if not key is in the underlying store. Returns the old value ifkeyexisted, otherwisevalueis returned.override -
range(
{Uint8List? start, Uint8List? end}) → Iterator< MapEntry< Uint8List, Uint8List> > -
Iterate entries in sorted order from
start(inclusive) toend(exclusive). Ifstartis null, iteration begins at the first key. Ifendis null, iteration continues through the last key.override -
remove(
Uint8List key) → Uint8List? -
Remove a value from the database using
key. If the key had an associated value, return the value or else returnnulloverride -
size(
) → int -
Get the size, in bytes, of data stored. This is intended to track
approximate data size and will differ from the size of the file itself.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
version(
) → int -
Get the version of the underlying implementation as a 32bit integer.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited