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

Project4: KvStore set method directly write key value to the file #462

Open
zilong-dai opened this issue Nov 24, 2023 · 0 comments
Open
Labels
type/question Further information is requested

Comments

@zilong-dai
Copy link

Should we first check if the key exists?

    fn set(&self, key: String, value: String) -> Result<()> {
        if let Some(_) = self.index.get(&key) {
            return Ok(());
        } 
        self.writer.lock().unwrap().set(key, value)
    }
@zilong-dai zilong-dai added the type/question Further information is requested label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant