CernVM-FS
2.11.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
catalog_diff_tool.h
Go to the documentation of this file.
1
5
#ifndef CVMFS_CATALOG_DIFF_TOOL_H_
6
#define CVMFS_CATALOG_DIFF_TOOL_H_
7
8
#include <string>
9
10
#include "
directory_entry.h
"
11
#include "
file_chunk.h
"
12
#include "
shortstring.h
"
13
#include "
statistics.h
"
14
#include "
util/pointer.h
"
15
#include "
util/raii_temp_dir.h
"
16
#include "
xattr.h
"
17
18
namespace
download {
19
class
DownloadManager;
20
}
21
22
template
<
typename
RoCatalogMgr>
23
class
CatalogDiffTool
{
24
public
:
25
CatalogDiffTool
(RoCatalogMgr* old_catalog_mgr, RoCatalogMgr* new_catalog_mgr)
26
:
repo_path_
(
""
),
27
temp_dir_prefix_
(
""
),
28
download_manager_
(NULL),
29
old_catalog_mgr_
(old_catalog_mgr),
30
new_catalog_mgr_
(new_catalog_mgr),
31
needs_setup_
(false) {}
32
33
CatalogDiffTool
(
const
std::string& repo_path,
const
shash::Any
& old_root_hash,
34
const
shash::Any
& new_root_hash,
35
const
std::string& temp_dir_prefix,
36
download::DownloadManager
* download_manager)
37
:
repo_path_
(repo_path),
38
old_root_hash_
(old_root_hash),
39
new_root_hash_
(new_root_hash),
40
temp_dir_prefix_
(temp_dir_prefix),
41
download_manager_
(download_manager),
42
old_raii_temp_dir_
(),
43
new_raii_temp_dir_
(),
44
old_catalog_mgr_
(),
45
new_catalog_mgr_
(),
46
needs_setup_
(true) {}
47
48
virtual
~CatalogDiffTool
() {}
49
50
bool
Init
();
51
52
bool
Run
(
const
PathString
& path);
53
54
protected
:
63
virtual
bool
IsIgnoredPath
(
const
PathString
&
/* path */
) {
return
false
; }
64
88
virtual
bool
IsReportablePath
(
const
PathString
&
/* path */
) {
return
true
; }
89
90
virtual
void
ReportAddition
(
const
PathString
& path,
91
const
catalog::DirectoryEntry
& entry,
92
const
XattrList
& xattrs,
93
const
FileChunkList
& chunks) = 0;
94
virtual
void
ReportRemoval
(
const
PathString
& path,
95
const
catalog::DirectoryEntry
& entry) = 0;
96
virtual
bool
ReportModification
(
const
PathString
& path,
97
const
catalog::DirectoryEntry
& old_entry,
98
const
catalog::DirectoryEntry
& new_entry,
99
const
XattrList
& xattrs,
100
const
FileChunkList
& chunks) = 0;
101
102
const
catalog::Catalog
*
GetOldCatalog
()
const
{
103
return
old_catalog_mgr_
->GetRootCatalog();
104
}
105
const
catalog::Catalog
*
GetNewCatalog
()
const
{
106
return
new_catalog_mgr_
->GetRootCatalog();
107
}
108
RoCatalogMgr*
GetOldCatalogMgr
() {
109
return
old_catalog_mgr_
.
weak_ref
();
110
}
111
RoCatalogMgr*
GetNewCatalogMgr
() {
112
return
new_catalog_mgr_
.
weak_ref
();
113
}
114
115
private
:
116
RoCatalogMgr*
OpenCatalogManager
(
const
std::string& repo_path,
117
const
std::string&
temp_dir
,
118
const
shash::Any
& root_hash,
119
download::DownloadManager
* download_manager,
120
perf::Statistics
* stats);
121
122
void
DiffRec
(
const
PathString
& path);
123
124
std::string
repo_path_
;
125
shash::Any
old_root_hash_
;
126
shash::Any
new_root_hash_
;
127
std::string
temp_dir_prefix_
;
128
129
download::DownloadManager
*
download_manager_
;
130
131
perf::Statistics
stats_old_
;
132
perf::Statistics
stats_new_
;
133
134
UniquePtr<RaiiTempDir>
old_raii_temp_dir_
;
135
UniquePtr<RaiiTempDir>
new_raii_temp_dir_
;
136
137
UniquePtr<RoCatalogMgr>
old_catalog_mgr_
;
138
UniquePtr<RoCatalogMgr>
new_catalog_mgr_
;
139
140
const
bool
needs_setup_
;
141
};
142
143
#include "
catalog_diff_tool_impl.h
"
144
145
#endif // CVMFS_CATALOG_DIFF_TOOL_H_
CatalogDiffTool::download_manager_
download::DownloadManager * download_manager_
Definition:
catalog_diff_tool.h:129
CatalogDiffTool::new_catalog_mgr_
UniquePtr< RoCatalogMgr > new_catalog_mgr_
Definition:
catalog_diff_tool.h:138
BigVector< FileChunk >
CatalogDiffTool::Init
bool Init()
Definition:
catalog_diff_tool_impl.h:46
CatalogDiffTool::stats_new_
perf::Statistics stats_new_
Definition:
catalog_diff_tool.h:132
raii_temp_dir.h
swissknife::anonymous_namespace{swissknife_pull.cc}::temp_dir
SharedPtr< string > temp_dir
Definition:
swissknife_pull.cc:101
perf::Statistics
Definition:
statistics.h:60
CatalogDiffTool::temp_dir_prefix_
std::string temp_dir_prefix_
Definition:
catalog_diff_tool.h:127
CatalogDiffTool::~CatalogDiffTool
virtual ~CatalogDiffTool()
Definition:
catalog_diff_tool.h:48
CatalogDiffTool::GetNewCatalog
const catalog::Catalog * GetNewCatalog() const
Definition:
catalog_diff_tool.h:105
UniquePtrBase::weak_ref
T * weak_ref() const
Definition:
pointer.h:42
xattr.h
shash::Any
Definition:
hash.h:467
catalog::Catalog
Definition:
catalog.h:91
UniquePtr< RaiiTempDir >
CatalogDiffTool::DiffRec
void DiffRec(const PathString &path)
Definition:
catalog_diff_tool_impl.h:96
CatalogDiffTool::old_catalog_mgr_
UniquePtr< RoCatalogMgr > old_catalog_mgr_
Definition:
catalog_diff_tool.h:137
statistics.h
shortstring.h
CatalogDiffTool::ReportAddition
virtual void ReportAddition(const PathString &path, const catalog::DirectoryEntry &entry, const XattrList &xattrs, const FileChunkList &chunks)=0
directory_entry.h
CatalogDiffTool::old_root_hash_
shash::Any old_root_hash_
Definition:
catalog_diff_tool.h:125
catalog::DirectoryEntry
Definition:
directory_entry.h:252
CatalogDiffTool::IsReportablePath
virtual bool IsReportablePath(const PathString &)
Definition:
catalog_diff_tool.h:88
CatalogDiffTool::OpenCatalogManager
RoCatalogMgr * OpenCatalogManager(const std::string &repo_path, const std::string &temp_dir, const shash::Any &root_hash, download::DownloadManager *download_manager, perf::Statistics *stats)
Definition:
catalog_diff_tool_impl.h:84
CatalogDiffTool::repo_path_
std::string repo_path_
Definition:
catalog_diff_tool.h:124
CatalogDiffTool::ReportModification
virtual bool ReportModification(const PathString &path, const catalog::DirectoryEntry &old_entry, const catalog::DirectoryEntry &new_entry, const XattrList &xattrs, const FileChunkList &chunks)=0
CatalogDiffTool::GetNewCatalogMgr
RoCatalogMgr * GetNewCatalogMgr()
Definition:
catalog_diff_tool.h:111
CatalogDiffTool::GetOldCatalogMgr
RoCatalogMgr * GetOldCatalogMgr()
Definition:
catalog_diff_tool.h:108
XattrList
Definition:
xattr.h:27
download::DownloadManager
Definition:
download.h:116
CatalogDiffTool::new_raii_temp_dir_
UniquePtr< RaiiTempDir > new_raii_temp_dir_
Definition:
catalog_diff_tool.h:135
CatalogDiffTool::IsIgnoredPath
virtual bool IsIgnoredPath(const PathString &)
Definition:
catalog_diff_tool.h:63
CatalogDiffTool::stats_old_
perf::Statistics stats_old_
Definition:
catalog_diff_tool.h:131
catalog_diff_tool_impl.h
CatalogDiffTool
Definition:
catalog_diff_tool.h:23
CatalogDiffTool::needs_setup_
const bool needs_setup_
Definition:
catalog_diff_tool.h:140
CatalogDiffTool::ReportRemoval
virtual void ReportRemoval(const PathString &path, const catalog::DirectoryEntry &entry)=0
CatalogDiffTool::new_root_hash_
shash::Any new_root_hash_
Definition:
catalog_diff_tool.h:126
CatalogDiffTool::Run
bool Run(const PathString &path)
Definition:
catalog_diff_tool_impl.h:77
CatalogDiffTool::GetOldCatalog
const catalog::Catalog * GetOldCatalog() const
Definition:
catalog_diff_tool.h:102
CatalogDiffTool::CatalogDiffTool
CatalogDiffTool(const std::string &repo_path, const shash::Any &old_root_hash, const shash::Any &new_root_hash, const std::string &temp_dir_prefix, download::DownloadManager *download_manager)
Definition:
catalog_diff_tool.h:33
CatalogDiffTool::CatalogDiffTool
CatalogDiffTool(RoCatalogMgr *old_catalog_mgr, RoCatalogMgr *new_catalog_mgr)
Definition:
catalog_diff_tool.h:25
pointer.h
CatalogDiffTool::old_raii_temp_dir_
UniquePtr< RaiiTempDir > old_raii_temp_dir_
Definition:
catalog_diff_tool.h:134
ShortString
Definition:
shortstring.h:27
file_chunk.h
cvmfs
cvmfs
catalog_diff_tool.h
Generated on Sun Sep 17 2023 00:23:14 for CernVM-FS by
1.8.5