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 db1

dump: Dump one or more databases to disk in ‘cdbmake’ format.

Usage: dump [db1=file1.cdbmake db2=file2.cdbmake]

If no databases are given, dumps the main database to ‘main.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 [<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 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.

warm: Read environment into page cache sequentially.

watch: Show live environment statistics

Attributes

Classes

Functions

_find_diskstat(path)

_get_term_width([default])

_on_sigwinch(*args)

_to_bytes(s)

Given either a Python 2.x or 3.x str, return either a str (Python 2.x)

cmd_copy(opts, args)

cmd_copyfd(opts, args)

cmd_drop(opts, args)

cmd_dump(opts, args)

cmd_edit(opts, args)

cmd_get(opts, args)

cmd_readers(opts, args)

cmd_restore(opts, args)

cmd_rewrite(opts, args)

cmd_shell(opts, args)

cmd_stat(opts, args)

cmd_warm(opts, args)

cmd_watch(opts, args)

db_map_from_args(args)

delta(hst)

die(fmt, *args)

dump_cursor_to_fp(cursor, fp)

isprint(c)

Return True if the character c can be printed visibly and without

main([argv])

make_parser()

restore_cursor_from_fp(txn, fp, db)

xxd(s)

Return a vaguely /usr/bin/xxd formatted representation of the bytestring

Module Contents

BUF_SIZE = 10485760[source]
DB = None[source]
class DiskStatter(path)[source]

Bases: object

FIELDS = ('reads', 'reads_merged', 'sectors_read', 'read_ms', 'writes', 'writes_merged',...[source]
fp[source]
refresh()[source]
ENCODING = 'utf-8'[source]
ENV = None[source]
SYS_BLOCK = '/sys/block'[source]
_find_diskstat(path)[source]
_get_term_width(default=(80, 25))[source]
_on_sigwinch(*args)[source]
_to_bytes(s)[source]

Given either a Python 2.x or 3.x str, return either a str (Python 2.x) or a bytes instance (Python 3.x).

cmd_copy(opts, args)[source]
cmd_copyfd(opts, args)[source]
cmd_drop(opts, args)[source]
cmd_dump(opts, args)[source]
cmd_edit(opts, args)[source]
cmd_get(opts, args)[source]
cmd_readers(opts, args)[source]
cmd_restore(opts, args)[source]
cmd_rewrite(opts, args)[source]
cmd_shell(opts, args)[source]
cmd_stat(opts, args)[source]
cmd_warm(opts, args)[source]
cmd_watch(opts, args)[source]
db_map_from_args(args)[source]
delta(hst)[source]
die(fmt, *args)[source]
dump_cursor_to_fp(cursor, fp)[source]
isprint(c)[source]

Return True if the character c can be printed visibly and without adversely affecting printing position (e.g. newline).

main(argv=None)[source]
make_parser()[source]
restore_cursor_from_fp(txn, fp, db)[source]
xxd(s)[source]

Return a vaguely /usr/bin/xxd formatted representation of the bytestring s.