OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::OptionsContainer Struct Reference

#include <OptionsContainer.h>

+ Inheritance diagram for foreign_storage::OptionsContainer:

Public Member Functions

 OptionsContainer ()
 
 OptionsContainer (const OptionsMap &options)
 
 OptionsContainer (const std::string &options_str)
 
void populateOptionsMap (OptionsMap &&options_map, bool clear=false)
 
void populateOptionsMap (const rapidjson::Value &ddl_options, bool clear=false)
 
void populateOptionsMap (const std::string &options_json, bool clear=false)
 
std::string getOptionsAsJsonString () const
 
std::optional< std::string > getOption (const std::string_view &key) const
 
bool getOptionAsBool (const std::string_view &key) const
 

Public Attributes

OptionsMap options
 

Detailed Description

Definition at line 31 of file OptionsContainer.h.

Constructor & Destructor Documentation

foreign_storage::OptionsContainer::OptionsContainer ( )
inline

Definition at line 34 of file OptionsContainer.h.

34 {}
foreign_storage::OptionsContainer::OptionsContainer ( const OptionsMap options)
inline

Definition at line 36 of file OptionsContainer.h.

foreign_storage::OptionsContainer::OptionsContainer ( const std::string &  options_str)
inline

Definition at line 38 of file OptionsContainer.h.

References populateOptionsMap().

38 { populateOptionsMap(options_str); }
void populateOptionsMap(OptionsMap &&options_map, bool clear=false)

+ Here is the call graph for this function:

Member Function Documentation

std::optional<std::string> foreign_storage::OptionsContainer::getOption ( const std::string_view &  key) const
inline

Definition at line 87 of file OptionsContainer.h.

References options.

Referenced by foreign_storage::AbstractFileStorageDataWrapper::allowFileRollOff(), foreign_storage::anonymous_namespace{AbstractFileStorageDataWrapper.cpp}::get_file_roll_off_value(), foreign_storage::get_num_threads(), foreign_storage::AbstractFileStorageDataWrapper::getFilePathOptions(), foreign_storage::AbstractFileStorageDataWrapper::getFullFilePath(), getOptionAsBool(), and foreign_storage::AbstractFileStorageDataWrapper::validateFilePathOptionKey().

87  {
88  if (auto it = options.find(key); it != options.end()) {
89  return it->second;
90  } else {
91  return {};
92  }
93  }

+ Here is the caller graph for this function:

bool foreign_storage::OptionsContainer::getOptionAsBool ( const std::string_view &  key) const
inline

Definition at line 95 of file OptionsContainer.h.

References getOption().

Referenced by foreign_storage::LazyParquetChunkLoader::appendRowGroups(), foreign_storage::LazyParquetChunkLoader::loadRowGroups(), and foreign_storage::LazyParquetChunkLoader::metadataScan().

95  {
96  auto option = getOption(key);
97  return option.has_value() && option.value() == "TRUE";
98  }
std::optional< std::string > getOption(const std::string_view &key) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string foreign_storage::OptionsContainer::getOptionsAsJsonString ( ) const
inline

Definition at line 69 of file OptionsContainer.h.

References options.

Referenced by AlterForeignServerCommand::setForeignServerOptions().

69  {
70  rapidjson::Document document;
71  document.SetObject();
72 
73  for (const auto& [key, value] : options) {
74  document.AddMember(rapidjson::Value().SetString(
75  key.c_str(), key.length(), document.GetAllocator()),
76  rapidjson::Value().SetString(
77  value.c_str(), value.length(), document.GetAllocator()),
78  document.GetAllocator());
79  }
80 
81  rapidjson::StringBuffer buffer;
82  rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
83  document.Accept(writer);
84  return buffer.GetString();
85  }

+ Here is the caller graph for this function:

void foreign_storage::OptionsContainer::populateOptionsMap ( OptionsMap &&  options_map,
bool  clear = false 
)
inline

Definition at line 40 of file OptionsContainer.h.

References options.

Referenced by RefreshForeignTablesCommand::execute(), OptionsContainer(), populateOptionsMap(), Catalog_Namespace::Catalog::reloadForeignTableUnlocked(), AlterForeignServerCommand::setForeignServerOptions(), and Catalog_Namespace::Catalog::setForeignServerOptions().

