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

Zero size values support #101

Open
tvoeroes opened this issue Dec 19, 2024 · 4 comments
Open

Zero size values support #101

tvoeroes opened this issue Dec 19, 2024 · 4 comments

Comments

@tvoeroes
Copy link

Hello, I am wondering if there is a reason for disallowing zero size values? I have noticed that the insert code contains BOOST_ASSERT(size > 0);. I think that the database could/should let the user store zero size values.

@vinniefalco
Copy link
Member

NuDB is designed as a content-addressable storage system. The digest of a zero-length message is always the same. So you would have at most one possible record with zero length. What is your use-case?

@tvoeroes
Copy link
Author

tvoeroes commented Dec 19, 2024

My use-case would include having different keys resolving to the same value, including multiple keys possibly resolving to the zero-length value. At first glance it seems to be working when I disable boost asserts.

Think of

std::unordered_map<int, std::string> map;
map[0] = "foo";
map[1] = "";
map[2] = "foo";
map[3] = "";

@vinniefalco
Copy link
Member

Are you aware that NuDB is append-only? You can't change entries.

@tvoeroes
Copy link
Author

Yes

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

No branches or pull requests

2 participants