Move the heed env into the index itself to ease the usage of the library

This commit is contained in:
Clément Renault 2020-10-30 10:56:35 +01:00
parent b5d52b6b45
commit e63fdf2b22
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
6 changed files with 42 additions and 34 deletions

View file

@ -40,14 +40,12 @@ pub fn run(opt: Opt) -> anyhow::Result<()> {
.init()?;
std::fs::create_dir_all(&opt.database)?;
let env = EnvOpenOptions::new()
.map_size(opt.database_size)
.max_dbs(10)
.open(&opt.database)?;
let mut options = EnvOpenOptions::new();
options.map_size(opt.database_size);
// Open the LMDB database.
let index = Index::new(&env)?;
let rtxn = env.read_txn()?;
let index = Index::new(options, &opt.database)?;
let rtxn = index.read_txn()?;
let stdin = io::stdin();
let lines = match opt.query {