From 22d2240994be3fbd93ccbcd7d75897a57f6a77c3 Mon Sep 17 00:00:00 2001 From: BrianMichell Date: Fri, 5 Dec 2025 16:28:10 +0000 Subject: [PATCH 01/26] Switch from old stable version to pending PR for mainline adoption --- cmake/FindEXT_TENSORSTORE.cmake | 17 ++++++++++++----- mdio/dataset.h | 14 +++++++++----- mdio/variable.h | 7 +++++-- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/cmake/FindEXT_TENSORSTORE.cmake b/cmake/FindEXT_TENSORSTORE.cmake index 250f4fc..101b38b 100644 --- a/cmake/FindEXT_TENSORSTORE.cmake +++ b/cmake/FindEXT_TENSORSTORE.cmake @@ -3,11 +3,18 @@ IF ( NOT TARGET tensorstore ) include(FetchContent) - FetchContent_Declare( - tensorstore - GIT_REPOSITORY - https://github.com/brian-michell/tensorstore.git - GIT_TAG v0.1.63_latest +# FetchContent_Declare( +# tensorstore +# GIT_REPOSITORY +# https://github.com/brian-michell/tensorstore.git +# GIT_TAG v0.1.63_latest +# ) + +FetchContent_Declare( + tensorstore + GIT_REPOSITORY + https://github.com/BrianMichell/tensorstore.git + GIT_TAG v3_structs ) FetchContent_MakeAvailable(tensorstore) diff --git a/mdio/dataset.h b/mdio/dataset.h index 150940b..71590b4 100644 --- a/mdio/dataset.h +++ b/mdio/dataset.h @@ -36,6 +36,8 @@ #include "mdio/variable_collection.h" #include "tensorstore/driver/zarr/metadata.h" #include "tensorstore/util/future.h" +#include "tensorstore/util/option.h" +#include "tensorstore/util/status.h" // clang-format off #include // NOLINT @@ -1051,8 +1053,9 @@ class Dataset { template static std::enable_if_t<(std::is_same_v), Future> Open(const S& dataset_path, Option&&... options) { - TENSORSTORE_INTERNAL_ASSIGN_OPTIONS_OR_RETURN(TransactionalOpenOptions, - transact_options, options) + TransactionalOpenOptions transact_options; + TENSORSTORE_RETURN_IF_ERROR( + tensorstore::internal::SetAll(transact_options, options...)); if (transact_options.open_mode != constants::kOpen) { return absl::Status(absl::StatusCode::kInvalidArgument, @@ -1060,7 +1063,7 @@ class Dataset { } MDIO_ASSIGN_OR_RETURN(auto params_from_zmetadata, - mdio::internal::from_zmetadata(dataset_path).result()) + mdio::internal::from_zmetadata(dataset_path).result()); auto [dataset_metadata, json_vars] = params_from_zmetadata; return mdio::Dataset::Open(dataset_metadata, json_vars, @@ -1083,8 +1086,9 @@ class Dataset { const std::vector<::nlohmann::json>& json_variables, Option&&... options) { // I need to know if we are intending to create a dataset from scratch? - TENSORSTORE_INTERNAL_ASSIGN_OPTIONS_OR_RETURN(TransactionalOpenOptions, - transact_options, options) + TransactionalOpenOptions transact_options; + TENSORSTORE_RETURN_IF_ERROR( + tensorstore::internal::SetAll(transact_options, options...)); bool do_create = transact_options.open_mode == constants::kCreateClean || transact_options.open_mode == constants::kCreate; diff --git a/mdio/variable.h b/mdio/variable.h index eedebdc..cc202fc 100644 --- a/mdio/variable.h +++ b/mdio/variable.h @@ -41,6 +41,8 @@ #include "tensorstore/stack.h" #include "tensorstore/tensorstore.h" #include "tensorstore/util/future.h" +#include "tensorstore/util/option.h" +#include "tensorstore/util/status.h" // clang-format off #include // NOLINT @@ -809,8 +811,9 @@ class Variable { TransactionalOpenOptions, Option...>), Future>> Open(const nlohmann::json& json_spec, Option&&... option) { - TENSORSTORE_INTERNAL_ASSIGN_OPTIONS_OR_RETURN(TransactionalOpenOptions, - options, option) + TransactionalOpenOptions options; + TENSORSTORE_RETURN_IF_ERROR(tensorstore::internal::SetAll( + options, std::forward