Skip to content

Commit

Permalink
Convert filestore API function
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-hughes-tiledb committed Oct 30, 2023
1 parent e3d0b79 commit 828b67e
Showing 1 changed file with 35 additions and 26 deletions.
61 changes: 35 additions & 26 deletions tiledb/sm/c_api/tiledb_filestore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include "tiledb/sm/enums/mime_type.h"
#include "tiledb/sm/misc/mgc_dict.h"

namespace tiledb::common::detail {
namespace tiledb::api {

// Forward declarations
uint64_t compute_tile_extent_based_on_file_size(uint64_t file_size);
Expand Down Expand Up @@ -733,69 +733,78 @@ std::pair<Status, optional<uint64_t>> get_buffer_size_from_config(
return {Status::Ok(), buffer_size};
}

} // namespace tiledb::common::detail
} // namespace tiledb::api

using tiledb::api::api_entry_plain;
template <auto f>
constexpr auto api_entry = tiledb::api::api_entry_with_context<f>;

TILEDB_EXPORT int32_t tiledb_filestore_schema_create(
CAPI_INTERFACE(
filestore_schema_create,
tiledb_ctx_t* ctx,
const char* uri,
tiledb_array_schema_t** array_schema) noexcept {
return api_entry<detail::tiledb_filestore_schema_create>(
tiledb_array_schema_t** array_schema) {
return api_entry<tiledb::api::tiledb_filestore_schema_create>(
ctx, uri, array_schema);
}

TILEDB_EXPORT int32_t tiledb_filestore_uri_import(
CAPI_INTERFACE(
filestore_uri_import,
tiledb_ctx_t* ctx,
const char* filestore_array_uri,
const char* file_uri,
tiledb_mime_type_t mime_type) noexcept {
return api_entry<detail::tiledb_filestore_uri_import>(
tiledb_mime_type_t mime_type) {
return api_entry<tiledb::api::tiledb_filestore_uri_import>(
ctx, filestore_array_uri, file_uri, mime_type);
}

TILEDB_EXPORT int32_t tiledb_filestore_uri_export(
CAPI_INTERFACE(
filestore_uri_export,
tiledb_ctx_t* ctx,
const char* file_uri,
const char* filestore_array_uri) noexcept {
return api_entry<detail::tiledb_filestore_uri_export>(
const char* filestore_array_uri) {
return api_entry<tiledb::api::tiledb_filestore_uri_export>(
ctx, file_uri, filestore_array_uri);
}

TILEDB_EXPORT int32_t tiledb_filestore_buffer_import(
CAPI_INTERFACE(
filestore_buffer_import,
tiledb_ctx_t* ctx,
const char* filestore_array_uri,
void* buf,
size_t size,
tiledb_mime_type_t mime_type) noexcept {
return api_entry<detail::tiledb_filestore_buffer_import>(
tiledb_mime_type_t mime_type) {
return api_entry<tiledb::api::tiledb_filestore_buffer_import>(
ctx, filestore_array_uri, buf, size, mime_type);
}

TILEDB_EXPORT int32_t tiledb_filestore_buffer_export(
CAPI_INTERFACE(
filestore_buffer_export,
tiledb_ctx_t* ctx,
const char* filestore_array_uri,
size_t offset,
void* buf,
size_t size) noexcept {
return api_entry<detail::tiledb_filestore_buffer_export>(
size_t size) {
return api_entry<tiledb::api::tiledb_filestore_buffer_export>(
ctx, filestore_array_uri, offset, buf, size);
}

TILEDB_EXPORT int32_t tiledb_filestore_size(
tiledb_ctx_t* ctx, const char* filestore_array_uri, size_t* size) noexcept {
return api_entry<detail::tiledb_filestore_size>(
CAPI_INTERFACE(
filestore_size,
tiledb_ctx_t* ctx,
const char* filestore_array_uri,
size_t* size) {
return api_entry<tiledb::api::tiledb_filestore_size>(
ctx, filestore_array_uri, size);
}

TILEDB_EXPORT int32_t tiledb_mime_type_to_str(
tiledb_mime_type_t mime_type, const char** str) noexcept {
return api_entry_plain<detail::tiledb_mime_type_to_str>(mime_type, str);
CAPI_INTERFACE(
mime_type_to_str, tiledb_mime_type_t mime_type, const char** str) {
return api_entry_plain<tiledb::api::tiledb_mime_type_to_str>(mime_type, str);
}

TILEDB_EXPORT int32_t tiledb_mime_type_from_str(
const char* str, tiledb_mime_type_t* mime_type) noexcept {
return api_entry_plain<detail::tiledb_mime_type_from_str>(str, mime_type);
CAPI_INTERFACE(
mime_type_from_str, const char* str, tiledb_mime_type_t* mime_type) {
return api_entry_plain<tiledb::api::tiledb_mime_type_from_str>(
str, mime_type);
}

0 comments on commit 828b67e

Please sign in to comment.