wgtmac commented on code in PR #80:
URL: https://github.com/apache/iceberg-cpp/pull/80#discussion_r2094790048


##########
src/iceberg/catalog/in_memory_catalog.cc:
##########
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "iceberg/catalog/in_memory_catalog.h"
+
+#include <algorithm>
+#include <iterator>  // IWYU pragma: keep
+#include <mutex>
+#include <optional>
+#include <unordered_map>
+
+#include "iceberg/exception.h"
+#include "iceberg/table.h"
+#include "iceberg/util/macros.h"
+
+namespace iceberg {
+
+namespace {
+
+/**
+ * \brief A hierarchical namespace that manages namespaces and table metadata 
in-memory.
+ *
+ * Each InMemoryNamespace represents a namespace level and can contain 
properties,
+ * tables, and child namespaces. This structure enables a tree-like 
representation
+ * of nested namespaces.
+ */
+class ICEBERG_EXPORT InMemoryNamespace {

Review Comment:
   As discussed in 
https://github.com/apache/iceberg-cpp/pull/80#discussion_r2059685178, we need 
to move some of these functions (which are included in the rest catalog spec) 
as a part of the public Catalog API.



##########
src/iceberg/catalog/in_memory_catalog.cc:
##########
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "iceberg/catalog/in_memory_catalog.h"
+
+#include <algorithm>
+#include <iterator>  // IWYU pragma: keep
+#include <mutex>
+#include <optional>
+#include <unordered_map>
+
+#include "iceberg/exception.h"
+#include "iceberg/table.h"
+#include "iceberg/util/macros.h"
+
+namespace iceberg {
+
+namespace {
+
+/**
+ * \brief A hierarchical namespace that manages namespaces and table metadata 
in-memory.
+ *
+ * Each InMemoryNamespace represents a namespace level and can contain 
properties,
+ * tables, and child namespaces. This structure enables a tree-like 
representation
+ * of nested namespaces.
+ */
+class ICEBERG_EXPORT InMemoryNamespace {
+ public:
+  /**
+   * \brief Checks whether the given namespace exists.
+   * \param[in] namespace_ident The namespace to check.
+   * \return Status indicating success or failure.
+   */
+  Status NamespaceExists(const Namespace& namespace_ident) const;

Review Comment:
   Use `Result<bool>`



##########
src/iceberg/catalog/in_memory_catalog.cc:
##########
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "iceberg/catalog/in_memory_catalog.h"
+
+#include <algorithm>
+#include <iterator>  // IWYU pragma: keep
+#include <mutex>
+#include <optional>
+#include <unordered_map>
+
+#include "iceberg/exception.h"
+#include "iceberg/table.h"
+#include "iceberg/util/macros.h"
+
+namespace iceberg {
+
+namespace {
+
+/**
+ * \brief A hierarchical namespace that manages namespaces and table metadata 
in-memory.
+ *
+ * Each InMemoryNamespace represents a namespace level and can contain 
properties,
+ * tables, and child namespaces. This structure enables a tree-like 
representation
+ * of nested namespaces.
+ */
+class ICEBERG_EXPORT InMemoryNamespace {
+ public:
+  /**
+   * \brief Checks whether the given namespace exists.
+   * \param[in] namespace_ident The namespace to check.
+   * \return Status indicating success or failure.
+   */
+  Status NamespaceExists(const Namespace& namespace_ident) const;
+
+  /**
+   * \brief Lists immediate child namespaces under the given parent namespace.
+   * \param[in] parent_namespace_ident The optional parent namespace. If not 
provided,
+   *                                the children of the root are returned.
+   * \return A vector of child namespace names.
+   */
+  Result<std::vector<std::string>> ListChildrenNamespaces(

Review Comment:
   If parent can be optional, is it better to rename it to `ListNamespaces`?



##########
src/iceberg/catalog/in_memory_catalog.h:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include "iceberg/catalog.h"
+
+namespace iceberg {
+
+class ICEBERG_EXPORT InMemoryCatalog : public Catalog {

Review Comment:
   Add some comments to describe its purpose. Especially to clarify that it is 
not supposed for production use.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to