Skip to content

Implement in-memory database for testing #15

@paulhauner

Description

@paulhauner

We have abstracted the database into a ClientDB trait and implemented a DiskDB using RocksDB for production.

It would be useful to have an implementation of an in-memory database that can be used in testing. The benefits would be speed (i.e., RAM is faster than disk) and convenience (we don't need to touch the filesystem).

The in-memory database doesn't need to be particularly optimized or elegant, just the fact it's in memory should make it fast enough. I would suggest a two-layer nested hashmap to simulate columns. E.g., HashMap<HashMap<Vec<u8>>>. It will need to implement some Mutex/RwLock internally so it can be sent around threads like RocksDB can be.

It should live in a memory_db.rs file here and I think the struct should be called MemoryDB.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions