NativeWorker class final
The isolate that runs every call into one native library, alive while a database of that library is open.
Why an isolate: a native call blocks its thread until LMDB answers (a durable commit waits for the disk). Running them here keeps the caller's isolate — the UI, in an app — free. Requests are served in order and matched to their replies by id.
Why it stops: its reply port, open in the caller's isolate, would keep a program alive forever after its last database closed (a CLI that never ends), and the isolate would stay in memory in an app that keeps running. When the last handle is closed and no call is pending, it closes that port and ends the isolate; the next open starts a new worker.
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
-
close(
int handle) → Future< Result< String, DbError> > -
Releases
handle. -
closeV2(
int handle) → Future< Result< (), DbError> > -
Releases
handleof the ABI v2. -
execute(
int handle, String request) → Future< Result< String, DbError> > -
Runs one JSON
requestof the protocol onhandle. -
executeV2(
int handle, String request) → Future< Result< String, DbError> > -
Runs one JSON
requestonhandleof the ABI v2. -
keyValue(
int handle, KeyValueCall call, String? argument) → Future< Result< String, DbError> > -
Runs one key-value
callonhandle. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
NativeSymbols symbols) → Future< NativeWorker> -
The running worker of the library of
symbols, started on demand. -
openOn(
NativeSymbols symbols, String path, String options, {bool abiV2 = false}) → Future< Result< (NativeWorker, int), DbError> > -
Opens
<path>.lmdbwithoptions(JSON) on a running worker ofsymbols: answers the worker and the handle, or the error the engine answered (such as DbErrorCode.legacyFormat).