OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
omnisci Namespace Reference

Namespaces

 _parsers
 
 _samlutils
 
 _utils
 
 common
 
 completion_hints
 
 connection
 
 cursor
 
 dtypes
 
 exceptions
 
 extension_functions
 
 serialized_result_set
 
 thrift
 
 version
 

Classes

struct  DeviceIdentifier
 
class  JSON
 
class  UUID
 

Typedefs

using DeviceGroup = std::vector< DeviceIdentifier >
 

Functions

size_t file_size (const int fd)
 
void * checked_mmap (const int fd, const size_t sz)
 
void checked_munmap (void *addr, size_t length)
 
int msync (void *addr, size_t length, bool async)
 
int fsync (int fd)
 
int open (const char *path, int flags, int mode)
 
void close (const int fd)
 
::FILE * fopen (const char *filename, const char *mode)
 
::FILE * popen (const char *command, const char *type)
 
int32_t pclose (::FILE *fh)
 
int get_page_size ()
 
int32_t ftruncate (const int32_t fd, int64_t length)
 
std::vector< std::string > glob (const std::string &pattern)
 
std::string get_hostname ()
 
std::string get_root_abs_path ()
 
bool operator== (const JSON &json1, const JSON &json2)
 
bool operator!= (const JSON &json1, const JSON &json2)
 
template<typename T >
bool operator== (const JSON &json, const T &value)
 
template<typename T >
bool operator== (const T &value, const JSON &json)
 
template<typename T >
bool operator!= (const JSON &json, const T &value)
 
template<typename T >
bool operator!= (const T &value, const JSON &json)
 
bool operator== (const UUID &lhs, const UUID &rhs) noexcept
 
bool operator!= (const UUID &lhs, const UUID &rhs) noexcept
 
bool operator< (const UUID &lhs, const UUID &rhs) noexcept
 
std::string to_string (const UUID &uuid)
 

Variables

tuple __version__ = get_package_version()
 
string apilevel = "2.0"
 
int threadsafety = 2
 
string paramstyle = "named"
 
constexpr UUID empty_uuid {}
 

Typedef Documentation

using omnisci::DeviceGroup = typedef std::vector<DeviceIdentifier>

Definition at line 15 of file DeviceGroup.h.

Function Documentation

void * omnisci::checked_mmap ( const int  fd,
const size_t  sz 
)

Definition at line 38 of file omnisci_fs.cpp.

References CHECK.

Referenced by StringDictionary::checkAndConditionallyIncreaseOffsetCapacity(), StringDictionary::checkAndConditionallyIncreasePayloadCapacity(), and StringDictionary::StringDictionary().

38  {
39  auto ptr = mmap(nullptr, sz, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0);
40  CHECK(ptr != reinterpret_cast<void*>(-1));
41 #ifdef __linux__
42 #ifdef MADV_HUGEPAGE
43  madvise(ptr, sz, MADV_RANDOM | MADV_WILLNEED | MADV_HUGEPAGE);
44 #else
45  madvise(ptr, sz, MADV_RANDOM | MADV_WILLNEED);
46 #endif
47 #endif
48  return ptr;
49 }
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

void omnisci::checked_munmap ( void *  addr,
size_t  length 
)

Definition at line 51 of file omnisci_fs.cpp.

References CHECK_EQ.

Referenced by StringDictionary::checkAndConditionallyIncreaseOffsetCapacity(), StringDictionary::checkAndConditionallyIncreasePayloadCapacity(), and StringDictionary::~StringDictionary().

51  {
52  CHECK_EQ(0, munmap(addr, length));
53 }
#define CHECK_EQ(x, y)
Definition: Logger.h:217

+ Here is the caller graph for this function:

void omnisci::close ( const int  fd)

Definition at line 68 of file omnisci_fs.cpp.

Referenced by import_export::DataStreamSink::import_compressed(), CommandLineOptions::validate(), and StringDictionary::~StringDictionary().

68  {
69  ::close(fd);
70 }
void close(const int fd)
Definition: omnisci_fs.cpp:68

+ Here is the caller graph for this function:

size_t omnisci::file_size ( const int  fd)
FILE * omnisci::fopen ( const char *  filename,
const char *  mode 
)

Definition at line 72 of file omnisci_fs.cpp.

Referenced by anonymous_namespace{TableArchiver.cpp}::adjust_altered_table_files(), foreign_storage::SingleTextFileReader::checkForMoreRows(), File_Namespace::create(), TableArchiver::dumpTable(), import_export::Detector::importDelimited(), import_export::Importer::importDelimited(), PosixFileArchive::init_for_read(), File_Namespace::open(), and foreign_storage::SingleTextFileReader::SingleTextFileReader().

