zlmdb._lmdb_vendor.tool¶
Basic tools for working with LMDB.
- copy: Consistent high speed backup an environment.
%prog copy -e source.lmdb target.lmdb
- copyfd: Consistent high speed backup an environment to stdout.
%prog copyfd -e source.lmdb > target.lmdb/data.mdb
- drop: Delete one or more sub-databases.
%prog drop -e /path/to/db db1
- dump: Dump one or more databases to disk in ‘cdbmake’ format.
%prog dump -e /path/to/db [db1=file1.cdbmake db2=file2.cdbmake]
If no databases are given, dumps the main database to ‘main.cdbmake’. With –all, dumps the main database and every named database, each to ‘<name>.cdbmake’.
- edit: Add/delete/replace values from a database.
- %prog edit –set key=value –set-file key=/path
–add key=value –add-file key=/path/to/file –delete key
- get: Read one or more values from a database.
%prog get -e /path/to/db [<key1> [<keyN> [..]]]
- readers: Display readers in the lock table
%prog readers -e /path/to/db [-c]
If -c is specified, clear stale readers.
- restore: Read one or more database from disk in ‘cdbmake’ format.
%prog restore -e /path/to/db db1=file1.cdbmake db2=file2.cdbmake
The special db name “:main:” may be used to indicate the main DB.
- rewrite: Re-create an environment using MDB_APPEND
%prog rewrite -e src.lmdb -E dst.lmdb [<db1> [<dbN> ..]]
If no databases are given, rewrites only the main database.
shell: Open interactive console with ENV set to the open environment.
stat: Print environment statistics.
- verify: Offline structural audit of a data file (verify-then-trust).
%prog verify -e /path/to/db # subdir environment %prog verify -s single.mdb # single-file environment
Reads the file as raw bytes without opening it through liblmdb, and checks every invariant the engine’s write paths assume. Exits 0 and prints “verify: OK” if the file is sound; otherwise prints each problem and exits 1. Run this on a file you do not control before trusting it.
warm: Read environment into page cache sequentially.
watch: Show live environment statistics
Attributes¶
Classes¶
Functions¶
|
|
|
|
|
|
|
Given a str, return a bytes instance. |
Map the main database and every named database to an output file |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fully verify a data file offline, without opening it through liblmdb. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Return |
|
|
|
|
|
Return a vaguely /usr/bin/xxd formatted representation of the bytestring |
Module Contents¶
- class DiskStatter(path)[source]¶
- ENV: zlmdb._lmdb_vendor.Environment | None = None[source]¶
- all_dbs_map()[source]¶
Map the main database and every named database to an output file named after it, for
dump --all.
- cmd_verify(opts, args)[source]¶
Fully verify a data file offline, without opening it through liblmdb.
Usage: %prog verify [-e ENV | <path>] [-s]
Reads the file as raw bytes and checks every invariant the LMDB write paths assume (see lmdb/verify.py). Prints “verify: OK” and exits 0 if the file is sound; otherwise prints each problem and exits 1. This is the offline audit for the “verify-then-trust” model: pass a file you do not control through it before opening that file with the engine.