NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
netcached.cpp File Reference
#include "nc_pch.hpp"
#include <corelib/ncbireg.hpp>
#include <corelib/ncbi_process.hpp>
#include <corelib/ncbifile.hpp>
#include <corelib/ncbistr.hpp>
#include <db/sqlite/sqlitewrapp.hpp>
#include "task_server.hpp"
#include "netcached.hpp"
#include "message_handler.hpp"
#include "netcache_version.hpp"
#include "nc_stat.hpp"
#include "distribution_conf.hpp"
#include "sync_log.hpp"
#include "peer_control.hpp"
#include "nc_storage.hpp"
#include "active_handler.hpp"
#include "periodic_sync.hpp"
#include "nc_storage_blob.hpp"
#include "logging.hpp"
#include "server_core.hpp"
+ Include dependency graph for netcached.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SSpecParamsEntry
 
struct  SSpecParamsSet
 

Macros

#define MAKE_TEST_BUILD   0
 

Typedefs

typedef set< unsigned intTPortsList
 
typedef vector< stringTSpecKeysList
 

Functions

static void s_StoreStartupParams (int argc, const char *argv[])
 
static int s_CompareStrings (const string &left, const string &right)
 
static void s_ReadSpecificParams (const IRegistry &reg, const string &section, SNCSpecificParams *params, vector< string > &keys)
 
static void s_PutNewParams (SSpecParamsSet *params_set, unsigned int best_index, const SSpecParamsEntry &entry)
 
static SSpecParamsSets_FindNextParamsSet (const SSpecParamsSet *cur_set, const string &key, unsigned int &best_index)
 
static void s_CheckDefClientConfig (SSpecParamsSet *cur_set, SSpecParamsSet *prev_set, Uint1 depth, SSpecParamsSet *deflt)
 
static void s_ReadPerClientConfig (const CNcbiRegistry &reg)
 
static bool s_ReadServerParams (void)
 
static bool s_Initialize (bool do_reinit)
 
static void s_Finalize (void)
 
static void s_CollectClientConfigKeys (SSpecParamsSet *cur_set, SSpecParamsSet *prev_set, Uint1 depth, SSpecParamsSet *deflt, vector< string > &keys)
 
bool s_ReportPid (const string &pid_file)
 
int main (int argc, const char *argv[])
 

Variables

static const char * kNCReg_ServerSection = "netcache"
 
static const char * kNCReg_Ports = "ports"
 
static const char * kNCReg_CtrlPort = "control_port"
 
static const char * kNCReg_AdminClient = "admin_client_name"
 
static const char * kNCReg_DefAdminClient = "netcache_control"
 
static const char * kNCReg_SpecPriority = "app_setup_priority"
 
static const char * kNCReg_DefSpecPriority = "cache,port"
 
static const char * kNCReg_DisableClient = "disable_client"
 
static const char * kNCReg_LifespanTTL = "lifespan_ttl"
 
static const char * kNCReg_MaxTTL = "max_ttl"
 
static const char * kNCReg_BlobTTL = "blob_ttl"
 
static const char * kNCReg_VerTTL = "ver_ttl"
 
static const char * kNCReg_TTLUnit = "ttl_unit"
 
static const char * kNCReg_ProlongOnRead = "prolong_on_read"
 
static const char * kNCReg_SearchOnRead = "search_on_read"
 
static const char * kNCReg_Quorum = "quorum"
 
static const char * kNCReg_FastOnMain = "fast_quorum_on_main"
 
static const char * kNCReg_PassPolicy = "blob_password_policy"
 
static const char * kNCReg_AppSetupPrefix = "app_setup_"
 
static const char * kNCReg_AppSetupValue = "setup"
 
static TPortsList s_Ports
 Port where server runs. More...
 
static Uint4 s_CtrlPort
 
static string s_AdminClient
 Name of client that should be used for administrative commands. More...
 
static TSpecKeysList s_SpecPriority
 
static CSrvRef< SSpecParamsSets_SpecParams
 
static int s_DefBlobTTL
 
static bool s_DebugMode = false
 
static bool s_InitiallySynced = false
 
static bool s_CachingComplete = false
 
static CNCMsgHandler_Factory s_MsgHandlerFactory
 
static CNCHeartBeats_HeartBeat
 
static string s_PidFile
 
static string s_HostRole
 
static string s_HostLocation
 
static string s_AppPath
 
static string s_CmdLineArgs
 
 USING_NCBI_SCOPE
 

Macro Definition Documentation

◆ MAKE_TEST_BUILD

