cvmfs/catalog_mgr_rw.cc
LoadError WritableCatalogManager::LoadCatalog(const PathString &mountpoint,
                                              const hash::Any &hash,
                                              std::string *catalog_path)
{
  hash::Any effective_hash = hash.IsNull() ? base_hash_ : hash;
  const string url = stratum0_ + "/data" + effective_hash.MakePath(1, 2) + "C";
  FILE *fcatalog = CreateTempFile(dir_temp_ + "/catalog", 0666, "w",
                                  catalog_path);
  if (!fcatalog) {
    LogCvmfs(kLogCatalog, kLogStderr,
             "failed to create temp file when loading %s", url.c_str());
    assert(false);
  }

  download::JobInfo download_catalog(&url, true, false, fcatalog,
                                     &effective_hash);

  download::Failures retval = download::Fetch(&download_catalog);
  fclose(fcatalog);

  if (retval != download::kFailOk) {
    LogCvmfs(kLogCatalog, kLogStderr,
             "failed to load %s from Stratum 0 (%d)", url.c_str(), retval);
    assert(false);
  }

  return kLoadNew;
}
/**
 * Loads a catalog via HTTP from Statum 0 into a temporary file.
 * @param url_path the url of the catalog to load
 * @param mount_point the file system path where the catalog should be mounted
 * @param catalog_file a pointer to the string containing the full qualified
 *                     name of the catalog afterwards
 * @return 0 on success, different otherwise
 */
Loads a catalog via HTTP from Statum 0 into a temporary file.
@param url_path the url of the catalog to load
@param mount_point the file system path where the catalog should be mounted
@param catalog_file a pointer to the string containing the full qualified
name of the catalog afterwards
@return 0 on success, different otherwise
Loads a catalog via HTTP from Statum 0 into a temporary file . @param url_path the url of the catalog to load @param mount_point the file system path where the catalog should be mounted @param catalog_file a pointer to the string containing the full qualified name of the catalog afterwards @return 0 on success different otherwise
LoadError WritableCatalogManager::LoadCatalog(const PathString &mountpoint,
                                              const hash::Any &hash,
                                              std::string *catalog_path)
{
  hash::Any effective_hash = hash.IsNull() ? base_hash_ : hash;
  const string url = stratum0_ + "/data" + effective_hash.MakePath(1, 2) + "C";
  FILE *fcatalog = CreateTempFile(dir_temp_ + "/catalog", 0666, "w",
                                  catalog_path);
  if (!fcatalog) {
    LogCvmfs(kLogCatalog, kLogStderr,
             "failed to create temp file when loading %s", url.c_str());
    assert(false);
  }
  download::JobInfo download_catalog(&url, true, false, fcatalog,
                                     &effective_hash);
  download::Failures retval = download::Fetch(&download_catalog);
  fclose(fcatalog);
  if (retval != download::kFailOk) {
    LogCvmfs(kLogCatalog, kLogStderr,
             "failed to load %s from Stratum 0 (%d)", url.c_str(), retval);
    assert(false);
  }
  return kLoadNew;
}
LoadError WritableCatalogManager :: LoadCatalog ( const PathString & mountpoint , const hash :: Any & hash , std :: string * catalog_path ) { hash :: Any effective_hash = hash . IsNull ( ) ? base_hash_ : hash ; const string url = stratum0_ + " " + effective_hash . MakePath ( 1 , 2 ) + " " ; FILE * fcatalog = CreateTempFile ( dir_temp_ + " " , 0666 , " " , catalog_path ) ; if ( ! fcatalog ) { LogCvmfs ( kLogCatalog , kLogStderr , " " , url . c_str ( ) ) ; assert ( false ) ; } download :: JobInfo download_catalog ( & url , true , false , fcatalog , & effective_hash ) ; download :: Failures retval = download :: Fetch ( & download_catalog ) ; fclose ( fcatalog ) ; if ( retval != download :: kFailOk ) { LogCvmfs ( kLogCatalog , kLogStderr , " " , url . c_str ( ) , retval ) ; assert ( false ) ; } return kLoadNew ; }
Loads a catalog via HTTP from Statum 0 into a temporary file.
Loads a catalog via HTTP from Statum 0 into a temporary file .