17 namespace swissknife {
49 template <
class DatabaseT>
75 const std::string &repo_url = *args.find(
'r')->second;
76 const std::string &
spooler = *args.find(
'u')->second;
77 const std::string &repo_name = *args.find(
'n')->second;
78 const std::string &tmp_dir = *args.find(
't')->second;
79 const std::string &repo_keys = *args.find(
'k')->second;
80 const std::string &reflog_chksum_path = *args.find(
'R')->second;
82 const bool follow_redirects =
false;
83 const std::string proxy = ((args.count(
'@') > 0) ?
84 *args.find(
'@')->second :
"");
132 uploader->UploadFile(reflog_db,
".cvmfsreflog");
133 shash::Any reflog_hash(manifest->GetHashAlgorithm());
135 uploader->WaitForUpload();
136 unlink(reflog_db.c_str());
138 const int errors = uploader->GetNumberOfErrors();
143 uploader->TearDown();
147 return (errors == 0) ? 0 : 1;
163 if (!meta_info.
IsNull()) {
189 while (!current_hash.
IsNull() &&
191 (current_catalog =
FetchCatalog(current_hash)).IsValid()) {
193 current_hash.
ToString().c_str(), current_catalog->GetRevision());
198 current_hash = current_catalog->GetPreviousRevision();
207 while (!current_hash.
IsNull() &&
209 (current_history =
FetchHistory(current_hash)).IsValid()) {
220 current_hash = current_history->previous_revision();
234 const bool list_success = history->GetHashes(&tag_hashes);
238 const bool bin_success = history->ListRecycleBin(&bin_hashes);
252 CatalogList::const_iterator i = catalog_list.begin();
253 CatalogList::const_iterator iend = catalog_list.end();
254 for (; i != iend; ++i) {
263 const char *root_path =
"";
281 template <
class DatabaseT>
285 DatabaseT *database) {
static Parameter Optional(const char key, const std::string &desc)
HistoryTN * FetchHistory(const shash::Any history_hash)
void TakeDatabaseFileOwnership()
const char * Code2Ascii(const ObjectFetcherFailures::Failures error)
std::string database_file() const
bool ContainsHistory(const shash::Any &history) const
const manifest::Manifest * manifest() const
bool WalkCatalogsInHistory(const HistoryTN *history)
bool AddHistory(const shash::Any &history)
void WalkRootCatalogs(const shash::Any &root_catalog_hash)
CatalogTN * FetchCatalog(const shash::Any catalog_hash)
const manifest::Manifest * manifest_
void FindObjectsAndPopulateReflog()
manifest::Reflog * reflog_
std::vector< Parameter > ParameterList
std::string ToString(const bool with_suffix=false) const
ObjectFetcher::CatalogTN CatalogTN
const history::History * history() const
std::string ToStringWithSuffix() const
Failures FetchHistory(HistoryTN **history, const shash::Any &history_hash=shash::Any())
int Main(const ArgumentList &args)
RootChainWalker(const manifest::Manifest *manifest, ObjectFetcher *object_fetcher, manifest::Reflog *reflog)
assert((mem||(size==0))&&"Out Of Memory")
void WalkListedCatalogs(const CatalogList &catalog_list)
void WalkHistories(const shash::Any &history_hash)
upload::Spooler * spooler
bool AddCatalog(const shash::Any &catalog)
virtual ParameterList GetParams() const
static AbstractUploader * Construct(const SpoolerDefinition ¶m)
object_fetcher_traits< HttpObjectFetcher< CatalogT, HistoryT, ReflogT > >::CatalogTN CatalogTN
bool AddMetainfo(const shash::Any &metainfo)
static Parameter Mandatory(const char key, const std::string &desc)
Failures FetchCatalog(const shash::Any &catalog_hash, const std::string &catalog_path, CatalogTN **catalog, const bool is_nested=false, CatalogTN *parent=NULL)
shash::Any certificate() const
object_fetcher_traits< HttpObjectFetcher< CatalogT, HistoryT, ReflogT > >::HistoryTN HistoryTN
DatabaseT * ReturnOrAbort(const ObjectFetcherFailures::Failures failure, const shash::Any &content_hash, DatabaseT *database)
ObjectFetcher * object_fetcher_
static void HashDatabase(const std::string &database_path, shash::Any *hash_reflog)
shash::Any catalog_hash() const
manifest::Reflog * reflog
void DropDatabaseFileOwnership()
bool AddCertificate(const shash::Any &certificate)
bool ContainsCatalog(const shash::Any &catalog) const
std::map< char, SharedPtr< std::string > > ArgumentList
shash::Any history() const
std::string meta_info() const
HttpObjectFetcher ObjectFetcher
Failures FetchManifest(manifest::Manifest **manifest)
void AddStaticManifestObjects(manifest::Reflog *reflog, manifest::Manifest *manifest) const
static bool WriteChecksum(const std::string &path, const shash::Any &value)
ObjectFetcher::HistoryTN HistoryTN
std::vector< shash::Any > CatalogList
shash::Any meta_info() const
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)