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::GlobalUserSettings Struct Reference
Collaboration diagram for duckdb::GlobalUserSettings:

Public Member Functions

 GlobalUserSettings (const GlobalUserSettings &other)
GlobalUserSettings & operator= (const GlobalUserSettings &)
void SetUserSetting (idx_t setting_index, Value target_value)
void ClearSetting (idx_t setting_index)
bool IsSet (idx_t setting_index) const
SettingLookupResult TryGetSetting (idx_t setting_index, Value &result_value) const
bool HasExtensionOption (const string &name) const
idx_t AddExtensionOption (const string &name, ExtensionOption extension_option)
case_insensitive_map_t< ExtensionOption > GetExtensionSettings () const
bool TryGetExtensionOption (const String &name, ExtensionOption &result) const
hugeint_t GetUUID () const
CachedGlobalSettings & GetSettings () const

Private Attributes

mutex lock
UserSettingsMap settings_map
 Database-global settings.
case_insensitive_map_t< ExtensionOption > extension_parameters
 Extra parameters that can be SET for loaded extensions.
atomic< idx_t > settings_version
 Current version of the settings - incremented when settings are modified.
hugeint_t uuid
 Settings uuid.

Constructor & Destructor Documentation

◆ GlobalUserSettings() [1/2]

duckdb::GlobalUserSettings::GlobalUserSettings ( )
303312}
static hugeint_t GenerateRandomUUID(RandomEngine &engine)
Generate a random UUID v4 value.
Definition duckdb.cpp:131021
atomic< idx_t > settings_version
Current version of the settings - incremented when settings are modified.
Definition duckdb.hpp:37178
hugeint_t uuid
Settings uuid.
Definition duckdb.hpp:37180

◆ GlobalUserSettings() [2/2]

duckdb::GlobalUserSettings::GlobalUserSettings ( const GlobalUserSettings & other)
303315 : settings_map(other.settings_map), extension_parameters(other.extension_parameters),
303316 settings_version(other.settings_version.load()), uuid(UUID::GenerateRandomUUID()) {
303317}
UserSettingsMap settings_map
Database-global settings.
Definition duckdb.hpp:37174
case_insensitive_map_t< ExtensionOption > extension_parameters
Extra parameters that can be SET for loaded extensions.
Definition duckdb.hpp:37176

Member Function Documentation

◆ operator=()

GlobalUserSettings & duckdb::GlobalUserSettings::operator= ( const GlobalUserSettings & other)
303319 {
303320 settings_map = other.settings_map;
303321 extension_parameters = other.extension_parameters;
303322 settings_version = other.settings_version.load();
303323 return *this;
303324}

◆ SetUserSetting()

void duckdb::GlobalUserSettings::SetUserSetting ( idx_t setting_index,
Value target_value )
303326 {
303327 lock_guard<mutex> guard(lock);
303328 settings_map.SetUserSetting(setting_index, std::move(target_value));
303330}

◆ ClearSetting()

void duckdb::GlobalUserSettings::ClearSetting ( idx_t setting_index)
303332 {
303333 lock_guard<mutex> guard(lock);
303334 settings_map.ClearSetting(setting_index);
303336}

◆ IsSet()

bool duckdb::GlobalUserSettings::IsSet ( idx_t setting_index) const
303338 {
303339 lock_guard<mutex> guard(lock);
303340 return settings_map.IsSet(setting_index);
303341}

◆ TryGetSetting()

SettingLookupResult duckdb::GlobalUserSettings::TryGetSetting ( idx_t setting_index,
Value & result_value ) const
303343 {
303344#ifndef __MINGW32__
303345 // look-up in global settings
303346 const auto &cache = GetSettings();
303347 if (cache.settings.TryGetSetting(setting_index, result_value)) {
303348 return SettingLookupResult(SettingScope::GLOBAL);
303349 }
303350#else
303351 lock_guard<mutex> guard(lock);
303352 if (settings_map.TryGetSetting(setting_index, result_value)) {
303353 return SettingLookupResult(SettingScope::GLOBAL);
303354 }
303355#endif
303356
303357 return SettingLookupResult();
303358}
@ GLOBAL
Setting is from the global Setting scope.
Definition duckdb.hpp:37010

◆ HasExtensionOption()

bool duckdb::GlobalUserSettings::HasExtensionOption ( const string & name) const
303360 {
303361 lock_guard<mutex> l(lock);
303362 return extension_parameters.find(name) != extension_parameters.end();
303363}

◆ AddExtensionOption()

idx_t duckdb::GlobalUserSettings::AddExtensionOption ( const string & name,
ExtensionOption extension_option )
303365 {
303366 lock_guard<mutex> l(lock);
303367 const auto new_option = extension_parameters.emplace(make_pair(name, std::move(extension_option)));
303368 const auto did_insert = new_option.second;
303369 auto &option = new_option.first->second;
303370
303371 if (!did_insert) {
303372 return option.setting_index.GetIndex();
303373 }
303374
303375 auto setting_index = GeneratedSettingInfo::MaxSettingIndex + extension_parameters.size() - 1;
303376 option.setting_index = setting_index;
303378 return setting_index;
303379}

◆ GetExtensionSettings()

case_insensitive_map_t< ExtensionOption > duckdb::GlobalUserSettings::GetExtensionSettings ( ) const
303381 {
303382 lock_guard<mutex> l(lock);
303383 return extension_parameters;
303384}

◆ TryGetExtensionOption()

bool duckdb::GlobalUserSettings::TryGetExtensionOption ( const String & name,
ExtensionOption & result ) const
303386 {
303387 lock_guard<mutex> l(lock);
303388 auto entry = extension_parameters.find(name.ToStdString());
303389 if (entry == extension_parameters.end()) {
303390 return false;
303391 }
303392 result = entry->second;
303393 return true;
303394}

◆ GetUUID()

hugeint_t duckdb::GlobalUserSettings::GetUUID ( ) const
303419 {
303420 return uuid;
303421}

◆ GetSettings()

CachedGlobalSettings & duckdb::GlobalUserSettings::GetSettings ( ) const
303397 {
303398// Cache of global settings - used to allow lock-free access to global settings in a thread-safe manner
303399#ifdef __MVS__
303400 static __tlssim<CachedGlobalSettings> current_cache_impl;
303401#define current_cache (*current_cache_impl.access())
303402#else
303403 thread_local CachedGlobalSettings current_cache;
303404#endif
303405
303406 const auto current_version = settings_version.load(std::memory_order_relaxed);
303407 if (!current_cache.global_user_settings || this != current_cache.global_user_settings.get() ||
303408 current_cache.uuid != uuid || current_cache.version != current_version) {
303409 // out-of-date, refresh the cache
303410 lock_guard<mutex> guard(lock);
303411 current_cache = CachedGlobalSettings(*this, settings_version, settings_map);
303412 }
303413 return current_cache;
303414#ifdef __MVS__
303415#undef current_cache
303416#endif
303417}

The documentation for this struct was generated from the following files: