Skip to content

tree.get function returned the unexpected value #18

@immuthex

Description

@immuthex

tree.get function seems using prefix to match key.

Here is my code:

let folder = "";

// A tree is a single physical keyspace/index/...
// and supports a BTreeMap-like API
// but all data is persisted to disk.
let tree = Config::new(folder).open().unwrap();

// Note compared to the BTreeMap API, operations return a Result<T>
// So you can handle I/O errors if they occur
tree.insert("hello-key-999991", "hello-value-999991")
    .unwrap();

let item = tree.get("hello-key-99999").unwrap();
match item {
    Some(value) => {
        println!("value: {}", std::str::from_utf8(&value).unwrap());
    }
    None => println!("Not Found"),
}

// Flush to definitely make sure data is persisted
tree.flush().unwrap();

Expect Not Found, but printed value: hello-value-999991

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions