full_version->AddComponentVersion(
"Protocol",
115arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
116 "Network Storage middleman server");
121 "File to save NetStorage process PID",
124 "Turn off daemonization of NetStorage at the start.");
141.
Print(
"_type",
"startup")
142.
Print(
"info",
"versions")
154vector<string> config_warnings;
165 stringdecrypt_warning;
166params.
Read(reg,
"server", decrypt_warning);
174server->UpdateBackendConfiguration(
GetConfig(), config_warnings);
177server->SetCustomThreadSuffix(
"_h");
178server->SetParameters(params,
false);
179server->ReadMetadataConfiguration(reg);
180server->SetAnybodyCanReconfigure(!decrypt_warning.empty());
184server->StartListening();
188.
Print(
"_type",
"startup")
189.
Print(
"info",
"entering UNIX daemon mode");
201 "Error during daemonization.");
205.
Print(
"_type",
"startup")
206.
Print(
"info",
"operating in non-daemon mode");
211 if(!config_warnings.empty()) {
213 for(vector<string>::const_iterator k = config_warnings.begin();
214k != config_warnings.end(); ++k) {
222 if(!decrypt_warning.empty()) {
228vector<string> config_checksum_warnings;
231 if(config_checksum_warnings.empty()) {
232server->SetRAMConfigFileChecksum(config_checksum);
233server->SetDiskConfigFileChecksum(config_checksum);
235 for(vector<string>::const_iterator
236k = config_checksum_warnings.begin();
237k != config_checksum_warnings.end(); ++k)
248server->GetDb().InitialConnect();
250server->CheckStartAfterCrash();
253server->RunServiceThread();
279}
catch(
constexception & ex) {
287server->StopServiceThread();
289 stringremove_crash_flag_file_error = server->RemoveCrashFlagFile();
290 if(!remove_crash_flag_file_error.empty())
291 ERR_POST(remove_crash_flag_file_error);
302 const char*
const* argv)
304 for(
intindex = 0; index < argc; ++index) {
324 if(pid_file ==
"-") {
325 string msg=
"pid file cannot be standard output and only " 326 "file name is accepted";
333 if(access(pid_file.c_str(), F_OK) == 0) {
335 if(access(pid_file.c_str(), W_OK) != 0) {
336 string msg=
"pid file is not writable";
345FILE *
f= fopen(pid_file.c_str(),
"w");
347 string msg=
"error opening pid file for writing";
360 int main(
intargc,
const char* argv[])
void Init(void)
Initialize the application.
STimeout m_ServerAcceptTimeout
void x_WritePid(CNetStorageServer *server) const
EPreparseArgs PreparseArgs(int argc, const char *const *argv)
Check the command line arguments before parsing them.
int Run(void)
Run the application.
void RegisterAlert(EAlertType alert_type, const string &messge)
static CNetStorageServer * GetInstance(void)
virtual bool ShutdownRequested(void)
Runs synchronously between iterations.
void SetShutdownFlag(int signum=0)
The NCBI C++ standard methods for dealing with std::string.
virtual EPreparseArgs PreparseArgs(int argc, const char *const *argv)
Check the command line arguments before parsing them.
void SetFullVersion(CRef< CVersionAPI > version)
Set version data for the program.
CNcbiEnvironment & SetEnvironment(void)
Get a non-const copy of the application's cached environment.
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
EPreparseArgs
Result of PreparseArgs()
const string & GetConfigPath(void) const
Get the full path to the configuration file (if any) we ended up using.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
void SetVersion(const CVersionInfo &version)
Set the version number for the program.
@ fNoUsage
Do not print USAGE on argument error.
@ fDupErrToCerr
Print arg error to both log and cerr.
@ eOutputFile
Name of file (must be writable)
CDiagContext_Extra & Print(const string &name, const string &value)
The method does not print the argument, but adds it to the string.
CDiagContext & GetDiagContext(void)
Get diag context instance.
CDiagContext_Extra Extra(void) const
Create a temporary CDiagContext_Extra object.
static CRequestContext & GetRequestContext(void)
Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()
static TPID GetPID(void)
Get cached PID (read real PID if not cached yet).
void SetAutoIncRequestIDOnPost(bool enable)
Auto-increment request ID with every posted message.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
static void SetDefaultAutoIncRequestIDOnPost(bool enable)
Set default auto-increment flag used for each default request context.
static void SetOldPostFormat(bool value)
Set old/new format flag.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void g_Diag_Use_RWLock(bool enable=true)
Use RW-lock for synchronization rather than mutex.
@ eDS_ToStdlog
Try standard log file (app.name + ".log") in /log/ and current directory, use stderr if both fail.
void Critical(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
static TPid Daemonize(const char *logfile=0, TDaemonFlags flags=0)
Go daemon.
@ fDF_KeepCWD
Don't change CWD to "/".
@ fDF_KeepStdout
Keep stdout open as "/dev/null" (WO)
@ fDF_KeepStdin
Keep stdin open as "/dev/null" (RO)
EIO_Status SOCK_InitializeAPI(void)
Initialize all internal/system data & resources to be used by the SOCK API.
ESOCK_IOWaitSysAPI SOCK_SetIOWaitSysAPI(ESOCK_IOWaitSysAPI api)
This is a helper call that can improve I/O performance (ignored for MSVC).
@ eSOCK_IOWaitSysAPIPoll
always use poll()
const char *const kEmptyCStr
Empty "C" string (points to a '\0').
const STimeout * accept_timeout
Maximum t between exit checks.
unsigned int usec
microseconds (modulo 1,000,000)
const string version
version string
#define NCBI_PACKAGE_VERSION_PATCH
#define NCBI_PACKAGE_VERSION_MINOR
#define NCBI_PACKAGE_VERSION_MAJOR
Defines process management classes.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines NCBI C++ diagnostic APIs, classes, and macros.
Defines unified interface to application:
Miscellaneous common-use basic types and functionality.
Process information in the NCBI Registry, including working with configuration files.
static const string kNodaemonArgName
int main(int argc, const char *argv[])
void Threaded_Server_SignalHandler(int signum)
static const string kPidFileArgName
void NSTValidateConfigFile(const IRegistry ®, vector< string > &warnings, bool throw_port_exception)
string NST_GetConfigFileChecksum(const string &file_name, vector< string > &warnings)
#define NETSTORAGED_PROTOCOL_VERSION_MINOR
#define NETSTORAGED_BUILD_DATE
#define NETSTORAGED_PROTOCOL_VERSION_PATCH
#define NETSTORAGED_PROTOCOL_VERSION_MAJOR
#define NETSTORAGED_VERSION
#define NETSTORAGED_PROTOCOL_VERSION
Defines CRequestContext class for NCBI C++ diagnostic API.
Framework to create multithreaded network servers with thread-per-request scheduling.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void Read(const IRegistry ®, const string &sname, string &decrypt_warning)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4