FlutterKevyBindings class
Bindings for the kevy-ffi C ABI (crates/kevy-ffi/include/kevy.h).
Regenerate with dart run ffigen --config ffigen.yaml.
Constructors
- FlutterKevyBindings(DynamicLibrary dynamicLibrary)
-
The symbols are looked up in
dynamicLibrary. -
FlutterKevyBindings.fromLookup(Pointer<
T> lookup<T extends NativeType>(String symbolName) ) -
The symbols are looked up with
lookup.
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
-
kevy_abi(
) → int - Runtime ABI version; compare against KEVY_ABI at startup.
-
kevy_buf_free(
Pointer< Uint8> ptr, int len, int cap) → void - Free any KevyBuf returned by this library: pass its three fields unchanged. Scalars, not the struct by value — indirect struct passing (AArch64, >16 bytes) is beyond several FFI loaders. Null ptr = no-op.
- Free a KevyBuf from kevy_get_shared(): pass all three fields unchanged (cap is a tagged owner handle — an Arc for a bulk value or a Vec for a small one). Pairs 1:1 with kevy_get_shared; do NOT mix with kevy_buf_free.
-
kevy_close(
Pointer< KevyDbHandle> db) → void - Close the store. The handle must not be used afterwards.
-
kevy_cmd(
Pointer< KevyDbHandle> db, int argc, Pointer<Pointer< argv, Pointer<Uint8> >Size> argv_len, Pointer<KevyBuf> out) → int -
Execute one command; argv
0is the verb ("SET", "IDX.CREATE", …). Writes the RESP reply to *out. Returns 0 on success — note a protocol error (-ERR …) is still a successful call with a RESP error in *out. Non-zero = the call itself was misused; *out is empty, do not free. -
kevy_get(
Pointer< KevyDbHandle> db, Pointer<Uint8> key, int key_len, Pointer<KevyBuf> out) → int - Scalar fast path — GET/SET without argv or RESP framing. The lane the mobile bindings' hot loop lives on. kevy_get: 1 hit / 0 miss / neg misuse; kevy_set: 0 ok / neg misuse (ttl_ms 0 = no TTL).
- Zero-copy GET: a bulk value comes back as an Arc clone (refcount bump, no byte copy) whose bytes the returned buffer VIEWS — the analog of MMKV returning a view of its mmap page. In the out KevyBuf, ptr/len are the value view; cap is an OPAQUE owner handle. Free ONLY with kevy_buf_free_shared() (NOT kevy_buf_free). 1 hit / 0 miss / neg misuse.
-
kevy_open(
Pointer< Uint8> dir, int dir_len) → Pointer<KevyDbHandle> - Open a persistent store rooted at dir (UTF-8, dir_len bytes, no NUL needed). Replays its log on open. NULL on failure.
-
kevy_open_mem(
) → Pointer< KevyDbHandle> - Open a pure in-memory store — nothing survives the process.
-
kevy_open_report(
Pointer< KevyDbHandle> db, Pointer<KevyOpenReport> out) → int - Fill *out with db's open verdict. 0 = ok, -1 = misuse.
-
kevy_open_with(
Pointer< Uint8> dir, int dir_len, Pointer<KevyOpenOptions> opts) → Pointer<KevyDbHandle> - kevy_open with explicit options: durable at dir when dir != NULL, in-memory when dir == NULL && dir_len == 0. NULL opts = kevy_open's defaults. NULL on failure.
-
kevy_psubscribe(
Pointer< KevyDbHandle> db, Pointer<Uint8> pat, int pat_len) → Pointer<KevySubHandle> -
kevy_publish(
Pointer< KevyDbHandle> db, Pointer<Uint8> chan, int chan_len, Pointer<Uint8> payload, int payload_len) → int - Scalar publish — PUBLISH without the RESP round-trip (no argv packing, no reply buffer). Delivers to every in-process subscriber (direct + pattern) and returns the receiver count; -1 on misuse.
-
kevy_set(
Pointer< KevyDbHandle> db, Pointer<Uint8> key, int key_len, Pointer<Uint8> val, int val_len, int ttl_ms) → int -
kevy_shutdown(
Pointer< KevyDbHandle> db) → int - Flush every shard's AOF (a REAL fsync), write the feed continuity marker, then refuse every later write (reads stay available) — the deterministic teardown: kevy_shutdown(db); exit(0). Idempotent. 0 = ok, -1 = misuse, -2 = I/O failure (store still usable; retry).
-
kevy_sub_close(
Pointer< KevySubHandle> sub) → void - Close the subscription (unsubscribes everything it held).
-
kevy_sub_next(
Pointer< KevySubHandle> sub, Pointer<KevyBuf> out) → int - Drain one pending frame without blocking. 1 = frame written to *out (RESP array: message / pmessage / acks); 0 = nothing queued; negative = misuse.
-
kevy_sub_next_raw(
Pointer< KevySubHandle> sub, Pointer<KevyBuf> out) → int - Scalar drain — the raw message payload only, no RESP framing (the pub/sub analog of kevy_get). Skips control/ack frames, moves the payload into *out. For a known-channel push subscriber that only wants the bytes; the channel and message-vs-pmessage distinction are lost (a pattern subscriber that needs the channel keeps using kevy_sub_next). 1 = payload written to *out; 0 = nothing queued; negative = misuse.
-
kevy_sub_wait(
Pointer< KevySubHandle> sub, int timeout_ms, Pointer<KevyBuf> out) → int - Block until one frame is queued or timeout_ms elapses (0 = wait forever). Parks the thread — no busy-poll — so a push-style poller can wait in the kernel instead of spinning kevy_sub_next. 1 = frame written to *out; 0 = timeout; negative = misuse / bus closed.
-
kevy_sub_wait_raw(
Pointer< KevySubHandle> sub, int timeout_ms, Pointer<KevyBuf> out) → int - Blocking kevy_sub_next_raw: parks up to timeout_ms (0 = wait forever). 1 = payload written to *out; 0 = timeout OR a control/ack frame was consumed (no payload) — re-wait; negative = misuse / bus closed.
-
kevy_subscribe(
Pointer< KevyDbHandle> db, Pointer<Uint8> chan, int chan_len) → Pointer<KevySubHandle> - Subscribe to one channel / one glob pattern. NULL on failure.
-
kevy_version(
) → Pointer< Char> - Engine version, e.g. "4.0.0". Static string — do not free.
-
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