72  {
73  return ::fopen(filename, mode);
74 }
::FILE * fopen(const char *filename, const char *mode)
Definition: omnisci_fs.cpp:72

+ Here is the caller graph for this function:

int omnisci::fsync ( int  fd)

Definition at line 60 of file omnisci_fs.cpp.

Referenced by StringDictionary::checkpoint(), File_Namespace::FileInfo::syncToDisk(), File_Namespace::TableFileMgr::writeAndSyncEpochToDisk(), File_Namespace::FileMgr::writeAndSyncEpochToDisk(), and File_Namespace::FileMgr::writeAndSyncVersionToDisk().

60  {
61  return ::fsync(fd);
62 }
int fsync(int fd)
Definition: omnisci_fs.cpp:60

+ Here is the caller graph for this function:

int32_t omnisci::ftruncate ( const int32_t  fd,
int64_t  length 
)

Definition at line 84 of file omnisci_fs.cpp.

Referenced by CommandLineOptions::validate().

84  {
85  return ::ftruncate(fd, length);
86 }
int32_t ftruncate(const int32_t fd, int64_t length)
Definition: omnisci_fs.cpp:84

+ Here is the caller graph for this function:

std::string omnisci::get_hostname ( )

Definition at line 23 of file omnisci_hostname.cpp.

Referenced by DBHandler::get_memory(), DBHandler::get_server_status(), and DBHandler::get_status().

23  {
24  char hostname[_POSIX_HOST_NAME_MAX];
25  gethostname(hostname, _POSIX_HOST_NAME_MAX);
26  return {hostname};
27 }

+ Here is the caller graph for this function:

int omnisci::get_page_size ( )

Definition at line 27 of file omnisci_fs.cpp.

27  {
28  return getpagesize();
29 }
std::string omnisci::get_root_abs_path ( )

Definition at line 39 of file omnisci_path.cpp.

References CHECK, CHECK_EQ, CHECK_GT, and CHECK_LT.

Referenced by Geospatial::GDAL::init(), loadGeo(), and start_calcite_server_as_daemon().

39  {
40 #ifdef ENABLE_EMBEDDED_DATABASE
41  void* const handle = dlopen(DBEngine_LIBNAME, RTLD_LAZY | RTLD_NOLOAD);
42  if (handle) {
43  /* Non-zero handle means that libDBEngine.so has been loaded and
44  the omnisci root path will be determined with respect to the
45  location of the shared library rather than the appliction
46  `/proc/self/exe` path. */
47  const struct link_map* link_map = 0;
48  const int ret = dlinfo(handle, RTLD_DI_LINKMAP, &link_map);
49  CHECK_EQ(ret, 0);
50  CHECK(link_map);
51  /* Despite the dlinfo man page claim that l_name is absolute path,
52  it is so only when the location path to the library is absolute,
53  say, as specified in LD_LIBRARY_PATH. */
54  boost::filesystem::path abs_exe_dir(boost::filesystem::absolute(
55  boost::filesystem::canonical(std::string(link_map->l_name))));
56  abs_exe_dir.remove_filename();
57 #ifdef XCODE
58  const auto mapd_root = abs_exe_dir.parent_path().parent_path();
59 #else
60  const auto mapd_root = abs_exe_dir.parent_path();
61 #endif
62  return mapd_root.string();
63  }
64 #endif
65 #ifdef __APPLE__
66  char abs_exe_path[PROC_PIDPATHINFO_MAXSIZE] = {0};
67  auto path_len = proc_pidpath(getpid(), abs_exe_path, sizeof(abs_exe_path));
68 #else
69  char abs_exe_path[PATH_MAX] = {0};
70  auto path_len = readlink("/proc/self/exe", abs_exe_path, sizeof(abs_exe_path));
71 #endif
72  CHECK_GT(path_len, 0);
73  CHECK_LT(static_cast<size_t>(path_len), sizeof(abs_exe_path));
74  boost::filesystem::path abs_exe_dir(std::string(abs_exe_path, path_len));
75  abs_exe_dir.remove_filename();
76 #ifdef XCODE
77  const auto mapd_root = abs_exe_dir.parent_path().parent_path();
78 #else
79  const auto mapd_root = abs_exe_dir.parent_path();
80 #endif
81  return mapd_root.string();
82 }
#define CHECK_EQ(x, y)
Definition: Logger.h:217
#define CHECK_GT(x, y)
Definition: Logger.h:221
#define CHECK_LT(x, y)
Definition: Logger.h:219
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

std::vector< std::string > omnisci::glob ( const std::string &  pattern)

Definition at line 24 of file omnisci_glob.cpp.

References i.

