Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine: add a memory hash engine #140

Merged
merged 3 commits into from
Nov 30, 2021
Merged

engine: add a memory hash engine #140

merged 3 commits into from
Nov 30, 2021

Conversation

huachaohuang
Copy link
Contributor

Enough for abstractions, let's build our first engine now.
This PR only handles some memory data. We will offer the hash engine an Env later to persist its state.
I also remove the API part to avoid confusion for now.

@huachaohuang huachaohuang added this to the Version 0.2 milestone Nov 30, 2021
}

pub async fn set<K: Into<Vec<u8>>, V: Into<Vec<u8>>>(&self, key: K, value: V) {
let key = key.into();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a internalKey(with seqNo or some mvcc version) or user key?

if it's user key, maybe we need maintain self.size like size = size + new_value - old_value when set exist key-value pair twice :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I haven't considered MVCC at this moment. So user keys and internal keys are the same things for now.

zojw
zojw previously approved these changes Nov 30, 2021
Copy link
Contributor

@zojw zojw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for first version and we can improve it later :)

async fn table() -> Result<()> {
let records = vec![(vec![1], vec![1]), (vec![2], vec![2])];

let filename = "/tmp/hash";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better use env::temp_dir() for windows developer~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants