26#include <shared_mutex>
44 public std::enable_shared_from_this<InMemoryCatalog> {
47 std::string warehouse_location,
48 std::unordered_map<std::string, std::string> properties,
49 std::shared_ptr<MetricsReporter> reporter =
nullptr);
53 std::string
const& name, std::shared_ptr<FileIO>
const& file_io,
54 std::string
const& warehouse_location,
55 std::unordered_map<std::string, std::string>
const& properties);
57 std::string_view
name()
const override;
61 const std::unordered_map<std::string, std::string>& properties)
override;
73 const Namespace& ns,
const std::unordered_map<std::string, std::string>& updates,
74 const std::unordered_set<std::string>& removals)
override;
79 const TableIdentifier& identifier,
const std::shared_ptr<Schema>& schema,
80 const std::shared_ptr<PartitionSpec>& spec,
const std::shared_ptr<SortOrder>& order,
81 const std::string& location,
82 const std::unordered_map<std::string, std::string>& properties)
override;
86 const std::vector<std::unique_ptr<TableRequirement>>& requirements,
87 const std::vector<std::unique_ptr<TableUpdate>>& updates)
override;
90 const TableIdentifier& identifier,
const std::shared_ptr<Schema>& schema,
91 const std::shared_ptr<PartitionSpec>& spec,
const std::shared_ptr<SortOrder>& order,
92 const std::string& location,
93 const std::unordered_map<std::string, std::string>& properties)
override;
105 const std::string& metadata_file_location)
override;
108 std::string catalog_name_;
109 std::unordered_map<std::string, std::string> properties_;
110 std::shared_ptr<FileIO> file_io_;
111 std::string warehouse_location_;
112 std::unique_ptr<class InMemoryNamespace> root_namespace_;
113 mutable std::shared_mutex mutex_;
114 std::shared_ptr<MetricsReporter> reporter_;
Define the catalog API for table and namespace operations.
A Catalog API for table create, drop, and load operations.
Definition catalog.h:42
An in-memory implementation of the Iceberg Catalog interface.
Definition in_memory_catalog.h:44
Result< std::shared_ptr< Table > > LoadTable(const TableIdentifier &identifier) override
Load a table.
Result< std::unordered_map< std::string, std::string > > GetNamespaceProperties(const Namespace &ns) const override
Get metadata properties for a namespace.
std::string_view name() const override
Return the name for this catalog.
Result< bool > TableExists(const TableIdentifier &identifier) const override
Check whether table exists.
Result< std::vector< Namespace > > ListNamespaces(const Namespace &ns) const override
List child namespaces from the given namespace.
Status UpdateNamespaceProperties(const Namespace &ns, const std::unordered_map< std::string, std::string > &updates, const std::unordered_set< std::string > &removals) override
Update a namespace's properties by applying additions and removals.
Result< std::shared_ptr< Table > > UpdateTable(const TableIdentifier &identifier, const std::vector< std::unique_ptr< TableRequirement > > &requirements, const std::vector< std::unique_ptr< TableUpdate > > &updates) override
Update a table.
Result< std::shared_ptr< Table > > CreateTable(const TableIdentifier &identifier, const std::shared_ptr< Schema > &schema, const std::shared_ptr< PartitionSpec > &spec, const std::shared_ptr< SortOrder > &order, const std::string &location, const std::unordered_map< std::string, std::string > &properties) override
Create a table.
Status RenameTable(const TableIdentifier &from, const TableIdentifier &to) override
Rename a table.
Status DropTable(const TableIdentifier &identifier, bool purge) override
Drop a table; optionally delete data and metadata files.
Status CreateNamespace(const Namespace &ns, const std::unordered_map< std::string, std::string > &properties) override
Create a namespace with associated properties.
Result< std::shared_ptr< Transaction > > StageCreateTable(const TableIdentifier &identifier, const std::shared_ptr< Schema > &schema, const std::shared_ptr< PartitionSpec > &spec, const std::shared_ptr< SortOrder > &order, const std::string &location, const std::unordered_map< std::string, std::string > &properties) override
Start a transaction to create a table.
Result< std::shared_ptr< Table > > RegisterTable(const TableIdentifier &identifier, const std::string &metadata_file_location) override
Register a table with the catalog if it does not exist.
Result< bool > NamespaceExists(const Namespace &ns) const override
Check whether the namespace exists.
Status DropNamespace(const Namespace &ns) override
Drop a namespace.
Result< std::vector< TableIdentifier > > ListTables(const Namespace &ns) const override
Return all the identifiers under this namespace.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88
A namespace in a catalog.
Definition table_identifier.h:35
Identifies a table in iceberg catalog.
Definition table_identifier.h:46