OmniSciDB  72c90bc290
 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 shared::StringDictKey &source_dict_key, const shared::StringDictKey &dest_dict_key, 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 shared::StringDictKey source_dict_key,
const shared::StringDictKey dest_dict_key,
std::shared_lock< std::shared_mutex > &  source_proxy_read_lock,
std::unique_lock< std::shared_mutex > &  dest_proxy_write_lock 
)

Definition at line 365 of file StringDictionaryProxy.cpp.

368  {
369  if (source_dict_key == dest_dict_key) {
370  // proxies are same, only take one write lock
371  dest_proxy_write_lock.lock();
372  } else if (source_dict_key < dest_dict_key) {
373  source_proxy_read_lock.lock();
374  dest_proxy_write_lock.lock();
375  } else {
376  dest_proxy_write_lock.lock();
377  source_proxy_read_lock.lock();
378  }
379 }
DEVICE RUNTIME_EXPORT const char* StringDictionaryProxy_getStringBytes ( int8_t *  proxy_ptr,
int32_t  string_id 
)

Definition at line 147 of file StringDictionaryProxy.cpp.

References CHECK, and StringDictionaryProxy::getStringBytes().

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

+ 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 165 of file StringDictionaryProxy.cpp.

References CHECK.

165  {
166  CHECK(proxy_ptr != nullptr);
167  auto proxy = reinterpret_cast<StringDictionaryProxy*>(proxy_ptr);
168  std::string str(c_str_ptr);
169  return proxy->getOrAddTransient(str);
170 }
#define CHECK(condition)
Definition: Logger.h:291
DEVICE RUNTIME_EXPORT size_t StringDictionaryProxy_getStringLength ( int8_t *  proxy_ptr,
int32_t  string_id 
)

Definition at line 157 of file StringDictionaryProxy.cpp.

References CHECK, and StringDictionaryProxy::getStringBytes().

157  {
158  CHECK(proxy_ptr != nullptr);
159  auto proxy = reinterpret_cast<StringDictionaryProxy*>(proxy_ptr);
160  auto [c_str, len] = proxy->getStringBytes(string_id);
161  return len;
162 }
std::pair< const char *, size_t > getStringBytes(int32_t string_id) const noexcept
#define CHECK(condition)
Definition: Logger.h:291

+ 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:306
static constexpr int32_t INVALID_STR_ID

+ Here is the caller graph for this function: