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

Support for ChecksumGeneratorFactory #739

Open
arcmarqs opened this issue Mar 11, 2023 · 4 comments
Open

Support for ChecksumGeneratorFactory #739

arcmarqs opened this issue Mar 11, 2023 · 4 comments

Comments

@arcmarqs
Copy link

It would be nice to have a trait for implementing customized checksum generator factories as described in https://github.com/facebook/rocksdb/wiki/Full-File-Checksum-and-Checksum-Handoff#how-to-use-full-file-checksum

The API is here https://github.com/facebook/rocksdb/blob/main/include/rocksdb/file_checksum.h

I'm not sure how this could be implemented but I would be glad to help.

@tabokie
Copy link
Member

tabokie commented Mar 12, 2023

Yes it would be nice. But before we start working on the details, I want to be sure that you understand the current status of this crate. Right now, the master branch is linked with TiKV's fork of RocksDB 6.29 (https://github.com/tikv/rocksdb). And we don't have a clear plan to update it yet. In fact, we are lowkey working on a new binding crate tirocks designed to replace this one. When that happens, this crate will likely be archived.

@arcmarqs
Copy link
Author

The version isn't a problem as 6.29 supports full file checksum. But in that case, do you recomend using tirocks instead?

@tabokie
Copy link
Member

tabokie commented Mar 13, 2023

do you recomend using tirocks instead?

tirocks is not production ready yet. But it would be fairly easy to port full checksum then because tirocks has a superior binding generation workflow.

The version isn't a problem as 6.29 supports full file checksum.

Great. To port full checksum in rust-rocksdb, you can start with the existing code of compaction filter. They have a very similar structure.

My recent commit refactored the compaction filter interface (9e46788). You can pretty much see how a binding is implemented: (1) declare ffi in c.h (2) implement ffi in c.cc (3) implement rust wrapper of raw C pointer. For structures involving callbacks (such as compaction filter or checksum generator), we need to pass Rust function as C function pointer, and Rust struct as C raw pointer. You can see it in action with CompactionFilterContext or CompactionFilterFactoryProxy.

@arcmarqs
Copy link
Author

Thanks for the directions! I'll look into it.

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