Skip to content

Commit

Permalink
WIP reintro cfg option
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenv committed Feb 21, 2024
1 parent c7fb0d6 commit 568d2e4
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 1 deletion.
42 changes: 41 additions & 1 deletion libtiledbsoma/src/soma/soma_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,36 @@ void SOMAArray::create(
std::unique_ptr<SOMAArray> SOMAArray::open(
OpenMode mode,
std::string_view uri,
std::shared_ptr<SOMAContext> ctx,
std::string_view name,
std::map<std::string, std::string> platform_config,
std::vector<std::string> column_names,
std::string_view batch_size,
ResultOrder result_order,
std::optional<std::pair<uint64_t, uint64_t>> timestamp) {
LOG_DEBUG(
fmt::format("[SOMAArray] static method 'cfg' opening array '{}'", uri));
return std::make_unique<SOMAArray>(
mode,
uri,
std::make_shared<SOMAContext>(platform_config),

Check warning on line 73 in libtiledbsoma/src/soma/soma_array.cc

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/soma/soma_array.cc#L73

Added line #L73 was not covered by tests
name,
column_names,
batch_size,
result_order,
timestamp);
}

std::unique_ptr<SOMAArray> SOMAArray::open(
OpenMode mode,
std::string_view uri,
std::shared_ptr<SOMAContext> ctx,
std::string_view name,
std::vector<std::string> column_names,
std::string_view batch_size,
ResultOrder result_order,
std::optional<std::pair<uint64_t, uint64_t>> timestamp) {
LOG_DEBUG(
fmt::format("[SOMAArray] static method 'ctx' opening array '{}'", uri));
return std::make_unique<SOMAArray>(
mode,
uri,
Expand All @@ -82,6 +104,24 @@ std::unique_ptr<SOMAArray> SOMAArray::open(
//= public non-static
//===================================================================

SOMAArray::SOMAArray(
OpenMode mode,
std::string_view uri,
std::string_view name,
std::map<std::string, std::string> platform_config,
std::vector<std::string> column_names,
std::string_view batch_size,
ResultOrder result_order,
std::optional<std::pair<uint64_t, uint64_t>> timestamp)
: uri_(util::rstrip_uri(uri))
, result_order_(result_order)
, timestamp_(timestamp) {
ctx_ = std::make_shared<SOMAContext>(platform_config);

Check warning on line 119 in libtiledbsoma/src/soma/soma_array.cc

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/soma/soma_array.cc#L119

Added line #L119 was not covered by tests
validate(mode, name, timestamp);
reset(column_names, batch_size, result_order);
fill_metadata_cache();
}

SOMAArray::SOMAArray(
OpenMode mode,
std::string_view uri,
Expand Down
47 changes: 47 additions & 0 deletions libtiledbsoma/src/soma/soma_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,31 @@ class SOMAArray : public SOMAObject {
ArraySchema schema,
std::string soma_type);

/**
* @brief Open an array at the specified URI and return SOMAArray
* object.
*
* @param mode read or write
* @param uri URI of the array
* @param name Name of the array
* @param platform_config Config parameter dictionary
* @param column_names Columns to read
* @param batch_size Read batch size
* @param result_order Read result order: automatic (default), rowmajor,
* or colmajor
* @param timestamp Optional pair indicating timestamp start and end
* @return std::unique_ptr<SOMAArray> SOMAArray
*/
static std::unique_ptr<SOMAArray> open(
OpenMode mode,
std::string_view uri,
std::string_view name = "unnamed",
std::map<std::string, std::string> platform_config = {},
std::vector<std::string> column_names = {},
std::string_view batch_size = "auto",
ResultOrder result_order = ResultOrder::automatic,
std::optional<std::pair<uint64_t, uint64_t>> timestamp = std::nullopt);

/**
* @brief Open an array at the specified URI and return SOMAArray
* object.
Expand Down Expand Up @@ -97,6 +122,28 @@ class SOMAArray : public SOMAObject {
//===================================================================
//= public non-static
//===================================================================

/**
* @brief Construct a new SOMAArray object
*
* @param mode read or write
* @param uri URI of the array
* @param name name of the array
* @param platform_config Config parameter dictionary
* @param column_names Columns to read
* @param batch_size Batch size
* @param result_order Result order
* @param timestamp Timestamp
*/
SOMAArray(
OpenMode mode,
std::string_view uri,
std::string_view name,
std::map<std::string, std::string> platform_config,
std::vector<std::string> column_names,
std::string_view batch_size,
ResultOrder result_order,
std::optional<std::pair<uint64_t, uint64_t>> timestamp = std::nullopt);

/**
* @brief Construct a new SOMAArray object
Expand Down

0 comments on commit 568d2e4

Please sign in to comment.