iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | List of all members
iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits > Class Template Referencefinal

CatalogStore backed by a concrete sqlpp23 connection source. More...

#include <catalog_store_sqlpp23_internal.h>

Inheritance diagram for iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >:
iceberg::sql::CatalogStore

Public Member Functions

template<typename... SourceArgs>
 Sqlpp23CatalogStore (std::string catalog_name, SourceArgs &&... source_args)
 
Status Initialize () override
 Create the backing tables if they do not already exist.
 
Result< std::vector< std::string > > ListNamespaceNames () override
 Return the distinct namespace identifiers known to this catalog.
 
Result< std::vector< NamespaceProperty > > GetNamespaceProperties (std::string_view ns) override
 Return all property rows stored for ns.
 
Status InsertNamespaceProperty (std::string_view ns, std::string_view key, std::optional< std::string_view > value) override
 Insert one property row for ns.
 
Status DeleteNamespaceProperty (std::string_view ns, std::string_view key) override
 Delete the property row identified by (ns, key), if present.
 
Result< int64_t > DeleteNamespace (std::string_view ns) override
 Delete all property rows for ns.
 
Result< std::vector< std::string > > ListTableNames (std::string_view ns) override
 Return the table names stored directly under ns.
 
Result< bool > TableExists (std::string_view ns, std::string_view name) override
 Whether a row exists for the table (ns, name).
 
Result< std::optional< std::string > > GetTableMetadataLocation (std::string_view ns, std::string_view name) override
 Return the current metadata location of (ns, name).
 
Status InsertTable (std::string_view ns, std::string_view name, std::string_view metadata_location) override
 Insert a new table row with the given metadata location.
 
Result< int64_t > UpdateTableMetadataLocation (std::string_view ns, std::string_view name, std::string_view new_location, std::string_view new_previous_location, std::string_view expected_current_location) override
 Conditionally update a table's metadata location (optimistic CAS).
 
Result< int64_t > DeleteTable (std::string_view ns, std::string_view name) override
 Delete the table row (ns, name), if present.
 
Result< int64_t > RenameTable (std::string_view from_ns, std::string_view from_name, std::string_view to_ns, std::string_view to_name) override
 Move a table row to a new namespace and/or name.
 
Status RunInTransaction (const std::function< Status()> &body) override
 Execute body atomically inside a single transaction.
 

Detailed Description

template<typename ConnectionSource, typename Traits>
class iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >

CatalogStore backed by a concrete sqlpp23 connection source.

Template Parameters
ConnectionSourceA single connection or pooled connection source.
TraitsA policy type providing static bool IsUniqueViolation(const std::exception&) and optionally static bool IsDuplicateColumn(const std::exception&).

Member Function Documentation

◆ DeleteNamespace()

template<typename ConnectionSource , typename Traits >
Result< int64_t > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::DeleteNamespace ( std::string_view  ns)
inlineoverridevirtual

Delete all property rows for ns.

Parameters
nsA namespace identifier in the store's string form.
Returns
The number of rows deleted.

Implements iceberg::sql::CatalogStore.

◆ DeleteNamespaceProperty()

template<typename ConnectionSource , typename Traits >
Status iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::DeleteNamespaceProperty ( std::string_view  ns,
std::string_view  key 
)
inlineoverridevirtual

Delete the property row identified by (ns, key), if present.

Parameters
nsA namespace identifier in the store's string form.
keyProperty key.
Returns
Status indicating success if the row was deleted or did not exist.

Implements iceberg::sql::CatalogStore.

◆ DeleteTable()

template<typename ConnectionSource , typename Traits >
Result< int64_t > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::DeleteTable ( std::string_view  ns,
std::string_view  name 
)
inlineoverridevirtual

Delete the table row (ns, name), if present.

Parameters
nsA namespace identifier in the store's string form.
nameTable name.
Returns
The number of rows deleted.

Implements iceberg::sql::CatalogStore.

◆ GetNamespaceProperties()

template<typename ConnectionSource , typename Traits >
Result< std::vector< NamespaceProperty > > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::GetNamespaceProperties ( std::string_view  ns)
inlineoverridevirtual

Return all property rows stored for ns.

Parameters
nsA namespace identifier in the store's string form.
Returns
The property rows stored for the namespace.

Implements iceberg::sql::CatalogStore.

◆ GetTableMetadataLocation()

template<typename ConnectionSource , typename Traits >
Result< std::optional< std::string > > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::GetTableMetadataLocation ( std::string_view  ns,
std::string_view  name 
)
inlineoverridevirtual

Return the current metadata location of (ns, name).

Parameters
nsA namespace identifier in the store's string form.
nameTable name.
Returns
The metadata location, or std::nullopt if the table has no row or its metadata_location column is NULL.

