2323#include < string>
2424#include < string_view>
2525#include < unordered_map>
26+ #include < unordered_set>
2627#include < vector>
2728
2829#include " iceberg/result.h"
@@ -42,6 +43,58 @@ class ICEBERG_EXPORT Catalog {
4243 // / \brief Return the name for this catalog
4344 virtual std::string_view name () const = 0;
4445
46+ // / \brief Create a namespace with associated properties.
47+ // /
48+ // / \param ns the namespace to create
49+ // / \param properties a key-value map of metadata for the namespace
50+ // / \return Status::OK if created successfully;
51+ // / ErrorKind::kAlreadyExists if the namespace already exists;
52+ // / ErrorKind::kNotSupported if the operation is not supported
53+ virtual Status CreateNamespace (
54+ const Namespace& ns,
55+ const std::unordered_map<std::string, std::string>& properties) = 0;
56+
57+ // / \brief List child namespaces from the given namespace.
58+ // /
59+ // / \param ns the parent namespace
60+ // / \return a list of child namespaces;
61+ // / ErrorKind::kNoSuchNamespace if the given namespace does not exist
62+ virtual Result<std::vector<Namespace>> ListNamespaces (const Namespace& ns) const = 0;
63+
64+ // / \brief Get metadata properties for a namespace.
65+ // /
66+ // / \param ns the namespace to look up
67+ // / \return a key-value map of metadata properties;
68+ // / ErrorKind::kNoSuchNamespace if the namespace does not exist
69+ virtual Result<std::unordered_map<std::string, std::string>> GetNamespaceProperties (
70+ const Namespace& ns) const = 0;
71+
72+ // / \brief Drop a namespace.
73+ // /
74+ // / \param ns the namespace to drop
75+ // / \return Status::OK if dropped successfully;
76+ // / ErrorKind::kNoSuchNamespace if the namespace does not exist;
77+ // / ErrorKind::kNotAllowed if the namespace is not empty
78+ virtual Status DropNamespace (const Namespace& ns) = 0;
79+
80+ // / \brief Check whether the namespace exists.
81+ // /
82+ // / \param ns the namespace to check
83+ // / \return true if the namespace exists, false otherwise
84+ virtual Result<bool > NamespaceExists (const Namespace& ns) const = 0;
85+
86+ // / \brief Update a namespace's properties by applying additions and removals.
87+ // /
88+ // / \param ns the namespace to update
89+ // / \param updates a set of properties to add or overwrite
90+ // / \param removals a set of property keys to remove
91+ // / \return Status::OK if the update is successful;
92+ // / ErrorKind::kNoSuchNamespace if the namespace does not exist;
93+ // / ErrorKind::kUnsupported if the operation is not supported
94+ virtual Status UpdateNamespaceProperties (
95+ const Namespace& ns, const std::unordered_map<std::string, std::string>& updates,
96+ const std::unordered_set<std::string>& removals) = 0;
97+
4598 // / \brief Return all the identifiers under this namespace
4699 // /
47100 // / \param ns a namespace
@@ -80,8 +133,8 @@ class ICEBERG_EXPORT Catalog {
80133 // / \param spec a partition spec
81134 // / \param location a location for the table; leave empty if unspecified
82135 // / \param properties a string map of table properties
83- // / \return a Transaction to create the table or ErrorKind::kAlreadyExists if the table
84- // / already exists
136+ // / \return a Transaction to create the table or ErrorKind::kAlreadyExists if the
137+ // / table already exists
85138 virtual Result<std::shared_ptr<Transaction>> StageCreateTable (
86139 const TableIdentifier& identifier, const Schema& schema, const PartitionSpec& spec,
87140 const std::string& location,
@@ -90,8 +143,11 @@ class ICEBERG_EXPORT Catalog {
90143 // / \brief Check whether table exists
91144 // /
92145 // / \param identifier a table identifier
93- // / \return true if the table exists, false otherwise
94- virtual bool TableExists (const TableIdentifier& identifier) const = 0;
146+ // / \return Result<bool> indicating table exists or not.
147+ // / - On success, the table existence was successfully checked (actual
148+ // / existence may be inferred elsewhere).
149+ // / - On failure, contains error information.
150+ virtual Result<bool > TableExists (const TableIdentifier& identifier) const = 0;
95151
96152 // / \brief Drop a table; optionally delete data and metadata files
97153 // /
@@ -100,8 +156,10 @@ class ICEBERG_EXPORT Catalog {
100156 // /
101157 // / \param identifier a table identifier
102158 // / \param purge if true, delete all data and metadata files in the table
103- // / \return true if the table was dropped, false if the table did not exist
104- virtual bool DropTable (const TableIdentifier& identifier, bool purge) = 0;
159+ // / \return Status indicating the outcome of the operation.
160+ // / - On success, the table was dropped (or did not exist).
161+ // / - On failure, contains error information.
162+ virtual Status DropTable (const TableIdentifier& identifier, bool purge) = 0;
105163
106164 // / \brief Load a table
107165 // /
@@ -119,18 +177,6 @@ class ICEBERG_EXPORT Catalog {
119177 virtual Result<std::shared_ptr<Table>> RegisterTable (
120178 const TableIdentifier& identifier, const std::string& metadata_file_location) = 0;
121179
122- // / \brief Initialize a catalog given a custom name and a map of catalog properties
123- // /
124- // / A custom Catalog implementation must have a default constructor. A compute engine
125- // / will first initialize the catalog without any arguments, and then call this method
126- // / to complete catalog initialization with properties passed into the engine.
127- // /
128- // / \param name a custom name for the catalog
129- // / \param properties catalog properties
130- virtual void Initialize (
131- const std::string& name,
132- const std::unordered_map<std::string, std::string>& properties) = 0;
133-
134180 // / \brief Instantiate a builder to either create a table or start a create/replace
135181 // / transaction
136182 // /
0 commit comments