How to use the lmdb.tool.cmd_copy function in lmdb

To help you get started, we’ve selected a few lmdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vertexproject / synapse / synapse / tools / backup.py View on Github external
opts, args = parser.parse_args(['copy', '--compact', '-e', envpath, dstdir])

    env = lmdb.open(
        opts.env,
        map_size=map_size,
        subdir=True,
        max_dbs=opts.max_dbs,
        create=False,
        readonly='READ'
    )

    lmdb.tool.ENV = env
    tick = time.time()

    # use the builtin lmdb command
    ret = lmdb.tool.cmd_copy(opts, args[1:])
    logger.warning(f'lmdb ret: {ret}')

    tock = time.time()
    logger.info(f'backup took: {tock-tick:.2f} seconds')
    env.close()