2525#include < string_view>
2626#include < vector>
2727
28+ #include " iceberg/error.h"
2829#include " iceberg/expected.h"
2930#include " iceberg/table_identifier.h"
3031#include " iceberg/type_fwd.h"
3132
3233namespace iceberg {
3334
3435// / \brief A Catalog API for table create, drop, and load operations.
36+ // /
37+ // / Note that these functions are named after the corresponding operationId
38+ // / specified by the Iceberg Rest Catalog API.
3539class ICEBERG_EXPORT Catalog {
3640 public:
3741 virtual ~Catalog () = default ;
@@ -42,9 +46,9 @@ class ICEBERG_EXPORT Catalog {
4246 // / \brief Return all the identifiers under this namespace
4347 // /
4448 // / \param ns a namespace
45- // / \return a list of identifiers for tables or Error ::kNoSuchNamespace
49+ // / \return a list of identifiers for tables or ErrorKind ::kNoSuchNamespace
4650 // / if the namespace does not exist
47- virtual expected<std::vector<TableIdentifier>, ErrorKind > ListTables (
51+ virtual expected<std::vector<TableIdentifier>, Error > ListTables (
4852 const Namespace& ns) const = 0;
4953
5054 // / \brief Create a table
@@ -54,22 +58,33 @@ class ICEBERG_EXPORT Catalog {
5458 // / \param spec a partition spec
5559 // / \param location a location for the table; leave empty if unspecified
5660 // / \param properties a string map of table properties
57- // / \return a Table instance or Error ::kAlreadyExists if the table already exists
58- virtual expected<std::unique_ptr<Table>, ErrorKind > CreateTable (
61+ // / \return a Table instance or ErrorKind ::kAlreadyExists if the table already exists
62+ virtual expected<std::unique_ptr<Table>, Error > CreateTable (
5963 const TableIdentifier& identifier, const Schema& schema, const PartitionSpec& spec,
6064 const std::string& location,
6165 const std::map<std::string, std::string>& properties) = 0;
6266
67+ // / \brief Update a table
68+ // /
69+ // / \param identifier a table identifier
70+ // / \param requirements a list of table requirements
71+ // / \param updates a list of table updates
72+ // / \return a Table instance or ErrorKind::kAlreadyExists if the table already exists
73+ virtual expected<std::unique_ptr<Table>, Error> UpdateTable (
74+ const TableIdentifier& identifier,
75+ const std::vector<std::unique_ptr<UpdateRequirement>>& requirements,
76+ const std::vector<std::unique_ptr<MetadataUpdate>>& updates) = 0;
77+
6378 // / \brief Start a transaction to create a table
6479 // /
6580 // / \param identifier a table identifier
6681 // / \param schema a schema
6782 // / \param spec a partition spec
6883 // / \param location a location for the table; leave empty if unspecified
6984 // / \param properties a string map of table properties
70- // / \return a Transaction to create the table or Error ::kAlreadyExists if the table
85+ // / \return a Transaction to create the table or ErrorKind ::kAlreadyExists if the table
7186 // / already exists
72- virtual expected<std::shared_ptr<Transaction>, ErrorKind> NewCreateTableTransaction (
87+ virtual expected<std::shared_ptr<Transaction>, Error> StageCreateTable (
7388 const TableIdentifier& identifier, const Schema& schema, const PartitionSpec& spec,
7489 const std::string& location,
7590 const std::map<std::string, std::string>& properties) = 0;
@@ -94,16 +109,16 @@ class ICEBERG_EXPORT Catalog {
94109 // /
95110 // / \param identifier a table identifier
96111 // / \return instance of Table implementation referred to by identifier or
97- // / Error ::kNoSuchTable if the table does not exist
98- virtual expected<std::shared_ptr<Table>, ErrorKind > LoadTable (
112+ // / ErrorKind ::kNoSuchTable if the table does not exist
113+ virtual expected<std::shared_ptr<Table>, Error > LoadTable (
99114 const TableIdentifier& identifier) const = 0;
100115
101116 // / \brief Register a table with the catalog if it does not exist
102117 // /
103118 // / \param identifier a table identifier
104119 // / \param metadata_file_location the location of a metadata file
105- // / \return a Table instance or Error ::kAlreadyExists if the table already exists
106- virtual expected<std::shared_ptr<Table>, ErrorKind > RegisterTable (
120+ // / \return a Table instance or ErrorKind ::kAlreadyExists if the table already exists
121+ virtual expected<std::shared_ptr<Table>, Error > RegisterTable (
107122 const TableIdentifier& identifier, const std::string& metadata_file_location) = 0;
108123
109124 // / \brief Initialize a catalog given a custom name and a map of catalog properties
@@ -172,7 +187,7 @@ class ICEBERG_EXPORT Catalog {
172187 // / \brief Starts a transaction to create the table
173188 // /
174189 // / \return the Transaction to create the table
175- virtual std::unique_ptr<Transaction> CreateTransaction () = 0;
190+ virtual std::unique_ptr<Transaction> StageCreate () = 0;
176191 };
177192};
178193
0 commit comments