Implements iceberg::sql::CatalogStore.

◆ Initialize()

template<typename ConnectionSource , typename Traits >
Status iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::Initialize ( )
inlineoverridevirtual

Create the backing tables if they do not already exist.

Returns
Status indicating success if the tables are ready.

Implements iceberg::sql::CatalogStore.

◆ InsertNamespaceProperty()

template<typename ConnectionSource , typename Traits >
Status iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::InsertNamespaceProperty ( std::string_view  ns,
std::string_view  key,
std::optional< std::string_view >  value 
)
inlineoverridevirtual

Insert one property row for ns.

A primary-key collision (same namespace + key) must be reported as ErrorKind::kAlreadyExists.

Parameters
nsA namespace identifier in the store's string form.
keyProperty key.
valueProperty value, or std::nullopt for SQL NULL.
Returns
Status indicating success if the row was inserted.

Implements iceberg::sql::CatalogStore.

◆ InsertTable()

template<typename ConnectionSource , typename Traits >
Status iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::InsertTable ( std::string_view  ns,
std::string_view  name,
std::string_view  metadata_location 
)
inlineoverridevirtual

Insert a new table row with the given metadata location.

The previous_metadata_location column is set to NULL. A primary-key collision must be reported as ErrorKind::kAlreadyExists.

Parameters
nsA namespace identifier in the store's string form.
nameTable name.
metadata_locationTable metadata location.
Returns
Status indicating success if the row was inserted.

Implements iceberg::sql::CatalogStore.

◆ ListNamespaceNames()

template<typename ConnectionSource , typename Traits >
Result< std::vector< std::string > > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::ListNamespaceNames ( )
inlineoverridevirtual

Return the distinct namespace identifiers known to this catalog.

Returns
A list of namespace identifiers in the store's string form.

Implements iceberg::sql::CatalogStore.

◆ ListTableNames()

template<typename ConnectionSource , typename Traits >
Result< std::vector< std::string > > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::ListTableNames ( std::string_view  ns)
inlineoverridevirtual

Return the table names stored directly under ns.

Parameters
nsA namespace identifier in the store's string form.
Returns
A list of table names.

Implements iceberg::sql::CatalogStore.

◆ RenameTable()

template<typename ConnectionSource , typename Traits >
Result< int64_t > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::RenameTable ( std::string_view  from_ns,
std::string_view  from_name,
std::string_view  to_ns,
std::string_view  to_name 
)
inlineoverridevirtual

Move a table row to a new namespace and/or name.

A primary-key collision with an existing target must be reported as ErrorKind::kAlreadyExists.

Parameters
from_nsSource namespace identifier in the store's string form.
from_nameSource table name.
to_nsTarget namespace identifier in the store's string form.
to_nameTarget table name.
Returns
The number of rows updated (1 on success, 0 if the source is gone).

Implements iceberg::sql::CatalogStore.

◆ RunInTransaction()

template<typename ConnectionSource , typename Traits >
Status iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::RunInTransaction ( const std::function< Status()> &  body)
inlineoverridevirtual

Execute body atomically inside a single transaction.

The implementation begins a transaction, invokes body (which issues store operations on this same instance), then commits if body returns success or rolls back otherwise. Implementations are not required to support nesting.

Parameters
bodyTransaction body to execute.
Returns
Status returned by body, or a transaction error.

Implements iceberg::sql::CatalogStore.

◆ TableExists()

template<typename ConnectionSource , typename Traits >
Result< bool > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::TableExists ( std::string_view  ns,
std::string_view  name 
)
inlineoverridevirtual

Whether a row exists for the table (ns, name).

Parameters
nsA namespace identifier in the store's string form.
nameTable name.
Returns
true if the table row exists, false otherwise.

Implements iceberg::sql::CatalogStore.

◆ UpdateTableMetadataLocation()

template<typename ConnectionSource , typename Traits >
Result< int64_t > iceberg::sql::Sqlpp23CatalogStore< ConnectionSource, Traits >::UpdateTableMetadataLocation ( std::string_view  ns,
std::string_view  name,
std::string_view  new_location,
std::string_view  new_previous_location,
std::string_view  expected_current_location 
)
inlineoverridevirtual

Conditionally update a table's metadata location (optimistic CAS).

The update only applies when the stored metadata_location still equals expected_current_location.

Parameters
nsA namespace identifier in the store's string form.
nameTable name.
new_locationNew table metadata location.
new_previous_locationNew previous metadata location.
expected_current_locationExpected current metadata location.
Returns
The number of rows updated (1 on success, 0 on a stale base).

Implements iceberg::sql::CatalogStore.


The documentation for this class was generated from the following file: