5 #ifndef CVMFS_SWISSKNIFE_MIGRATE_H_
6 #define CVMFS_SWISSKNIFE_MIGRATE_H_
29 class WritableCatalog;
32 namespace swissknife {
61 this->push_back(statistics);
113 template<
class DerivedT>
122 temporary_directory(temporary_directory),
123 collect_catalog_statistics(collect_catalog_statistics) {}
171 temporary_directory, collect_catalog_statistics)
172 , fix_nested_catalog_transitions(fix_nested_catalog_transitions)
173 , analyze_file_linkcounts(analyze_file_linkcounts)
240 temporary_directory, collect_catalog_statistics)
242 , gid_map(gid_map) { }
255 template <
class MapT>
257 const std::string &column)
const;
317 virtual std::string
GetName()
const {
return "migrate"; }
319 return "CernVM-FS catalog repository migration \n"
320 "This command migrates the whole catalog structure of a given repository";
332 template <
class ObjectFetcherT>
334 ObjectFetcherT *object_fetcher)
344 retval = object_fetcher->FetchHistory(
353 const bool generate_full_catalog_tree =
true;
354 params.
no_close = generate_full_catalog_tree;
359 if (manual_root_hash.
IsNull())
361 return traversal.
Traverse(manual_root_hash);
371 const std::string &message);
373 template <
class MigratorT>
375 typename MigratorT::worker_context *context);
377 template <
class MigratorT>
382 bool ReadPersona(
const std::string &uid,
const std::string &gid);
384 const std::string &gid_map_path,
386 GidMap *gid_map)
const;
424 #endif // CVMFS_SWISSKNIFE_MIGRATE_H_
catalog::Catalog const * root_catalog_
const std::string temporary_directory_
StopWatch migration_stopwatch_
void ConvertCatalogsRecursively(PendingCatalog *catalog, MigratorT *migrator)
void operator()(const expected_data &data)
bool UpdateCatalogMetadata(PendingCatalog *data) const
PendingCatalog(const catalog::Catalog *old_catalog=NULL)
bool AnalyzeFileLinkcounts(PendingCatalog *data) const
UniquePtr< upload::Spooler > spooler_
CallbackPtr RegisterListener(typename BoundClosure< CatalogTraversalData< ObjectFetcherT::CatalogTN >, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data)
PendingCatalogMap pending_catalogs_
static const unsigned kSchemaRevision
bool ReadPersonaMaps(const std::string &uid_map_path, const std::string &gid_map_path, UidMap *uid_map, GidMap *gid_map) const
std::string nested_catalog_marker_tmp_path_
catalog::WritableCatalog * new_catalog
bool MigrateFileMetadata(PendingCatalog *data) const
bool UpdateCatalogSchema(PendingCatalog *data) const
const bool fix_nested_catalog_transitions_
void Insert(const CatalogStatistics &statistics)
bool FindRootEntryInformation(PendingCatalog *data) const
const catalog::Catalog * old_catalog
bool StartDatabaseTransaction(PendingCatalog *data) const
bool LoadCatalogs(const shash::Any &manual_root_hash, ObjectFetcherT *object_fetcher)
void AnalyzeCatalogStatistics() const
ChownMigrationWorker(const worker_context *context)
bool FixNestedCatalogTransitionPoints(PendingCatalog *data) const
MigrationWorker_217(const worker_context *context)
virtual std::string GetName() const
std::vector< Parameter > ParameterList
void CreateNestedCatalogMarkerDirent(const shash::Any &content_hash)
atomic_int32 catalogs_processed_
void UploadCallback(const upload::SpoolerResult &result)
CommandMigrate::PendingCatalog * returned_data
bool UpdateUndoTags(PendingCatalog *root_catalog, uint64_t revision, time_t timestamp, shash::Any *history_hash)
static void FixNestedCatalogTransitionPoint(const catalog::DirectoryEntry &nested_root, catalog::DirectoryEntry *mountpoint)
ObjectFetcherT * object_fetcher
virtual ParameterList GetParams() const
bool RunMigration(PendingCatalog *data) const
shash::Any new_catalog_hash
PendingCatalogList nested_catalogs
void PrintStatusMessage(const PendingCatalog *catalog, const shash::Any &content_hash, const std::string &message)
worker_context(const std::string &temporary_directory, const bool collect_catalog_statistics, const bool fix_nested_catalog_transitions, const bool analyze_file_linkcounts, const uid_t uid, const gid_t gid)
bool RemoveDanglingNestedMountpoints(PendingCatalog *data) const
static catalog::DirectoryEntry nested_catalog_marker_
bool AttachOldCatalogDatabase(PendingCatalog *data) const
CommandMigrate::PendingCatalog * expected_data
bool ReadPersona(const std::string &uid, const std::string &gid)
const std::string root_path() const
bool MigrateNestedCatalogMountPoints(PendingCatalog *data) const
shash::Any GetOldContentHash() const
void CatalogCallback(const CatalogTraversalData< catalog::WritableCatalog > &data)
const std::string gid_map_statement_
const std::string uid_map_statement_
UniquePtr< history::SqliteHistory > history_upstream_
bool ConfigureSQLite() const
unsigned int hardlink_group_count
virtual ~AbstractMigrationWorker()
bool CommitDatabaseTransaction(PendingCatalog *data) const
const bool collect_catalog_statistics
worker_context(const std::string &temporary_directory, const bool collect_catalog_statistics, const UidMap &uid_map, const GidMap &gid_map)
bool GenerateCatalogStatistics(PendingCatalog *data) const
StopWatch catalog_loading_stopwatch_
unsigned int file_descriptor_limit_
bool CheckDatabaseSchemaCompatibility(PendingCatalog *data) const
void UploadHistoryClosure(const upload::SpoolerResult &result, Future< shash::Any > *hash)
Future< catalog::DirectoryEntry > root_entry
unsigned GetModifiedRowCount() const
std::string GenerateMappingStatement(const MapT &map, const std::string &column) const
const bool collect_catalog_statistics_
bool RepairStatisticsCounters(PendingCatalog *data) const
bool CheckDatabaseSchemaCompatibility(PendingCatalog *data) const
bool RunMigration(PendingCatalog *data) const
std::vector< PendingCatalog * > PendingCatalogList
unsigned int catalog_count_
BulkhashRemovalMigrationWorker(const worker_context *context)
std::string temporary_directory_
bool StartDatabaseTransaction(PendingCatalog *data) const
bool DetachOldCatalogDatabase(PendingCatalog *data) const
bool ApplyPersonaMappings(PendingCatalog *data) const
AbstractMigrationWorker(const worker_context *context)
bool CommitDatabaseTransaction(PendingCatalog *data) const
static const catalog::DirectoryEntry & GetNestedCatalogMarkerDirent()
StatsMigrationWorker(const worker_context *context)
bool RunMigration(PendingCatalog *data) const
PathString mountpoint() const
bool CheckDatabaseSchemaCompatibility(PendingCatalog *data) const
const std::string temporary_directory
bool GenerateNestedCatalogMarkerChunk()
bool BreakUpHardlinks(PendingCatalog *data) const
Future< bool > was_updated
virtual std::string GetDescription() const
Future< catalog::DeltaCounters > nested_statistics
bool CollectAndAggregateStatistics(PendingCatalog *data) const
bool Traverse(const TraversalType type=Base::kBreadthFirst)
worker_context(const std::string &temporary_directory, const bool collect_catalog_statistics)
bool GenerateNewStatisticsCounters(PendingCatalog *data) const
bool CommitDatabaseTransaction(PendingCatalog *data) const
bool RunMigration(PendingCatalog *data) const
bool has_committed_new_revision_
std::string ToString() const
bool RemoveRedundantBulkHashes(PendingCatalog *data) const
int Main(const ArgumentList &args)
std::map< char, SharedPtr< std::string > > ArgumentList
HardlinkRemovalMigrationWorker(const worker_context *context)
virtual ~PendingCatalog()
MigrationWorker_20x(const worker_context *context)
UniquePtr< manifest::Manifest > manifest_upstream_
bool CleanupNestedCatalogs(PendingCatalog *data) const
bool UpdateNestedCatalogReferences(PendingCatalog *data) const
bool CreateNewEmptyCatalog(PendingCatalog *data) const
CatalogStatisticsList catalog_statistics_list_
const CatalogDatabase & database() const
unsigned int aggregated_linkcounts
bool CheckDatabaseSchemaCompatibility(PendingCatalog *data) const
CatalogStatistics statistics
const bool analyze_file_linkcounts
bool StartDatabaseTransaction(PendingCatalog *data) const
const bool fix_nested_catalog_transitions
bool CheckDatabaseSchemaCompatibility(PendingCatalog *data) const
const bool analyze_file_linkcounts_
void MigrationCallback(PendingCatalog *const &data)
StopWatch migration_stopwatch_
bool RunMigration(PendingCatalog *data) const
bool RaiseFileDescriptorLimit() const
catalog::WritableCatalog * GetWritable(const catalog::Catalog *catalog) const
bool RunMigration(PendingCatalog *data) const
bool DoMigrationAndCommit(const std::string &manifest_path, typename MigratorT::worker_context *context)
bool RunMigration(PendingCatalog *data) const
static const float kSchema
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)