VersionedHashDBM class
A VersionedDBM implementation that wraps HashDBM with delta overlay transactions and version history.
- Implemented types
Constructors
- VersionedHashDBM(RandomAccessFile file, {int buckets = 10007, bool flush = true, bool crc = false, bool readonly = false})
-
Open a versioned database. The
fileshould be opened with the same mode semantics as HashDBM. Optional parameters match HashDBM.
Properties
- current → int
-
Current (latest) version number.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
versions
→ List<
int> -
List of available versions (base..current).
no setteroverride
Methods
-
apply(
Map< BytesKey, Uint8List?> pending) → void - Apply a set of pending changes as a new delta version.
-
at(
int version) → DBM -
Read-only view at a specific version.
override
-
begin(
) → Transaction -
Start a new transaction.
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
-
entriesAt(
int version) → Iterator< MapEntry< Uint8List, Uint8List> > - Iterate entries at a specific version, merging base + deltas.
-
flatten(
) → void -
Merge all deltas into the base table and convert to plain format.
After flattening, the file can be reopened with plain HashDBM.
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 -
merge(
{int? through}) → void -
Merge deltas through the given version into the base table.
If
throughis null, merges all deltas through current.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 -
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 -
resolve(
Uint8List key, int version) → Uint8List? - Resolve a key at a specific version by scanning deltas then base.
-
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