linxGnu / grocksdb

RocksDB wrapper for Go. Support 9.x, 8.x, 7.x, 6.x, etc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you do GetCfHandle() ?

hiqsociety opened this issue · comments

Possible to provide the code to add this function in?

@hiqsociety what functionality do you really want?

sorry for asking, but saw this
cfhandle := GetCFHandle("something") <- returning the cfhandle for the name

https://github.com/bitleak/kvrocks/blob/cdb0ccedd36f21432977b8a9d0bac7f4a2a1e84e/src/storage.cc#L445

not sure if it's possible with default rocksdb function

because i dont want to list all the cfnames and then just to open one.

There is no functionality like this exposed by RocksDB @hiqsociety

ok. any ideas if we can achieve this with golang? otherwise need to write the code of
https://github.com/bitleak/kvrocks/blob/cdb0ccedd36f21432977b8a9d0bac7f4a2a1e84e/src/storage.cc#L445
in?

@hiqsociety It's impossible if rocksdb does not support this functionality. At the moment, it doesn't.

Your sample code above:

rocksdb::ColumnFamilyHandle *Storage::GetCFHandle(const std::string &amp;name) {  
   if (name == kMetadataColumnFamilyName) {    return cf_handles_[1];  } 
   else if (name == kZSetScoreColumnFamilyName) {    return cf_handles_[2];  } 
   else if (name == kPubSubColumnFamilyName) {    return cf_handles_[3];  }  
return cf_handles_[0];}

cf_handles_ are opened column families while opening the db.