Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::DatabaseManager Class Reference

The DatabaseManager is a class that sits at the root of all attached databases. More...

Collaboration diagram for duckdb::DatabaseManager:

Public Member Functions

 DatabaseManager (DatabaseInstance &db)
 
DatabaseInstanceGetInstance ()
 
void InitializeSystemCatalog ()
 Initializes the system catalog of the attached SYSTEM_DATABASE.
 
void FinalizeStartup ()
 Finalize starting up the system.
 
optional_ptr< AttachedDatabaseGetDatabase (ClientContext &context, const string &name)
 Get an attached database by its name.
 
shared_ptr< AttachedDatabaseGetDatabase (const string &name)
 
shared_ptr< AttachedDatabaseAttachDatabase (ClientContext &context, AttachInfo &info, AttachOptions &options)
 Attach a new database.
 
void DetachDatabase (ClientContext &context, const string &name, OnEntryNotFound if_not_found)
 Detach an existing database.
 
void Alter (ClientContext &context, AlterInfo &info)
 Alter operation dispatcher.
 
shared_ptr< AttachedDatabaseDetachInternal (const string &name)
 Rollback the attach of a database.
 
CatalogGetSystemCatalog ()
 Returns a reference to the system catalog.
 
void SetDefaultDatabase (ClientContext &context, const string &new_value)
 
InsertDatabasePathResult InsertDatabasePath (const AttachInfo &info, AttachOptions &options)
 Inserts a path to name mapping to the database paths map.
 
void GetDatabaseType (ClientContext &context, AttachInfo &info, const DBConfig &config, AttachOptions &options)
 
vector< shared_ptr< AttachedDatabase > > GetDatabases (ClientContext &context, const optional_idx max_db_count=optional_idx())
 
vector< shared_ptr< AttachedDatabase > > GetDatabases ()
 Scans the catalog set and returns each committed database entry.
 
idx_t ApproxDatabaseCount ()
 Returns the approximate count of attached databases.
 
void ResetDatabases ()
 
transaction_t GetNewQueryNumber ()
 
transaction_t ActiveQueryNumber () const
 
transaction_t GetNewTransactionNumber ()
 
transaction_t ActiveTransactionNumber () const
 
idx_t NextOid ()
 
bool HasDefaultDatabase ()
 
vector< string > GetAttachedDatabasePaths ()
 Gets a list of all attached database paths.
 
shared_ptr< AttachedDatabaseGetDatabaseInternal (const lock_guard< mutex > &, const string &name)
 

Static Public Member Functions

static DatabaseManagerGet (DatabaseInstance &db)
 
static DatabaseManagerGet (ClientContext &db)
 
static DatabaseManagerGet (AttachedDatabase &db)
 
static const string & GetDefaultDatabase (ClientContext &context)
 

Private Member Functions

optional_ptr< AttachedDatabaseFinalizeAttach (ClientContext &context, AttachInfo &info, shared_ptr< AttachedDatabase > database)
 
void RenameDatabase (ClientContext &context, const string &old_name, const string &new_name, OnEntryNotFound if_not_found)
 Rename an existing database.
 

Private Attributes

DatabaseInstancedb
 
shared_ptr< AttachedDatabasesystem
 The system database is a special database that holds system entries (e.g. functions)
 
mutex databases_lock
 Lock for databases.
 
case_insensitive_map_t< shared_ptr< AttachedDatabase > > databases
 The set of attached databases.
 
atomic< idx_tnext_oid
 The next object id handed out by the NextOid method.
 
atomic< transaction_tcurrent_query_number
 The current query number.
 
atomic< transaction_tcurrent_transaction_id
 The current transaction number.
 
string default_database
 The current default database.
 
shared_ptr< DatabaseFilePathManagerpath_manager
 Manager for ensuring we never open the same database file twice in the same program.
 

Friends

class Catalog
 

Detailed Description

The DatabaseManager is a class that sits at the root of all attached databases.

Member Function Documentation

◆ GetInstance()

DatabaseInstance & duckdb::DatabaseManager::GetInstance ( )
inline
40772 {
40773 return db;
40774 }

◆ GetDatabaseType()

void duckdb::DatabaseManager::GetDatabaseType ( ClientContext context,
AttachInfo info,
const DBConfig config,
AttachOptions options 
)

Returns the database type. This might require checking the header of the file, in which case the file handle is necessary. We can only grab the file handle, if it is not yet held, even for uncommitted changes. Thus, we have to lock for this operation.

◆ GetDatabases()

vector< shared_ptr< AttachedDatabase > > duckdb::DatabaseManager::GetDatabases ( ClientContext context,
const optional_idx  max_db_count = optional_idx() 
)

Scans the catalog set and adds each committed database entry, and each database entry of the current transaction, to a vector holding AttachedDatabase references

◆ ResetDatabases()

void duckdb::DatabaseManager::ResetDatabases ( )

Removes all databases from the catalog set. This is necessary for the database instance's destructor, as the database manager has to be alive when destroying the catalog set objects.

◆ GetNewQueryNumber()

transaction_t duckdb::DatabaseManager::GetNewQueryNumber ( )
inline
40816 {
40817 return current_query_number++;
40818 }
atomic< transaction_t > current_query_number
The current query number.
Definition duckdb.hpp:40854

◆ ActiveQueryNumber()

transaction_t duckdb::DatabaseManager::ActiveQueryNumber ( ) const
inline
40819 {
40820 return current_query_number;
40821 }

◆ GetNewTransactionNumber()

transaction_t duckdb::DatabaseManager::GetNewTransactionNumber ( )
inline
40822 {
40823 return current_transaction_id++;
40824 }
atomic< transaction_t > current_transaction_id
The current transaction number.
Definition duckdb.hpp:40856

◆ ActiveTransactionNumber()

transaction_t duckdb::DatabaseManager::ActiveTransactionNumber ( ) const
inline
40825 {
40827 }

◆ NextOid()

idx_t duckdb::DatabaseManager::NextOid ( )
inline
40828 {
40829 return next_oid++;
40830 }
atomic< idx_t > next_oid
The next object id handed out by the NextOid method.
Definition duckdb.hpp:40852

◆ HasDefaultDatabase()

bool duckdb::DatabaseManager::HasDefaultDatabase ( )
inline
40831 {
40832 return !default_database.empty();
40833 }
string default_database
The current default database.
Definition duckdb.hpp:40858

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