* @brief Constructor. This opens the array for the given query type. The * destructor calls the `close()` method. * * **Example:** * * @code{.cpp} * // Open the array for reading * tiledb::Context ctx; * tiledb::Array array(ctx, "s3://bucket-name/array-name", TILEDB_READ); * @endcode * * @param ctx TileDB context. * @param array_uri The array URI. * @param qu
| 209 | * @param encryption_algorithm The EncryptionAlgorithm to set on the array. |
| 210 | */ |
| 211 | Array( |
| 212 | const Context& ctx, |
| 213 | const std::string& array_uri, |
| 214 | tiledb_query_type_t query_type, |
| 215 | const TemporalPolicy temporal_policy = {}, |
| 216 | const EncryptionAlgorithm encryption_algorithm = {}) |
| 217 | : ctx_(ctx) |
| 218 | , schema_(ArraySchema(ctx, (tiledb_array_schema_t*)nullptr)) { |
| 219 | tiledb_ctx_t* c_ctx = ctx.ptr().get(); |
| 220 | tiledb_array_t* array; |
| 221 | ctx.handle_error(tiledb_array_alloc(c_ctx, array_uri.c_str(), &array)); |
| 222 | array_ = std::shared_ptr<tiledb_array_t>(array, deleter_); |
| 223 | |
| 224 | ctx.handle_error(tiledb_array_set_open_timestamp_start( |
| 225 | c_ctx, array, temporal_policy.timestamp_start())); |
| 226 | ctx.handle_error(tiledb_array_set_open_timestamp_end( |
| 227 | c_ctx, array, temporal_policy.timestamp_end())); |
| 228 | |
| 229 | if (encryption_algorithm.key()) { |
| 230 | auto config = ctx.config(); |
| 231 | const char* enc_type_str; |
| 232 | tiledb_encryption_type_to_str(encryption_algorithm.type(), &enc_type_str); |
| 233 | config.set("sm.encryption_type", enc_type_str); |
| 234 | config.set("sm.encryption_key", encryption_algorithm.key()); |
| 235 | ctx.handle_error( |
| 236 | tiledb_array_set_config(c_ctx, array, config.ptr().get())); |
| 237 | } |
| 238 | |
| 239 | ctx.handle_error(tiledb_array_open(c_ctx, array, query_type)); |
| 240 | tiledb_array_schema_t* array_schema; |
| 241 | ctx.handle_error(tiledb_array_get_schema(c_ctx, array, &array_schema)); |
| 242 | schema_ = ArraySchema(ctx, array_schema); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * @brief Constructor. This sets the array config. |
nothing calls this directly
no test coverage detected