#define MAKE_TEST_BUILD   0

Definition at line 62 of file netcached.cpp.

Typedef Documentation

◆ TPortsList

typedef set<unsigned int> TPortsList

Definition at line 97 of file netcached.cpp.

◆ TSpecKeysList

typedef vector<string> TSpecKeysList

Definition at line 98 of file netcached.cpp.

Function Documentation

◆ main()

int main ( int  argc,
const char *  argv[] 
)

◆ s_CheckDefClientConfig()

static void s_CheckDefClientConfig ( SSpecParamsSet cur_set,
SSpecParamsSet prev_set,
Uint1  depth,
SSpecParamsSet deflt 
)
static

Definition at line 454 of file netcached.cpp.

References depth, SSpecParamsSet::entries, i, and NULL.

◆ s_CollectClientConfigKeys()

static void s_CollectClientConfigKeys ( SSpecParamsSet cur_set,
SSpecParamsSet prev_set,
Uint1  depth,
SSpecParamsSet deflt,
vector< string > &  keys 
)
static

Definition at line 754 of file netcached.cpp.

References depth, SSpecParamsSet::entries, i, and NULL.

Referenced by CNCServer::WriteAppSetup().

◆ s_CompareStrings()

static int s_CompareStrings ( const string left,
const string right 
)
inlinestatic

Definition at line 317 of file netcached.cpp.

References int.

Referenced by s_FindNextParamsSet().

◆ s_Finalize()

static void s_Finalize ( void  )
static

◆ s_FindNextParamsSet()

static SSpecParamsSet* s_FindNextParamsSet ( const SSpecParamsSet cur_set,
const string key,
unsigned int best_index 
)
static

◆ s_Initialize()

static bool s_Initialize ( bool  do_reinit)
static

◆ s_PutNewParams()

static void s_PutNewParams ( SSpecParamsSet params_set,
unsigned int  best_index,
const SSpecParamsEntry entry 
)
inlinestatic

Definition at line 422 of file netcached.cpp.

References SSpecParamsSet::entries.

Referenced by s_ReadPerClientConfig().

◆ s_ReadPerClientConfig()

static void s_ReadPerClientConfig ( const CNcbiRegistry reg)
static

◆ s_ReadServerParams()

static bool s_ReadServerParams ( void  )
static

◆ s_ReadSpecificParams()

static void s_ReadSpecificParams ( const IRegistry reg,
const string section,
SNCSpecificParams params,
vector< string > &  keys 
)
static

◆ s_ReportPid()

bool s_ReportPid ( const string pid_file)

Definition at line 1018 of file netcached.cpp.

References CCurrentProcess::GetPid(), out(), s_PidFile, and trunc.

Referenced by main().

◆ s_StoreStartupParams()

static void s_StoreStartupParams ( int  argc,
const char *  argv[] 
)
static

Variable Documentation

◆ kNCReg_AdminClient

const char* kNCReg_AdminClient = "admin_client_name"
static

Definition at line 76 of file netcached.cpp.

Referenced by s_ReadServerParams().

◆ kNCReg_AppSetupPrefix

const char* kNCReg_AppSetupPrefix = "app_setup_"
static

Definition at line 93 of file netcached.cpp.

Referenced by s_ReadPerClientConfig().

◆ kNCReg_AppSetupValue

const char* kNCReg_AppSetupValue = "setup"
static

Definition at line 94 of file netcached.cpp.

Referenced by s_ReadPerClientConfig().

◆ kNCReg_BlobTTL

const char* kNCReg_BlobTTL = "blob_ttl"
static

Definition at line 85 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_CtrlPort

const char* kNCReg_CtrlPort = "control_port"
static

Definition at line 75 of file netcached.cpp.

Referenced by s_ReadServerParams().

◆ kNCReg_DefAdminClient

const char* kNCReg_DefAdminClient = "netcache_control"
static

Definition at line 77 of file netcached.cpp.

Referenced by s_ReadServerParams().

◆ kNCReg_DefSpecPriority

const char* kNCReg_DefSpecPriority = "cache,port"
static

Definition at line 79 of file netcached.cpp.

Referenced by s_ReadPerClientConfig().

◆ kNCReg_DisableClient

const char* kNCReg_DisableClient = "disable_client"
static

Definition at line 81 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_FastOnMain

const char* kNCReg_FastOnMain = "fast_quorum_on_main"
static

Definition at line 91 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_LifespanTTL

const char* kNCReg_LifespanTTL = "lifespan_ttl"
static

Definition at line 83 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_MaxTTL

