[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LMDB usage with long or variable length keys




On Wed, Apr 22, 2015 at 3:17 AM, Alex V. <alex.v.odesk@gmail.com> wrote:
For example file path or URL.

We in KDE[1] have been using LMDB for building a file indexer. In order to store file paths we have also used a sequence of keys since file paths are hierarchical.

* Every file has an id. This is a combination of the device id + inode number.
* We map fileId -> (parentId fileName)
* We map parentId -> list of sub-file ids

For (id -> file path), multiple lookups are required
For (file Path -> id), we can just rely on the file system

This obviously only works for files which exist in the file system. Also with this folder renames are very cheap.

--
Vishesh Handa