0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GcWorker.h
Go to the documentation of this file.
1 /* -*- c++ -*-
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 #ifndef HYPERTABLE_GCWORKER_H
23 #define HYPERTABLE_GCWORKER_H
24 
26 
27 #include <Hypertable/Lib/Client.h>
28 
29 #include <Common/CstrHashMap.h>
30 
31 namespace Hypertable {
32 
33  typedef CstrHashMap<int> CountMap; // filename -> reference count
34 
35  class GcWorker {
36  public:
37  GcWorker(ContextPtr &context);
38  void gc();
39 
40  private:
41  void scan_metadata(CountMap &files_map);
42  void delete_row(const std::string &row, TableMutatorPtr &mutator);
43  void delete_cell(const Cell &cell, TableMutatorPtr &mutator);
44  void insert_files(CountMap &map, const char *buf, size_t len, int c=0);
45  void insert_file(CountMap &map, const char *fname, int c);
46  void reap(CountMap &files_map);
47 
50  };
51 
52 } // namespace Hypertable
53 
54 #endif // HYPERTABLE_GCWORKER_H
void delete_cell(const Cell &cell, TableMutatorPtr &mutator)
Definition: GcWorker.cc:135
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
ContextPtr m_context
Definition: GcWorker.h:48
A hash map for storing and lookup char * strings efficiently.
Definition: CstrHashMap.h:44
GcWorker(ContextPtr &context)
Definition: GcWorker.cc:35
void reap(CountMap &files_map)
Currently only stale cs files and range directories are reaped Table directories probably should be o...
Definition: GcWorker.cc:178
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Definition: Context.h:265
std::shared_ptr< TableMutator > TableMutatorPtr
Smart pointer to TableMutator.
Definition: TableMutator.h:257
Hypertable definitions
void scan_metadata(CountMap &files_map)
Definition: GcWorker.cc:54
HashMap optimized for char * strings.
void delete_row(const std::string &row, TableMutatorPtr &mutator)
Definition: GcWorker.cc:120
Encapsulates decomposed key and value.
Definition: Cell.h:32
CstrHashMap< int > CountMap
Definition: GcWorker.h:33
Declarations for Context.
void insert_files(CountMap &map, const char *buf, size_t len, int c=0)
Definition: GcWorker.cc:146
void insert_file(CountMap &map, const char *fname, int c)
Definition: GcWorker.cc:163