Skip to content

Commit

Permalink
fix missing rocksdb_get_entity_cf
Browse files Browse the repository at this point in the history
  • Loading branch information
Congyuwang committed Oct 31, 2024
1 parent 25c77ac commit c19e01a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions librocksdb-sys/wide_columns_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <cstdlib>
#include <vector>

#include "rocksdb/rocksdb_namespace.h"
#include "rocksdb/wide_columns.h"

#include "rocksdb/compaction_filter.h"
Expand Down Expand Up @@ -30,6 +31,7 @@ using ROCKSDB_NAMESPACE::BackupID;
using ROCKSDB_NAMESPACE::ColumnFamilyHandle;
using ROCKSDB_NAMESPACE::DB;
using ROCKSDB_NAMESPACE::Iterator;
using ROCKSDB_NAMESPACE::ReadOptions;
using ROCKSDB_NAMESPACE::Status;
using ROCKSDB_NAMESPACE::WriteBatch;
using ROCKSDB_NAMESPACE::WriteOptions;
Expand All @@ -42,6 +44,14 @@ struct rocksdb_t {
struct rocksdb_writebatch_t {
WriteBatch rep;
};
struct rocksdb_readoptions_t {
ReadOptions rep;
// stack variables to set pointers to in ReadOptions
Slice upper_bound;
Slice lower_bound;
Slice timestamp;
Slice iter_start_ts;
};
struct rocksdb_writeoptions_t {
WriteOptions rep;
};
Expand Down Expand Up @@ -91,6 +101,16 @@ void rocksdb_put_entity_cf(rocksdb_t* db, const rocksdb_writeoptions_t* options,
Slice(key, keylen), columns));
}

rocksdb_pinnablewidecolumns_t* rocksdb_get_entity_cf(
rocksdb_t* db, const rocksdb_readoptions_t* options,
rocksdb_column_family_handle_t* column_family, const char* key,
size_t keylen, char** errptr) {
rocksdb_pinnablewidecolumns_t* columns = new (rocksdb_pinnablewidecolumns_t);
SaveError(errptr, db->rep->GetEntity(options->rep, column_family->rep,
Slice(key, keylen), &columns->rep));
return columns;
}

rocksdb_widecolumns_t* rocksdb_iter_columns(const rocksdb_iterator_t* iter) {
rocksdb_widecolumns_t* cols = new (rocksdb_widecolumns_t);
cols->rep = std::move(iter->rep->columns());
Expand Down

0 comments on commit c19e01a

Please sign in to comment.