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

Add mtbl_metadata_* functions to retrieve trailer metadata #6

Merged
merged 1 commit into from
Feb 4, 2015

Conversation

snarkmaster
Copy link
Contributor

My goal was to create an in-memory representation of the original data. To do this, it's very helpful to know the size of the source data, namely the key & value bytes, and the number of entries.

I added the other getters so that the "mtbl_info" program wouldn't have to use private APIs to do its job.

I renamed trailer to mtbl_metadata since that's a more meaningful name for the structure. I'm happy to roll back the rename, if you're sure you like mtbl_trailer better.

Test Plan:

Checked that the rename is complete:

git grep -i trailer
find | grep -i trailer

Built & tested:

./autogen.sh && ./configure && make && make check
sudo make install
(for f in t/*.data; do /usr/bin/mtbl_info $f ; done) &> UBUNTU_SYS_OUTPUT
(for f in t/*.data; do /usr/local/bin/mtbl_info $f ; done) &> NEW_OUTPUT
diff UBUNTU_SYS_OUTPUT NEW_OUTPUT

The difference in error message seems acceptable:

1c1
< Error: lseek() failed: Invalid argument

---
> Error: mtbl_reader_init() on t/test-deb716628.data failed

My goal was to create an in-memory representation of the original data.  To do this, it's very helpful to know the size of the source data, namely the key & value bytes, and the number of entries.

I added the other getters so that the "mtbl_info" program wouldn't have to use private APIs to do its job.

I renamed `trailer` to `mtbl_metadata` since that's a more meaningful name for the structure. I'm happy to roll back the rename, if you're sure you like `mtbl_trailer` better.

Test Plan:

Checked that the rename is complete:

```
git grep -i trailer
find | grep -i trailer
```

Built & tested:

```
./autogen.sh && ./configure && make && make check
sudo make install
(for f in t/*.data; do /usr/bin/mtbl_info $f ; done) &> UBUNTU_SYS_OUTPUT
(for f in t/*.data; do /usr/local/bin/mtbl_info $f ; done) &> NEW_OUTPUT
diff UBUNTU_SYS_OUTPUT NEW_OUTPUT
```

The difference in error message seems acceptable:

```
1c1
< Error: lseek() failed: Invalid argument
---
> Error: mtbl_reader_init() on t/test-deb716628.data failed
```
@edmonds edmonds merged commit 1093699 into farsightsec:next Feb 4, 2015
@edmonds edmonds added this to the 0.8.0 milestone Aug 28, 2015
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.

2 participants