OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  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)
 
int get_page_size ()
 
std::vector< std::string > glob (const std::string &pattern)
 
std::string get_hostname ()
 
std::string get_root_abs_path ()
 
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:203

+ 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:211

+ 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)

Definition at line 31 of file omnisci_fs.cpp.

References CHECK_EQ.

Referenced by anonymous_namespace{TableArchiver.cpp}::adjust_altered_table_files(), get_filesize(), File_Namespace::FileMgr::getMetadataForFile(), File_Namespace::CachingFileMgr::getWrapperSpaceReservedByTable(), File_Namespace::FileMgr::openAndReadEpochFile(), File_Namespace::CachingFileMgr::openAndReadEpochFileUnlocked(), File_Namespace::FileMgr::openAndReadLegacyEpochFile(), File_Namespace::FileMgr::readPageMappingsFromStatusFile(), File_Namespace::FileMgr::readVersionFromDisk(), and StringDictionary::StringDictionary().

31  {
32  struct stat buf;
33  int err = fstat(fd, &buf);
34  CHECK_EQ(0, err);
35  return buf.st_size;
36 }
#define CHECK_EQ(x, y)
Definition: Logger.h:211

+ Here is the caller graph for this function:

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::SingleFileReader::checkForMoreRows(), File_Namespace::create(), TableArchiver::dumpTable(), import_export::Detector::importDelimited(), import_export::Importer::importDelimited(), PosixFileArchive::init_for_read(), File_Namespace::open(), and foreign_storage::SingleFileReader::SingleFileReader().

72  {
73  return ::fopen(filename, mode);
74 }
std::string filename(char const *path)
Definition: Logger.cpp:62
::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::CachingFileMgr::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:

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(), main(), 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:211
#define CHECK_GT(x, y)
Definition: Logger.h:215
#define CHECK_LT(x, y)
Definition: Logger.h:213
#define CHECK(condition)
Definition: Logger.h:203

+ 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 import_export::DataStreamSink::archivePlumber(), ddl_utils::get_expanded_file_paths(), and anonymous_namespace{omnisci_glob.cpp}::glob().

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 }
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 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 }
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.