Skip to content

Commit dd3e174

Browse files
teo-tsirpanisihnorton
authored andcommitted
Fix exporting tiledb_ctx_alloc_with_error.
1 parent 6564bd7 commit dd3e174

File tree

4 files changed

+93
-53
lines changed

4 files changed

+93
-53
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ list(APPEND TILEDB_C_API_RELATIVE_HEADERS
306306
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/buffer/buffer_api_external.h"
307307
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/buffer_list/buffer_list_api_external.h"
308308
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/config/config_api_external.h"
309+
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/context/context_api_experimental.h"
309310
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/context/context_api_external.h"
310311
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/current_domain/current_domain_api_enum.h"
311312
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/current_domain/current_domain_api_external_experimental.h"

tiledb/api/c_api/context/context_api.cc

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
*/
3232

3333
#include "../config/config_api_internal.h"
34+
#include "context_api_experimental.h"
3435
#include "context_api_external.h"
3536
#include "context_api_internal.h"
3637
#include "tiledb/api/c_api_support/c_api_support.h"
@@ -144,22 +145,11 @@ CAPI_INTERFACE(
144145
config, ctx);
145146
}
146147

147-
/*
148-
* We have a special case with tiledb_ctx_alloc_with_error. It's declared in
149-
* tiledb_experimental.h. Rather than all the apparatus needed to split up that
150-
* header (as tiledb.h is), we declare its linkage separately at the point of
151-
* definition.
152-
*
153-
* Not including the experimental header means that we're not using the compiler
154-
* to check the definition against the declaration. This won't scale
155-
* particularly well, but it doesn't need to for the time being.
156-
*/
157-
extern "C" {
158-
159-
capi_return_t tiledb_ctx_alloc_with_error(
148+
CAPI_INTERFACE(
149+
ctx_alloc_with_error,
160150
tiledb_config_handle_t* config,
161151
tiledb_ctx_handle_t** ctx,
162-
tiledb_error_handle_t** error) noexcept {
152+
tiledb_error_handle_t** error) {
163153
/*
164154
* Wrapped with the `api_entry_error` variation. Note that the same function
165155
* is wrapped with `api_entry_plain` above.
@@ -168,8 +158,6 @@ capi_return_t tiledb_ctx_alloc_with_error(
168158
error, config, ctx);
169159
}
170160

171-
} // extern "C"
172-
173161
/*
174162
* API Audit: void return
175163
*/
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* @file tiledb/api/c_api/context/context_api_experimentnal.h
3+
*
4+
* @section LICENSE
5+
*
6+
* The MIT License
7+
*
8+
* @copyright Copyright (c) 2024 TileDB, Inc.
9+
*
10+
* Permission is hereby granted, free of charge, to any person obtaining a copy
11+
* of this software and associated documentation files (the "Software"), to deal
12+
* in the Software without restriction, including without limitation the rights
13+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
* copies of the Software, and to permit persons to whom the Software is
15+
* furnished to do so, subject to the following conditions:
16+
*
17+
* The above copyright notice and this permission notice shall be included in
18+
* all copies or substantial portions of the Software.
19+
*
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26+
* THE SOFTWARE.
27+
*
28+
* @section DESCRIPTION
29+
*
30+
* This file declares the experimental C API for TileDB context.
31+
*/
32+
33+
#ifndef TILEDB_CAPI_CONTEXT_EXPERIMENTAL_H
34+
#define TILEDB_CAPI_CONTEXT_EXPERIMENTAL_H
35+
36+
#include "../api_external_common.h"
37+
#include "../error/error_api_external.h"
38+
#include "context_api_external.h"
39+
40+
#include "../config/config_api_external.h"
41+
42+
#ifdef __cplusplus
43+
extern "C" {
44+
#endif
45+
46+
/**
47+
* Creates a TileDB context, which contains the TileDB storage manager
48+
* that manages everything in the TileDB library. This is a provisional API
49+
* which returns an error object when the context creation fails. This API will
50+
* be replaced with a more proper "v2" of context alloc in the near future. The
51+
* main goal is to use to this to capture potential failures to inform the v2
52+
* alloc design.
53+
*
54+
* **Examples:**
55+
*
56+
* Without config (i.e., use default configuration):
57+
*
58+
* @code{.c}
59+
* tiledb_ctx_t* ctx;
60+
* tiledb_error_t* error;
61+
* tiledb_ctx_alloc_with_error(NULL, &ctx, &error);
62+
* @endcode
63+
*
64+
* With some config:
65+
*
66+
* @code{.c}
67+
* tiledb_ctx_t* ctx;
68+
* tiledb_error_t* error;
69+
* tiledb_ctx_alloc_with_error(config, &ctx, &error);
70+
* @endcode
71+
*
72+
* @param[in] config The configuration parameters (`NULL` means default).
73+
* @param[out] ctx The TileDB context to be created.
74+
* @param[out] error Error object returned upon error (`NULL` if there is
75+
* no error).
76+
* @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error.
77+
*/
78+
TILEDB_EXPORT capi_return_t tiledb_ctx_alloc_with_error(
79+
tiledb_config_t* config,
80+
tiledb_ctx_t** ctx,
81+
tiledb_error_t** error) TILEDB_NOEXCEPT;
82+
83+
#ifdef __cplusplus
84+
}
85+
#endif
86+
87+
#endif // TILEDB_CAPI_CONTEXT_EXPERIMENTAL_H

tiledb/sm/c_api/tiledb_experimental.h

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "tiledb/api/c_api/array_schema/array_schema_api_experimental.h"
4545
#include "tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_experimental.h"
4646
#include "tiledb/api/c_api/attribute/attribute_api_external_experimental.h"
47+
#include "tiledb/api/c_api/context/context_api_experimental.h"
4748
#include "tiledb/api/c_api/current_domain/current_domain_api_external_experimental.h"
4849
#include "tiledb/api/c_api/enumeration/enumeration_api_experimental.h"
4950
#include "tiledb/api/c_api/fragment_info/fragment_info_api_experimental.h"
@@ -499,43 +500,6 @@ TILEDB_EXPORT int32_t tiledb_query_get_status_details(
499500
/* CONTEXT */
500501
/* ********************************* */
501502

502-
/**
503-
* Creates a TileDB context, which contains the TileDB storage manager
504-
* that manages everything in the TileDB library. This is a provisional API
505-
* which returns an error object when the context creation fails. This API will
506-
* be replaced with a more proper "v2" of context alloc in the near future. The
507-
* main goal is to use to this to capture potential failures to inform the v2
508-
* alloc design.
509-
*
510-
* **Examples:**
511-
*
512-
* Without config (i.e., use default configuration):
513-
*
514-
* @code{.c}
515-
* tiledb_ctx_t* ctx;
516-
* tiledb_error_t* error;
517-
* tiledb_ctx_alloc_with_error(NULL, &ctx, &error);
518-
* @endcode
519-
*
520-
* With some config:
521-
*
522-
* @code{.c}
523-
* tiledb_ctx_t* ctx;
524-
* tiledb_error_t* error;
525-
* tiledb_ctx_alloc_with_error(config, &ctx, &error);
526-
* @endcode
527-
*
528-
* @param[in] config The configuration parameters (`NULL` means default).
529-
* @param[out] ctx The TileDB context to be created.
530-
* @param[out] error Error object returned upon error (`NULL` if there is
531-
* no error).
532-
* @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error.
533-
*/
534-
TILEDB_EXPORT capi_return_t tiledb_ctx_alloc_with_error(
535-
tiledb_config_t* config,
536-
tiledb_ctx_t** ctx,
537-
tiledb_error_t** error) TILEDB_NOEXCEPT;
538-
539503
/* ********************************* */
540504
/* ARRAY CONSOLIDATION */
541505
/* ********************************* */

0 commit comments

Comments
 (0)