LMDB key marshalling functions