m_DeleteCount(0), m_TotalCount(0), m_RemoteErrors(0)
58full_version->AddComponentVersion(
59 "Expected NetStorage DB structure (lowest)",
62full_version->AddComponentVersion(
63 "Expected NetStorage DB structure (highest)",
76arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
77 "Garbage collector for NetStorage database " 78 "and backend storages");
79arg_desc->AddFlag(
"verbose",
"Be verbose (messages on stdout)");
80arg_desc->AddFlag(
"dry",
"Dry run, no real cleanup is done");
81arg_desc->AddDefaultKey(
"t",
"timeout",
82 "DB operations timeout in seconds",
93.
Print(
"_type",
"startup")
94.
Print(
"info",
"versions")
104 bool verbose= args[
"verbose"];
105 booldryrun = args[
"dry"];
106 inttimeout = args[
"t"].AsInteger();
109 ERR_POST(
"DB timeout expected to be > 0. Received: "<< timeout <<
111 " seconds instead.");
121 stringmessage(
"NetStorage meta info database " 122 "structure version mismatch. ");
125message +=
"Expected: "+
130message +=
"Expected range: "+
138cerr << message << endl;
152 if(!candidates.empty()) {
191 stringservice_name = reg.
GetString(
"netstorage_server",
193 if(service_name.empty()) {
194 stringmessage =
"[netstorage_server]/service is not specified";
195cerr << message << endl;
199 CNetStoragenst(
"nst="+ service_name +
"&client_name=netstorage_gc");
200 for(vector<string>::const_iterator k = locators.begin();
201k != locators.end(); ++k) {
204cout <<
"Checking expiration via NetStorage server for "<< *k << endl;
207 string msg=
"Expected expired object; " 208 "NetStorage reports it is not";
209cerr <<
msg<<
": "<< *k << endl;
214cerr <<
"Exception while checking expiration for object " 231 for(vector<string>::const_iterator k = locators.begin();
232k != locators.end(); ++k) {
241cout <<
"Removing backend storage object "<< *k << endl;
244 ctx->SetRequestID();
246 ctx->SetHitID(hit_id);
248.Print(
"action",
"backend_remove")
249.Print(
"locator", *k);
254 ctx->SetRequestStatus(200);
263 ctx->SetRequestStatus(500);
268cerr <<
"Exception while removing backend object " 270}
catch(
conststd::exception & ex ) {
273 ctx->SetRequestStatus(500);
278cerr <<
"std::exception while removing backend object " 283 ctx->SetRequestStatus(500);
288cerr <<
"Unknown exception while removing backend object " 293 if(
error==
false) {
305.
Print(
"_type",
"finish")
317 int main(
intargc,
const char* argv[])
void x_RemoveObjects(const vector< string > &locators, bool verbose, CNetStorageGCDatabase &db, bool dryrun)
void x_CheckExpiration(const vector< string > &locators, bool verbose)
virtual void Init(void)
Initialize the application.
virtual int Run(void)
Run the application.
void x_PrintFinishCounters(bool verbose)
void RemoveObject(const string &locator, bool dryrun, const string &hit_id)
void ReleaseAppLock(void)
vector< string > GetGCCandidates(void)
int GetDBStructureVersion(void)
Network BLOB storage API.
void SetFullVersion(CRef< CVersionAPI > version)
Set version data for the program.
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.
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.
@ eInteger
Convertible into an integer number (int or Int8)
void PrintRequestStop(void)
Print request stop message (for request-driven applications)
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.
static void SetRequestContext(CRequestContext *ctx)
Shortcut to CDiagContextThreadData::GetThreadData().SetRequestContext()
void PrintRequestStart(const string &message)
Print request start message (for request-driven applications)
CDiagContext_Extra Extra(void) const
Create a temporary CDiagContext_Extra object.
static CRequestContext & GetRequestContext(void)
Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()
void SetHitID(const string &hit)
Set explicit hit id. The id is reset on request end.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
static void SetOldPostFormat(bool value)
Set old/new format flag.
@ eDS_ToStdlog
Try standard log file (app.name + ".log") in /log/ and current directory, use stderr if both fail.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
bool Exists(const string &object_loc)
Check if the object addressed by 'object_loc' exists.
ENetStorageRemoveResult Remove(const string &object_loc)
Remove the object addressed by 'object_loc'.
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
const string version
version string
#define NCBI_PACKAGE_VERSION_PATCH
#define NCBI_PACKAGE_VERSION_MINOR
#define NCBI_PACKAGE_VERSION_MAJOR
#define NCBI_CLANG_ANALYZER_SUPPRESS
Suppress clang analyzer report.
Defines NCBI C++ diagnostic APIs, classes, and macros.
int main(int argc, const char *argv[])
const unsigned int kDefaultDBTimeout
const string k_UnknownException
#define NETSTORAGE_GC_BUILD_DATE
#define NETSTORAGE_GC_EXPECTED_DB_STRUCTURE_HIGH
#define NETSTORAGE_GC_VERSION
#define NETSTORAGE_GC_EXPECTED_DB_STRUCTURE_LOW
Defines CRequestContext class for NCBI C++ diagnostic API.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
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