This is an automated email from the ASF dual-hosted git repository.
gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new 95ec7a33 fix(rest): build resource paths from final config (#482)
95ec7a33 is described below
commit 95ec7a330bb12b9f53cc901a89980e91a93c2447
Author: Jiajia Li <[email protected]>
AuthorDate: Tue Jan 6 12:36:55 2026 +0800
fix(rest): build resource paths from final config (#482)
---
src/iceberg/catalog/rest/resource_paths.cc | 8 --------
src/iceberg/catalog/rest/resource_paths.h | 4 ----
src/iceberg/catalog/rest/rest_catalog.cc | 4 +++-
3 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/src/iceberg/catalog/rest/resource_paths.cc
b/src/iceberg/catalog/rest/resource_paths.cc
index 462b0376..f86a75ec 100644
--- a/src/iceberg/catalog/rest/resource_paths.cc
+++ b/src/iceberg/catalog/rest/resource_paths.cc
@@ -38,14 +38,6 @@ Result<std::unique_ptr<ResourcePaths>>
ResourcePaths::Make(std::string base_uri,
ResourcePaths::ResourcePaths(std::string base_uri, const std::string& prefix)
: base_uri_(std::move(base_uri)), prefix_(prefix.empty() ? "" : (prefix +
"/")) {}
-Status ResourcePaths::SetBaseUri(const std::string& base_uri) {
- if (base_uri.empty()) {
- return InvalidArgument("Base URI is empty");
- }
- base_uri_ = base_uri;
- return {};
-}
-
Result<std::string> ResourcePaths::Config() const {
return std::format("{}/v1/config", base_uri_);
}
diff --git a/src/iceberg/catalog/rest/resource_paths.h
b/src/iceberg/catalog/rest/resource_paths.h
index 06971179..1b502aaa 100644
--- a/src/iceberg/catalog/rest/resource_paths.h
+++ b/src/iceberg/catalog/rest/resource_paths.h
@@ -23,7 +23,6 @@
#include <string>
#include "iceberg/catalog/rest/iceberg_rest_export.h"
-#include "iceberg/catalog/rest/type_fwd.h"
#include "iceberg/result.h"
#include "iceberg/type_fwd.h"
@@ -44,9 +43,6 @@ class ICEBERG_REST_EXPORT ResourcePaths {
static Result<std::unique_ptr<ResourcePaths>> Make(std::string base_uri,
const std::string&
prefix);
- /// \brief Set the base URI of the REST catalog server.
- Status SetBaseUri(const std::string& base_uri);
-
/// \brief Get the /v1/config endpoint path.
Result<std::string> Config() const;
diff --git a/src/iceberg/catalog/rest/rest_catalog.cc
b/src/iceberg/catalog/rest/rest_catalog.cc
index cbd38c5a..d75da640 100644
--- a/src/iceberg/catalog/rest/rest_catalog.cc
+++ b/src/iceberg/catalog/rest/rest_catalog.cc
@@ -132,7 +132,9 @@ Result<std::shared_ptr<RestCatalog>> RestCatalog::Make(
// Update resource paths based on the final config
ICEBERG_ASSIGN_OR_RAISE(auto final_uri, final_config->Uri());
-
ICEBERG_RETURN_UNEXPECTED(paths->SetBaseUri(std::string(TrimTrailingSlash(final_uri))));
+ ICEBERG_ASSIGN_OR_RAISE(
+ paths, ResourcePaths::Make(std::string(TrimTrailingSlash(final_uri)),
+
final_config->Get(RestCatalogProperties::kPrefix)));
return std::shared_ptr<RestCatalog>(
new RestCatalog(std::move(final_config), std::move(file_io),
std::move(paths),