Skip to content

Enumerating all dbs in an environment #37

@scottcarey

Description

@scottcarey

I need to open an environment and discover all of the databases. From what I understand, the database names are stored in the default, nameless db. But what encoding? Creating a db ends in a native method stub passing a String... UTF-8?

    Txn<ByteBuffer> txn = env.txn(null);
    env.openDbi(null).iterate(txn).forEachRemaining(kv -> {
      ByteBuffer keybytes = kv.key();
      String key = ??? 
    });

It would probably be useful to add both the ability to retrieve all dbi names to Env, as well as the ability to return all Dbis in an Env as a Map<String, Dbi>. The LMDB docs suggest that it is good practice to retrieve and re-use these anyway.

So I suppose this is mostly a question, but also a minor feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions