NCBI C++ ToolKit
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CNSTDatabase Class Reference

Search Toolkit Book for CNSTDatabase

#include "nst_database.hpp"
(Private to src/app/netstorage.)

+ Collaboration diagram for CNSTDatabase:

Public Member Functions

 CNSTDatabase (CNetStorageServer *server)
 
 ~CNSTDatabase (void)
 
void InitialConnect (void)
 
bool IsConnected (void) const
 
CJsonNode SetParameters (const IRegistry &reg)
 
int ExecSP_CreateClient (const string &client, Int8 &client_id)
 
int ExecSP_CreateUser (const CNSTUserID &user, Int8 &user_id)
 
int ExecSP_CreateObjectWithClientID (const string &object_key, const string &object_loc, Int8 size, Int8 client_id, Int8 user_id, const TNSTDBValue< CTimeSpan > ttl, bool &size_was_null)
 
int ExecSP_UpdateObjectOnWrite (const string &object_key, const string &object_loc, Int8 size, Int8 client_id, Int8 user_id, const TNSTDBValue< CTimeSpan > &ttl, const TNSTDBValue< CTimeSpan > &prolong_on_write, const TNSTDBValue< CTime > &object_expiration, bool &size_was_null)
 
int ExecSP_UpdateUserKeyObjectOnWrite (const string &object_key, const string &object_loc, Int8 size, Int8 client_id, const TNSTDBValue< CTimeSpan > &ttl, const TNSTDBValue< CTimeSpan > &prolong_on_write, const TNSTDBValue< CTime > &object_expiration)
 
int ExecSP_UpdateObjectOnRead (const string &object_key, const string &object_loc, Int8 size, Int8 client_id, const TNSTDBValue< CTimeSpan > &ttl, const TNSTDBValue< CTimeSpan > &prolong_on_read, const TNSTDBValue< CTime > &object_expiration, bool &size_was_null)
 
int ExecSP_UpdateObjectOnRelocate (const string &object_key, const string &object_loc, Int8 client_id, const TNSTDBValue< CTimeSpan > &ttl, const TNSTDBValue< CTimeSpan > &prolong_on_relocate, const TNSTDBValue< CTime > &object_expiration)
 
int UpdateExpirationIfExists (const string &object_key, const TNSTDBValue< CTimeSpan > &ttl, const TNSTDBValue< CTimeSpan > &prolong_on_read, const TNSTDBValue< CTime > &object_expiration)
 
int ExecSP_UpdateUserIDForObject (const string &object_key, Int8 user_id)
 
int ExecSP_RemoveObject (const string &object_key)
 
int ExecSP_SetExpiration (const string &object_key, const TNSTDBValue< CTimeSpan > &ttl, bool create_if_not_found, const string &object_loc, Int8 client_id, TNSTDBValue< Int8 > &object_size)
 
int ExecSP_AddAttribute (const string &object_key, const string &object_loc, const string &attr_name, const string &attr_value, Int8 client_id, bool create_if_not_found, const TNSTDBValue< CTimeSpan > &ttl)
 
int ExecSP_GetAttribute (const string &object_key, const string &attr_name, bool need_update, string &value)
 
int ExecSP_DelAttribute (const string &object_key, const string &attr_name)
 
int ExecSP_GetAttributeNames (const string &object_key, vector< string > &attr_names)
 
int ExecSP_GetObjectFixedAttributes (const string &object_key, TNSTDBValue< CTime > &expiration, TNSTDBValue< CTime > &creation, TNSTDBValue< CTime > &obj_read, TNSTDBValue< CTime > &obj_write, TNSTDBValue< CTime > &attr_read, TNSTDBValue< CTime > &attr_write, TNSTDBValue< Int8 > &read_count, TNSTDBValue< Int8 > &write_count, TNSTDBValue< string > &client_name, TNSTDBValue< string > &user_namespace, TNSTDBValue< string > &user_name, TNSTDBValue< Int8 > &obj_ttl)
 
int ExecSP_GetObjectExpiration (const string &object_key, TNSTDBValue< CTime > &expiration, TNSTDBValue< Int8 > &individual_object_ttl)
 
map< string, stringExecSP_GetGeneralDBInfo (void)
 
map< string, stringExecSP_GetStatDBInfo (void)
 
int ExecSP_GetClientObjects (const string &client_name, TNSTDBValue< Int8 > limit, Int8 &total, vector< string > &locators)
 
int ExecSP_GetUserObjects (const string &user_name, const string &user_name_space, TNSTDBValue< Int8 > limit, Int8 &total, vector< string > &locators)
 
int ExecSP_GetClients (vector< string > &names)
 
int ExecSP_GetUsers (vector< pair< string, string > > &users)
 
int ExecSP_DoesObjectExist (const string &object_key)
 
int ExecSP_GetObjectSizeAndLocator (const string &object_key, TNSTDBValue< Int8 > &object_size, TNSTDBValue< string > &object_locator)
 
int ExecSP_GetObjectSize (const string &object_key, TNSTDBValue< Int8 > &object_size)
 
int ExecSP_UpdateObjectSizeIfNULL (const string &object_key, TNSTDBValue< Int8 > &object_size)
 
CTimeout GetExecuteSPTimeout (void)
 

Private Member Functions

bool x_ReadDbAccessInfo (bool is_initialization)
 
void x_CreateDatabase (bool is_initialization)
 
void x_PreCheckConnection (void)
 
void x_PostCheckConnection (void)
 
int x_CheckStatus (CQuery &query, const string &procedure)
 
void x_CalculateExpiration (const CTime &current_time, const TNSTDBValue< CTimeSpan > &ttl, const TNSTDBValue< CTimeSpan > &prolong, const TNSTDBValue< CTime > &object_expiration, TNSTDBValue< CTime > &exp_record_found, TNSTDBValue< CTime > &exp_record_not_found)
 
 CNSTDatabase (const CNSTDatabase &conn)
 
CNSTDatabaseoperator= (const CNSTDatabase &conn)
 

Private Attributes

SDbAccessInfo m_DbAccessInfo
 
CNetStorageServerm_Server
 
CDatabasem_Db
 
CFastMutex m_DbLock
 
bool m_Connected
 
CRef< CNSTDBConnectionThreadm_RestoreConnectionThread
 
CFastMutex m_SPTimeoutMutex
 
CTimeout m_SPTimeout
 

Friends

class CNSTDBConnectionThread
 

Detailed Description

Definition at line 83 of file nst_database.hpp.

Constructor & Destructor Documentation

◆ CNSTDatabase() [1/2]

CNSTDatabase::CNSTDatabase ( CNetStorageServer server)

◆ ~CNSTDatabase()

CNSTDatabase::~CNSTDatabase ( void  )

◆ CNSTDatabase() [2/2]

CNSTDatabase::CNSTDatabase ( const CNSTDatabase conn)
private

Member Function Documentation

◆ ExecSP_AddAttribute()

int CNSTDatabase::ExecSP_AddAttribute ( const string object_key,
const string object_loc,
const string attr_name,
const string attr_value,
Int8  client_id,
bool  create_if_not_found,
const TNSTDBValue< CTimeSpan > &  ttl 
)

◆ ExecSP_CreateClient()

int CNSTDatabase::ExecSP_CreateClient ( const string client,
Int8 client_id 
)

◆ ExecSP_CreateObjectWithClientID()

int CNSTDatabase::ExecSP_CreateObjectWithClientID ( const string object_key,
const string object_loc,
Int8  size,
Int8  client_id,
Int8  user_id,
const TNSTDBValue< CTimeSpan ttl,
bool size_was_null 
)

◆ ExecSP_CreateUser()

int CNSTDatabase::ExecSP_CreateUser ( const CNSTUserID user,
Int8 user_id 
)

◆ ExecSP_DelAttribute()

int CNSTDatabase::ExecSP_DelAttribute ( const string object_key,
const string attr_name 
)

◆ ExecSP_DoesObjectExist()

int CNSTDatabase::ExecSP_DoesObjectExist ( const string object_key)

◆ ExecSP_GetAttribute()

int CNSTDatabase::ExecSP_GetAttribute ( const string object_key,
const string attr_name,
bool  need_update,
string value 
)

◆ ExecSP_GetAttributeNames()

int CNSTDatabase::ExecSP_GetAttributeNames ( const string object_key,
vector< string > &  attr_names 
)

◆ ExecSP_GetClientObjects()

int CNSTDatabase::ExecSP_GetClientObjects ( const string client_name,
TNSTDBValue< Int8 limit,
Int8 total,
vector< string > &  locators 
)

◆ ExecSP_GetClients()

int CNSTDatabase::ExecSP_GetClients ( vector< string > &  names)

◆ ExecSP_GetGeneralDBInfo()

map< string, string > CNSTDatabase::ExecSP_GetGeneralDBInfo ( void  )

◆ ExecSP_GetObjectExpiration()

int CNSTDatabase::ExecSP_GetObjectExpiration ( const string object_key,
TNSTDBValue< CTime > &  expiration,
TNSTDBValue< Int8 > &  individual_object_ttl 
)

◆ ExecSP_GetObjectFixedAttributes()

int CNSTDatabase::ExecSP_GetObjectFixedAttributes ( const string object_key,
TNSTDBValue< CTime > &  expiration,
TNSTDBValue< CTime > &  creation,
TNSTDBValue< CTime > &  obj_read,
TNSTDBValue< CTime > &  obj_write,
TNSTDBValue< CTime > &  attr_read,
TNSTDBValue< CTime > &  attr_write,
TNSTDBValue< Int8 > &  read_count,
TNSTDBValue< Int8 > &  write_count,
TNSTDBValue< string > &  client_name,
TNSTDBValue< string > &  user_namespace,
TNSTDBValue< string > &  user_name,
TNSTDBValue< Int8 > &  obj_ttl 
)

◆ ExecSP_GetObjectSize()

int CNSTDatabase::ExecSP_GetObjectSize ( const string object_key,
TNSTDBValue< Int8 > &  object_size 
)

◆ ExecSP_GetObjectSizeAndLocator()

int CNSTDatabase::ExecSP_GetObjectSizeAndLocator ( const string object_key,
TNSTDBValue< Int8 > &  object_size,
TNSTDBValue< string > &  object_locator 
)

◆ ExecSP_GetStatDBInfo()

map< string, string > CNSTDatabase::ExecSP_GetStatDBInfo ( void  )

◆ ExecSP_GetUserObjects()

int CNSTDatabase::ExecSP_GetUserObjects ( const string user_name,
const string user_name_space,
TNSTDBValue< Int8 limit,
Int8 total,
vector< string > &  locators 
)

◆ ExecSP_GetUsers()

int CNSTDatabase::ExecSP_GetUsers ( vector< pair< string, string > > &  users)

◆ ExecSP_RemoveObject()

int CNSTDatabase::ExecSP_RemoveObject ( const string object_key)

◆ ExecSP_SetExpiration()

int CNSTDatabase::ExecSP_SetExpiration ( const string object_key,
const TNSTDBValue< CTimeSpan > &  ttl,
bool  create_if_not_found,
const string object_loc,
Int8  client_id,
TNSTDBValue< Int8 > &  object_size 
)

◆ ExecSP_UpdateObjectOnRead()

int CNSTDatabase::ExecSP_UpdateObjectOnRead ( const string object_key,
const string object_loc,
Int8  size,
Int8  client_id,
const TNSTDBValue< CTimeSpan > &  ttl,
const TNSTDBValue< CTimeSpan > &  prolong_on_read,
const TNSTDBValue< CTime > &  object_expiration,
bool size_was_null 
)

◆ ExecSP_UpdateObjectOnRelocate()

int CNSTDatabase::ExecSP_UpdateObjectOnRelocate ( const string object_key,
const string object_loc,
Int8  client_id,
const TNSTDBValue< CTimeSpan > &  ttl,
const TNSTDBValue< CTimeSpan > &  prolong_on_relocate,
const TNSTDBValue< CTime > &  object_expiration 
)

◆ ExecSP_UpdateObjectOnWrite()

int CNSTDatabase::ExecSP_UpdateObjectOnWrite ( const string object_key,
const string object_loc,
Int8  size,
Int8  client_id,
Int8  user_id,
const TNSTDBValue< CTimeSpan > &  ttl,
const TNSTDBValue< CTimeSpan > &  prolong_on_write,
const TNSTDBValue< CTime > &  object_expiration,
bool size_was_null 
)

◆ ExecSP_UpdateObjectSizeIfNULL()

int CNSTDatabase::ExecSP_UpdateObjectSizeIfNULL ( const string object_key,
TNSTDBValue< Int8 > &  object_size 
)

◆ ExecSP_UpdateUserIDForObject()

int CNSTDatabase::ExecSP_UpdateUserIDForObject ( const string object_key,
Int8  user_id 
)

◆ ExecSP_UpdateUserKeyObjectOnWrite()

int CNSTDatabase::ExecSP_UpdateUserKeyObjectOnWrite ( const string object_key,
const string object_loc,
Int8  size,
Int8  client_id,
const TNSTDBValue< CTimeSpan > &  ttl,
const TNSTDBValue< CTimeSpan > &  prolong_on_write,
const TNSTDBValue< CTime > &  object_expiration 
)

◆ GetExecuteSPTimeout()

CTimeout CNSTDatabase::GetExecuteSPTimeout ( void  )

◆ InitialConnect()

void CNSTDatabase::InitialConnect ( void  )

◆ IsConnected()

bool CNSTDatabase::IsConnected ( void  ) const
inline

Definition at line 90 of file nst_database.hpp.

References m_Connected.

Referenced by CNetStorageHandler::x_ProcessHealth().

◆ operator=()

CNSTDatabase& CNSTDatabase::operator= ( const CNSTDatabase conn)
private

◆ SetParameters()

CJsonNode CNSTDatabase::SetParameters ( const IRegistry reg)

◆ UpdateExpirationIfExists()

int CNSTDatabase::UpdateExpirationIfExists ( const string object_key,
const TNSTDBValue< CTimeSpan > &  ttl,
const TNSTDBValue< CTimeSpan > &  prolong_on_read,
const TNSTDBValue< CTime > &  object_expiration 
)

◆ x_CalculateExpiration()

void CNSTDatabase::x_CalculateExpiration ( const CTime current_time,
const TNSTDBValue< CTimeSpan > &  ttl,
const TNSTDBValue< CTimeSpan > &  prolong,
const TNSTDBValue< CTime > &  object_expiration,
TNSTDBValue< CTime > &  exp_record_found,
TNSTDBValue< CTime > &  exp_record_not_found 
)
private

◆ x_CheckStatus()

int CNSTDatabase::x_CheckStatus ( CQuery query,
const string procedure 
)
private

◆ x_CreateDatabase()

void CNSTDatabase::x_CreateDatabase ( bool  is_initialization)
private

◆ x_PostCheckConnection()

void CNSTDatabase::x_PostCheckConnection ( void  )
private

◆ x_PreCheckConnection()

void CNSTDatabase::x_PreCheckConnection ( void  )
private

◆ x_ReadDbAccessInfo()

bool CNSTDatabase::x_ReadDbAccessInfo ( bool  is_initialization)
private

Friends And Related Function Documentation

◆ CNSTDBConnectionThread

friend class CNSTDBConnectionThread
friend

Definition at line 229 of file nst_database.hpp.

Referenced by CNSTDatabase().

Member Data Documentation

◆ m_Connected

bool CNSTDatabase::m_Connected
private

◆ m_Db

CDatabase* CNSTDatabase::m_Db
private

◆ m_DbAccessInfo

SDbAccessInfo CNSTDatabase::m_DbAccessInfo
private

Definition at line 216 of file nst_database.hpp.

Referenced by x_CreateDatabase(), and x_ReadDbAccessInfo().

◆ m_DbLock

CFastMutex CNSTDatabase::m_DbLock
private

Definition at line 219 of file nst_database.hpp.

Referenced by CNSTDatabase(), x_PostCheckConnection(), and x_PreCheckConnection().

◆ m_RestoreConnectionThread

CRef<CNSTDBConnectionThread> CNSTDatabase::m_RestoreConnectionThread
private

◆ m_Server

CNetStorageServer* CNSTDatabase::m_Server
private

◆ m_SPTimeout

CTimeout CNSTDatabase::m_SPTimeout
private

Definition at line 224 of file nst_database.hpp.

Referenced by GetExecuteSPTimeout(), SetParameters(), and x_ReadDbAccessInfo().

◆ m_SPTimeoutMutex

CFastMutex CNSTDatabase::m_SPTimeoutMutex
private

Definition at line 223 of file nst_database.hpp.

Referenced by GetExecuteSPTimeout(), and SetParameters().


The documentation for this class was generated from the following files:
Modified on Mon Apr 22 04:05:55 2024 by modify_doxy.py rev. 669887