aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md49
1 files changed, 49 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..71b0e62
--- /dev/null
+++ b/README.md
@@ -0,0 +1,49 @@
+# [LMDB](http://www.lmdb.tech/doc/index.html) bindings for lua
+license: MIT
+
+## errors
+operations that can fail will return `nil, error, errno` on failure.
+
+## functions
+### `lmdb.open(path, opt)`
+create a new environment handle and open the database at the `path`. returns the environment handle (`env`) on success.
+
+`opt` is an optional table of options:
+
+* `maxdbs`: number: the maximum number of databases in the environment. must be set if multiple databases will be used.
+* `rdonly`: boolean: open the environment in read-only mode.
+* `nosubdir`: boolean: the `path` is used for the database file itself and not its containing directory.
+* `nosync`: boolean: don't flush buffers to disk when committing.
+* `nolock`: boolean: turn off locking. the application must manage all concurrency.
+
+### `lmdb.version()`
+returns the LMDB version as `major, minor, patch`.
+
+### `env:txn_begin(rdonly)`
+create a new transaction in the environment. if `rdonly` is true, then the transaction is not to be used to perform write operation. returns the transaction handle (`txn`) on success.
+
+### `env:copy(path)`
+copy the environment to the specified `path`. return `true` on success.
+
+### `env:sync(force)`
+flush buffers to disk. if `force` is `true`, a synchronous flush is performed even if `nosync` is set. return `true` on success.
+
+### `env:close()`
+close the environment.
+
+### `txn:open(name, create)`
+open a database in the environment. if multiple databases are to be used in the environment, `name` is the name of the database to open. otherwise, it should not be supplied. if `create` is true, the database is created if it does not exist. returns a database handle on success.
+
+the database handle behaves as a table that may be indexed with string keys and contains string values, read from the database. any changes made will be saved to the database when the transaction is committed.
+
+## `txn:drop(name)`
+delete the database `name` from the environment. (or clear the database, if `name` is not supplied)
+
+### `txn:abort()`
+abandon all operations performed in the transaction.
+
+### `txn:commit()`
+commit all operations of the transaction into the database.
+
+### `txn:txn_begin(rdonly)`
+create a nested transaction in the parent transaction.