From 442ae050886eaf731034c15fc5a37d99c74ebcc5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Mar 2025 22:12:42 +0800 Subject: [PATCH] Add basic types --- lmdb/types.ha | 32 ++++++++++++++++++++++++++++++++ diff --git a/lmdb/types.ha b/lmdb/types.ha new file mode 100644 index 0000000000000000000000000000000000000000..a74543ac2a6a86444838079861d9d29ff1deeb20 --- /dev/null +++ b/lmdb/types.ha @@ -0,0 +1,32 @@ +// Opaque structure for navigating through a database +export type cursor = opaque; + +// A handle for an individual database in the DB environment. +export type dbi = uint; + +// Opaque structure for a database environment. +// +// A DB environment supports multiple databases, all residing in the same +// shared-memory map. +export type env = opaque; + +// Opaque structure for a transaction handle. +// +// All database operations require a transaction handle. Transactions may be +// read-only or read-write. +export type txn = opaque; + +// Generic structure used for passing keys and data in and out +// of the database. +// +// Values returned from the database are valid only until a subsequent +// update operation, or the end of the transaction. Do not modify or +// free them, they commonly point into the database itself. +// +// Key sizes must be between 1 and #mdb_env_get_maxkeysize() inclusive. +// The same applies to data sizes in databases with the [[DUPSORT]] flag. +// Other data items can in theory be from 0 to 0xffffffff bytes long. +export type val = struct { + mv_size: size, + mv_data: *opaque, +}; -- 2.48.1