Referenced by anonymous_namespace{omnisci_glob.cpp}::glob(), and shared::anonymous_namespace{file_path_util.cpp}::glob_local_recursive_files().

24  {
25  std::vector<std::string> results;
26  glob_t glob_result;
27  ::glob(pattern.c_str(), GLOB_BRACE | GLOB_TILDE, nullptr, &glob_result);
28  for (size_t i = 0; i < glob_result.gl_pathc; i++) {
29  results.emplace_back(glob_result.gl_pathv[i]);
30  }
31  globfree(&glob_result);
32  return results;
33 }
std::vector< std::string > glob(const std::string &pattern)

+ Here is the caller graph for this function:

int omnisci::msync ( void *  addr,
size_t  length,
bool  async 
)

Definition at line 55 of file omnisci_fs.cpp.

Referenced by StringDictionary::checkpoint().

55  {
56  // TODO: support MS_INVALIDATE?
57  return ::msync(addr, length, async ? MS_ASYNC : MS_SYNC);
58 }
future< Result > async(Fn &&fn, Args &&...args)
int msync(void *addr, size_t length, bool async)
Definition: omnisci_fs.cpp:55

+ Here is the caller graph for this function:

int omnisci::open ( const char *  path,
int  flags,
int  mode 
)
bool omnisci::operator!= ( const UUID &  lhs,
const UUID &  rhs 
)
inlinenoexcept

Definition at line 103 of file uuid.h.

103  {
104  return !(lhs == rhs);
105 }
bool omnisci::operator!= ( const JSON &  json1,
const JSON &  json2 
)
inline

Definition at line 327 of file json.h.

References omnisci::JSON::vptr_.

327  {
328  return (*json1.vptr_ != *json2.vptr_);
329 }
template<typename T >
bool omnisci::operator!= ( const JSON &  json,
const T &  value 
)
inline

Definition at line 343 of file json.h.

References omnisci::JSON::vptr_.

343  {
344  return (*json.vptr_ != value);
345 }
template<typename T >
bool omnisci::operator!= ( const T &  value,
const JSON &  json 
)
inline

Definition at line 347 of file json.h.

347  {
348  return (json != value);
349 }
bool omnisci::operator< ( const UUID &  lhs,
const UUID &  rhs 
)
inlinenoexcept

Definition at line 107 of file uuid.h.

107  {
108  return lhs.data_ < rhs.data_;
109 }
bool omnisci::operator== ( const UUID &  lhs,
const UUID &  rhs 
)
inlinenoexcept

Definition at line 99 of file uuid.h.

99  {
100  return lhs.data_ == rhs.data_;
101 }
bool omnisci::operator== ( const JSON &  json1,
const JSON &  json2 
)
inline

Definition at line 323 of file json.h.

References omnisci::JSON::vptr_.

323  {
324  return (*json1.vptr_ == *json2.vptr_);
325 }
template<typename T >
bool omnisci::operator== ( const JSON &  json,
const T &  value 
)
inline

Definition at line 334 of file json.h.

References omnisci::JSON::vptr_.

334  {
335  return (*json.vptr_ == value);
336 }
template<typename T >
bool omnisci::operator== ( const T &  value,
const JSON &  json 
)
inline

Definition at line 338 of file json.h.

338  {
339  return (json == value);
340 }
int32_t omnisci::pclose ( ::FILE *  fh)

Definition at line 80 of file omnisci_fs.cpp.

Referenced by anonymous_namespace{UdfCompiler.cpp}::exec_output().

80  {
81  return ::pclose(fh);
82 }
int32_t pclose(::FILE *fh)
Definition: omnisci_fs.cpp:80

+ Here is the caller graph for this function:

FILE * omnisci::popen ( const char *  command,
const char *  type 
)

Definition at line 76 of file omnisci_fs.cpp.

Referenced by anonymous_namespace{UdfCompiler.cpp}::exec_output().

76  {
77  return ::popen(command, type);
78 }
::FILE * popen(const char *command, const char *type)
Definition: omnisci_fs.cpp:76

+ Here is the caller graph for this function:

std::string omnisci::to_string ( const UUID &  uuid)
inline

Definition at line 111 of file uuid.h.

111  {
112  std::stringstream ss;
113  ss << uuid;
114  return ss.str();
115 }

Variable Documentation

tuple omnisci.__version__ = get_package_version()

Definition at line 2 of file __init__.py.

string omnisci.apilevel = "2.0"

Definition at line 5 of file __init__.py.

constexpr UUID omnisci::empty_uuid {}

Definition at line 117 of file uuid.h.

string omnisci.paramstyle = "named"

Definition at line 7 of file __init__.py.

int omnisci.threadsafety = 2

Definition at line 6 of file __init__.py.