OmniSciDB  ca0c39ec8f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StringDictionaryProxy.cpp File Reference
#include "StringDictionary/StringDictionaryProxy.h"
#include "Logger/Logger.h"
#include "Shared/ThreadInfo.h"
#include "Shared/misc.h"
#include "Shared/sqltypes.h"
#include "Shared/thread_count.h"
#include "StringDictionary/StringDictionary.h"
#include "StringOps/StringOps.h"
#include "Utils/Regexp.h"
#include "Utils/StringLike.h"
#include <tbb/parallel_for.h>
#include <tbb/task_arena.h>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <string_view>
#include <thread>
+ Include dependency graph for StringDictionaryProxy.cpp:

Go to the source code of this file.

Classes

class  StringLocalCallback
 
class  StringNetworkCallback
 

Namespaces

 anonymous_namespace{StringDictionaryProxy.cpp}
 

Functions

int32_t truncate_to_generation (const int32_t id, const size_t generation)
 
DEVICE RUNTIME_EXPORT const char * StringDictionaryProxy_getStringBytes (int8_t *proxy_ptr, int32_t string_id)
 
DEVICE RUNTIME_EXPORT size_t StringDictionaryProxy_getStringLength (int8_t *proxy_ptr, int32_t string_id)
 
DEVICE RUNTIME_EXPORT int32_t StringDictionaryProxy_getStringId (int8_t *proxy_ptr, char *c_str_ptr)
 
void order_translation_locks (const int32_t source_dict_id, const int32_t dest_dict_id, std::shared_lock< std::shared_mutex > &source_proxy_read_lock, std::unique_lock< std::shared_mutex > &dest_proxy_write_lock)
 
bool anonymous_namespace{StringDictionaryProxy.cpp}::is_like (const std::string &str, const std::string &pattern, const bool icase, const bool is_simple, const char escape)
 
bool anonymous_namespace{StringDictionaryProxy.cpp}::do_compare (const std::string &str, const std::string &pattern, const std::string &comp_operator)
 
bool anonymous_namespace{StringDictionaryProxy.cpp}::is_regexp_like (const std::string &str, const std::string &pattern, const char escape)
 

Function Documentation

void order_translation_locks ( const int32_t  source_dict_id,
const int32_t  dest_dict_id,
std::shared_lock< std::shared_mutex > &  source_proxy_read_lock,
std::unique_lock< std::shared_mutex > &  dest_proxy_write_lock 
)

Definition at line 358 of file StringDictionaryProxy.cpp.

361  {
362  if (source_dict_id == dest_dict_id) {
363  // proxies are same, only take one write lock
364  dest_proxy_write_lock.lock();
365  } else if (source_dict_id < dest_dict_id) {
366  source_proxy_read_lock.lock();
367  dest_proxy_write_lock.lock();
368  } else {
369  dest_proxy_write_lock.lock();
370  source_proxy_read_lock.lock();
371  }
372 }
DEVICE RUNTIME_EXPORT const char* StringDictionaryProxy_getStringBytes ( int8_t *  proxy_ptr,
int32_t  string_id 
)

Definition at line 138 of file StringDictionaryProxy.cpp.

References CHECK, and StringDictionaryProxy::getStringBytes().

140  {
141  CHECK(proxy_ptr != nullptr);
142  auto proxy = reinterpret_cast<StringDictionaryProxy*>(proxy_ptr);
143  auto [c_str, len] = proxy->getStringBytes(string_id);
144  return c_str;
145 }
std::pair< const char *, size_t > getStringBytes(int32_t string_id) const noexcept
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the call graph for this function:

DEVICE RUNTIME_EXPORT int32_t StringDictionaryProxy_getStringId ( int8_t *  proxy_ptr,
char *  c_str_ptr 
)

Definition at line 156 of file StringDictionaryProxy.cpp.

References CHECK.

156  {
157  CHECK(proxy_ptr != nullptr);
158  auto proxy = reinterpret_cast<StringDictionaryProxy*>(proxy_ptr);
159  std::string str(c_str_ptr);
160  return proxy->getOrAddTransient(str);
161 }
#define CHECK(condition)
Definition: Logger.h:222
DEVICE RUNTIME_EXPORT size_t StringDictionaryProxy_getStringLength ( int8_t *  proxy_ptr,
int32_t  string_id 
)

Definition at line 148 of file StringDictionaryProxy.cpp.

References CHECK, and StringDictionaryProxy::getStringBytes().

148  {
149  CHECK(proxy_ptr != nullptr);
150  auto proxy = reinterpret_cast<StringDictionaryProxy*>(proxy_ptr);
151  auto [c_str, len] = proxy->getStringBytes(string_id);
152  return len;
153 }
std::pair< const char *, size_t > getStringBytes(int32_t string_id) const noexcept
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the call graph for this function:

int32_t truncate_to_generation ( const int32_t  id,
const size_t  generation 
)

Definition at line 44 of file StringDictionaryProxy.cpp.

References CHECK_GE, and StringDictionary::INVALID_STR_ID.

Referenced by StringDictionaryProxy::getIdOfStringFromClient().

44  {
46  return id;
47  }
48  CHECK_GE(id, 0);
49  return static_cast<size_t>(id) >= generation ? StringDictionary::INVALID_STR_ID : id;
50 }
#define CHECK_GE(x, y)
Definition: Logger.h:235
static constexpr int32_t INVALID_STR_ID

+ Here is the caller graph for this function: