0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OperationCollectGarbage.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #include "Common/Compat.h"
23 #include "Common/Error.h"
24 
26 #include "GcWorker.h"
27 
28 using namespace Hypertable;
29 
31  : OperationEphemeral(context, MetaLog::EntityType::OPERATION_COLLECT_GARBAGE) {
34 }
35 
36 
38  HT_INFOF("Entering CollectGarbage-%lld", (Lld)header.id);
39  try {
40  GcWorker worker(m_context);
41  worker.gc();
42  }
43  catch (Exception &e) {
44  HT_THROW2(e.code(), e, "Garbage Collection");
45  }
46  complete_ok();
47  HT_INFOF("Leaving CollectGarbage-%lld", (Lld)header.id);
48 }
49 
51  return "OperationCollectGarbage";
52 }
53 
55  return "CollectGarbage";
56 }
57 
ContextPtr m_context
Pointer to Master context.
Definition: Operation.h:553
Abstract base class for ephemeral operations.
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
int64_t id
Unique ID of entity.
virtual void execute()
Executes (carries out) the operation.
EntityHeader header
Entity header
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Definition: Context.h:265
virtual const String name()
Name of operation used for exclusivity.
const char * INIT
Definition: Operation.cc:45
Compatibility Macros for C/C++.
const char * METADATA
Definition: Operation.cc:48
virtual const String label()
Human readable label for operation.
Hypertable definitions
long long int Lld
Shortcut for printf formats.
Definition: String.h:53
DependencySet m_dependencies
Set of dependencies.
Definition: Operation.h:595
#define HT_INFOF(msg,...)
Definition: Logger.h:272
This is a generic exception class for Hypertable.
Definition: Error.h:314
void complete_ok(std::vector< MetaLog::EntityPtr > &additional)
Definition: Operation.cc:436
Error codes, Exception handling, error logging.
int code() const
Returns the error code.
Definition: Error.h:391
#define HT_THROW2(_code_, _ex_, _msg_)
Definition: Error.h:484