-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conversation
} | ||
|
||
pub async fn set<K: Into<Vec<u8>>, V: Into<Vec<u8>>>(&self, key: K, value: V) { | ||
let key = key.into(); |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
There was a problem hiding this 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 :)
src/engine/hash/src/lib.rs
Outdated
async fn table() -> Result<()> { | ||
let records = vec![(vec![1], vec![1]), (vec![2], vec![2])]; | ||
|
||
let filename = "/tmp/hash"; |
There was a problem hiding this comment.
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~
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.