Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Rocksdb to store custom data types?

Tags:

c++

rocksdb

I want to write a C++ program using Rocksdb to store key, value pairs which are not in std::string type. For instance, I want use int data-type as the key and values in following data type as the value.

typedef struct custom_type {
    int timestamp;
    int count;
    char* path;
} custom_type_t

Would you let me know how can I achieve this or recommend me some else choices that I can try for?

Thanks a lot for your help in advance!

like image 445
kjee Avatar asked Nov 01 '25 01:11

kjee


1 Answers

You can serialize your custom data as a string using serialization libraries. You can use a bunch of protocols provided by Apache Thrift to seriazlie them to a string and store them to rocksdb.

like image 171
Prateek Jain Avatar answered Nov 03 '25 17:11

Prateek Jain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!