40  {
41  if (clear) {
42  options = options_map;
43  } else {
44  // The merge order here is to make sure we overwrite duplicates in options. If we
45  // used options.merge(options_map) we would preserve existing entries.
46  options_map.merge(options);
47  options = options_map;
48  }
49  }

+ Here is the caller graph for this function:

void foreign_storage::OptionsContainer::populateOptionsMap ( const rapidjson::Value &  ddl_options,
bool  clear = false 
)
inline

Definition at line 51 of file OptionsContainer.h.

References CHECK, options, and to_upper().

51  {
52  CHECK(ddl_options.IsObject());
53  if (clear) {
54  options.clear();
55  }
56  for (auto itr = ddl_options.MemberBegin(); itr != ddl_options.MemberEnd(); ++itr) {
57  std::string key = to_upper(itr->name.GetString());
58  options[key] = itr->value.GetString();
59  }
60  }
std::string to_upper(const std::string &str)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

void foreign_storage::OptionsContainer::populateOptionsMap ( const std::string &  options_json,
bool  clear = false 
)
inline

Definition at line 62 of file OptionsContainer.h.

References CHECK, options, and populateOptionsMap().

62  {
63  CHECK(!options_json.empty());
64  rapidjson::Document options;
65  options.Parse(options_json);
66  populateOptionsMap(options);
67  }
void populateOptionsMap(OptionsMap &&options_map, bool clear=false)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

Member Data Documentation

OptionsMap foreign_storage::OptionsContainer::options

Definition at line 32 of file OptionsContainer.h.

Referenced by foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), RefreshForeignTablesCommand::execute(), foreign_storage::anonymous_namespace{RegexFileBufferParser.cpp}::get_line_regex(), foreign_storage::anonymous_namespace{RegexFileBufferParser.cpp}::get_line_start_regex(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::get_next_refresh_time(), foreign_storage::ParquetDataWrapper::getAllFilePaths(), getOption(), getOptionsAsJsonString(), foreign_storage::AbstractTextFileDataWrapper::iterativeFileScan(), foreign_storage::ParquetDataWrapper::ParquetDataWrapper(), foreign_storage::ParquetImporter::ParquetImporter(), foreign_storage::AbstractTextFileDataWrapper::populateChunkMetadata(), foreign_storage::AbstractTextFileDataWrapper::populateChunks(), populateOptionsMap(), Catalog_Namespace::Catalog::recreateSystemTableIfUpdated(), foreign_storage::AbstractTextFileDataWrapper::restoreDataWrapperInternals(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::set_common_db_log_system_table_options(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::set_common_log_system_table_options(), Catalog_Namespace::Catalog::setForeignServerOptions(), foreign_storage::Csv::anonymous_namespace{CsvShared.cpp}::validate_and_get_bool_value(), foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_and_get_bool_value(), foreign_storage::anonymous_namespace{RegexFileBufferParser.cpp}::validate_and_get_bool_value(), foreign_storage::Csv::validate_and_get_copy_params(), foreign_storage::Csv::anonymous_namespace{CsvShared.cpp}::validate_and_get_delimiter(), foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_and_get_delimiter(), foreign_storage::Csv::validate_and_get_is_s3_select(), foreign_storage::Csv::anonymous_namespace{CsvShared.cpp}::validate_and_get_string_with_length(), foreign_storage::anonymous_namespace{CsvFileBufferParser.cpp}::validate_and_get_string_with_length(), foreign_storage::CsvFileBufferParser::validateAndGetCopyParams(), foreign_storage::RegexFileBufferParser::validateAndGetCopyParams(), foreign_storage::CsvDataWrapper::validateAndGetIsS3Select(), foreign_storage::AbstractFileStorageDataWrapper::validateFilePath(), foreign_storage::AbstractFileStorageDataWrapper::validateServerOptions(), foreign_storage::InternalSystemDataWrapper::validateServerOptions(), and foreign_storage::RegexParserDataWrapper::validateTableOptions().


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