Skip to content

Commit

Permalink
Move one function (plus one helper) to deprecation.cpp (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel authored Apr 22, 2024
1 parent 748704b commit 3330241
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
20 changes: 20 additions & 0 deletions src/deprecation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,23 @@ XPtr<tiledb::Query> libtiledb_query_submit_async(XPtr<tiledb::Query> query) {
query->submit_async();
return query;
}

// Helper for next function
tiledb_encryption_type_t _string_to_tiledb_encryption_type_t(std::string encstr) {
tiledb_encryption_type_t enc;
int rc = tiledb_encryption_type_from_str(encstr.c_str(), &enc);
if (rc == TILEDB_OK)
return enc;
Rcpp::stop("Unknow TileDB encryption type '%s'", encstr.c_str());
}

// Deprecated in Core April 2024
// [[Rcpp::export]]
std::string libtiledb_array_create_with_key(std::string uri, XPtr<tiledb::ArraySchema> schema,
std::string encryption_key) {
check_xptr_tag<tiledb::ArraySchema>(schema);
tiledb::Array::create(uri, *schema.get(),
_string_to_tiledb_encryption_type_t("AES_256_GCM"),
encryption_key);
return uri;
}
19 changes: 0 additions & 19 deletions src/libtiledb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,6 @@ const size_t _tiledb_datatype_sizeof(const tiledb_datatype_t dtype) {
}
}

tiledb_encryption_type_t _string_to_tiledb_encryption_type_t(std::string encstr) {
tiledb_encryption_type_t enc;
int rc = tiledb_encryption_type_from_str(encstr.c_str(), &enc);
if (rc == TILEDB_OK)
return enc;
Rcpp::stop("Unknow TileDB encryption type '%s'", encstr.c_str());
}


// [[Rcpp::export]]
NumericVector libtiledb_version() {
auto ver = tiledb::version();
Expand Down Expand Up @@ -2240,16 +2231,6 @@ std::string libtiledb_array_create(std::string uri, XPtr<tiledb::ArraySchema> sc
return uri;
}

// [[Rcpp::export]]
std::string libtiledb_array_create_with_key(std::string uri, XPtr<tiledb::ArraySchema> schema,
std::string encryption_key) {
check_xptr_tag<tiledb::ArraySchema>(schema);
tiledb::Array::create(uri, *schema.get(),
_string_to_tiledb_encryption_type_t("AES_256_GCM"),
encryption_key);
return uri;
}

// [[Rcpp::export]]
XPtr<tiledb::Array> libtiledb_array_open(XPtr<tiledb::Context> ctx, std::string uri,
std::string type) {
Expand Down

0 comments on commit 3330241

Please sign in to comment.