Skip to content

Databases

LevelDB Management in VS Code

LevelDB is an open-source, embedded key-value store library written by Google. It is built for:

  • Embedded use: A library, not a server - a LevelDB database is a directory of files on disk that a single process opens in place
  • Ordered keys: Keys and values are arbitrary byte strings, kept in sorted (lexicographic) order
  • Simplicity: A small set of operations - get, put, delete, and ordered iteration
  • Speed: An LSM-tree design tuned for fast writes and range scans

LevelDB backs many applications, including Chrome and Electron storage (IndexedDB, Local Storage), Bitcoin Core, and countless services that need a local, embedded store.

Because LevelDB is embedded, there is no host, port, or login - a connection is just a path to a database directory on your machine.

  1. Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
  2. Add a New Connection: Click on the “Add Connection” icon.
  3. Complete the connection form: Select LevelDB as the database type and choose the database directory (the folder containing CURRENT, MANIFEST-*, and *.ldb files).
  4. Connect: Click save to open the database.

For detailed instructions on connecting, refer to the Connect article.

DBCode opens the database with the native LevelDB engine and gives you:

  • Key browsing: Keys are listed in sorted order under a single Keyspace, capped by the Max Keys connection setting
  • Value editing: View and edit a key’s value, and create or delete keys, from the results grid
  • Smart value rendering: Values are shown as text when they are valid UTF-8, pretty-printed when they are JSON, and as hex when they are binary
  • Editor commands: Run simple get, put, and del commands from the query editor

LevelDB is an embedded store, so a few behaviors differ from a networked database:

  • Exclusive lock. LevelDB takes an exclusive lock on the database directory - only one process can open it at a time. If the application that owns the database is running, DBCode cannot open it, and vice versa. Close the owning application first.
  • Opaque bytes. Keys and values are arbitrary bytes with no schema or types. DBCode renders values as UTF-8, JSON, or hex, but the store itself imposes no structure.
  • Snapshot size. A database can hold millions of keys, so browsing is bounded by the Max Keys setting (0 for unlimited).
  • Platform support. LevelDB is available on macOS, Windows (x64), and Linux (x64 and arm64). It is not available on Windows on ARM.

For more information about LevelDB, check out the LevelDB project.