const char* kNCReg_MaxTTL = "max_ttl"
static

Definition at line 84 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_PassPolicy

const char* kNCReg_PassPolicy = "blob_password_policy"
static

Definition at line 92 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_Ports

const char* kNCReg_Ports = "ports"
static

Definition at line 74 of file netcached.cpp.

Referenced by s_ReadServerParams().

◆ kNCReg_ProlongOnRead

const char* kNCReg_ProlongOnRead = "prolong_on_read"
static

Definition at line 88 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_Quorum

const char* kNCReg_Quorum = "quorum"
static

Definition at line 90 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_SearchOnRead

const char* kNCReg_SearchOnRead = "search_on_read"
static

Definition at line 89 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_ServerSection

const char* kNCReg_ServerSection = "netcache"
static

Definition at line 73 of file netcached.cpp.

Referenced by s_ReadPerClientConfig(), and s_ReadServerParams().

◆ kNCReg_SpecPriority

const char* kNCReg_SpecPriority = "app_setup_priority"
static

Definition at line 78 of file netcached.cpp.

Referenced by s_ReadPerClientConfig(), and CNCServer::WriteAppSetup().

◆ kNCReg_TTLUnit

const char* kNCReg_TTLUnit = "ttl_unit"
static

Definition at line 87 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ kNCReg_VerTTL

const char* kNCReg_VerTTL = "ver_ttl"
static

Definition at line 86 of file netcached.cpp.

Referenced by s_ReadSpecificParams(), and CNCServer::WriteAppSetup().

◆ s_AdminClient

string s_AdminClient
static

Name of client that should be used for administrative commands.

Definition at line 116 of file netcached.cpp.

Referenced by CNCServer::GetAdminClient(), and s_ReadServerParams().

◆ s_AppPath

string s_AppPath
static

Definition at line 129 of file netcached.cpp.

Referenced by s_StoreStartupParams(), and CNCServer::WriteEnvInfo().

◆ s_CachingComplete

bool s_CachingComplete = false
static

Definition at line 123 of file netcached.cpp.

Referenced by CNCServer::CachingCompleted(), and CNCServer::IsCachingComplete().

◆ s_CmdLineArgs

string s_CmdLineArgs
static

Definition at line 130 of file netcached.cpp.

Referenced by s_StoreStartupParams(), and CNCServer::WriteEnvInfo().

◆ s_CtrlPort

Uint4 s_CtrlPort
static

Definition at line 114 of file netcached.cpp.

Referenced by s_Initialize(), s_ReadServerParams(), and CNCServer::WriteAppSetup().

◆ s_DebugMode

bool s_DebugMode = false
static

Definition at line 121 of file netcached.cpp.

Referenced by CNCServer::IsDebugMode(), s_Initialize(), and s_ReadServerParams().

◆ s_DefBlobTTL

int s_DefBlobTTL
static

Definition at line 120 of file netcached.cpp.

Referenced by CNCServer::GetDefBlobTTL(), and s_ReadPerClientConfig().

◆ s_HeartBeat

CNCHeartBeat* s_HeartBeat
static

Definition at line 125 of file netcached.cpp.

Referenced by CNCServer::CachingCompleted(), and s_Initialize().

◆ s_HostLocation

string s_HostLocation
static

Definition at line 128 of file netcached.cpp.

Referenced by CNCServer::GetHostLocation().

◆ s_HostRole

string s_HostRole
static

Definition at line 127 of file netcached.cpp.

Referenced by CNCServer::GetHostRole().

◆ s_InitiallySynced

bool s_InitiallySynced = false
static

◆ s_MsgHandlerFactory

CNCMsgHandler_Factory s_MsgHandlerFactory
static

Definition at line 124 of file netcached.cpp.

Referenced by s_Initialize().

◆ s_PidFile

string s_PidFile
static

Definition at line 126 of file netcached.cpp.

Referenced by s_ReportPid(), and CNCServer::WriteEnvInfo().

◆ s_Ports

TPortsList s_Ports
static

Port where server runs.

Definition at line 113 of file netcached.cpp.

Referenced by s_Initialize(), s_ReadServerParams(), and CNCServer::WriteAppSetup().

◆ s_SpecParams

CSrvRef<SSpecParamsSet> s_SpecParams
static

◆ s_SpecPriority

TSpecKeysList s_SpecPriority
static

◆ USING_NCBI_SCOPE

USING_NCBI_SCOPE

Definition at line 1033 of file netcached.cpp.

Modified on Sun Mar 03 03:13:50 2024 by modify_doxy.py rev. 669887