CernVM-FS
2.12.0
|
#include <object_fetcher.h>
Public Types | |
typedef object_fetcher_traits < DerivedT >::CatalogTN | CatalogTN |
typedef object_fetcher_traits < DerivedT >::HistoryTN | HistoryTN |
typedef object_fetcher_traits < DerivedT >::ReflogTN | ReflogTN |
typedef ObjectFetcherFailures::Failures | Failures |
Public Types inherited from ObjectFetcherFailures | |
enum | Failures { kFailOk, kFailNotFound, kFailLocalIO, kFailNetwork, kFailDecompression, kFailManifestNameMismatch, kFailManifestSignatureMismatch, kFailBadData, kFailUnknown, kFailNumEntries } |
Public Member Functions | |
Failures | FetchManifest (manifest::Manifest **manifest) |
Failures | FetchHistory (HistoryTN **history, const shash::Any &history_hash=shash::Any()) |
Failures | FetchCatalog (const shash::Any &catalog_hash, const std::string &catalog_path, CatalogTN **catalog, const bool is_nested=false, CatalogTN *parent=NULL) |
Failures | FetchReflog (const shash::Any &reflog_hash, ReflogTN **reflog) |
Failures | FetchManifest (UniquePtr< manifest::Manifest > *manifest) |
Failures | FetchHistory (UniquePtr< HistoryTN > *history, const shash::Any &history_hash=shash::Any()) |
Failures | FetchCatalog (const shash::Any &catalog_hash, const std::string &catalog_path, UniquePtr< CatalogTN > *catalog, const bool is_nested=false, CatalogTN *parent=NULL) |
Failures | FetchReflog (const shash::Any &reflog_hash, UniquePtr< ReflogTN > *reflog) |
std::string | GetUrl (const shash::Any &hash) const |
bool | HasHistory () |
const std::string & | temporary_directory () const |
Static Public Attributes | |
static const std::string | kManifestFilename |
static const std::string | kReflogFilename |
Protected Member Functions | |
AbstractObjectFetcher (const std::string &temp_dir) | |
Failures | Fetch (const shash::Any &object_hash, std::string *file_path) |
Failures | Fetch (const std::string &relative_path, const bool decompress, const bool nocache, std::string *file_path) |
shash::Any | GetHistoryHash () |
Private Attributes | |
const std::string | temporary_directory_ |
This is the default class implementing the data object fetching strategy. It is meant to be used when CVMFS specific data structures need to be downloaded from a backend storage of a repository.
ObjectFetchers are supposed to be configured for one specific repository. How this is done depends on the concrete implementation of this base class. When a concrete implementation of ObjectFetcher<> needs to deal with files on the local file system it is obliged to take measures for proper cleanup of those files after usage.
It abstracts all accesses to external file or HTTP resources and gathers this access logic in one central point. This also comes in handy when unit testing components that depend on downloading CVMFS data structures from a repository backend storage like CatalogTraversal<> or GarbageCollector<>.
Definition at line 81 of file object_fetcher.h.
typedef object_fetcher_traits<DerivedT>::CatalogTN AbstractObjectFetcher< DerivedT >::CatalogTN |
Definition at line 83 of file object_fetcher.h.
typedef ObjectFetcherFailures::Failures AbstractObjectFetcher< DerivedT >::Failures |
Definition at line 87 of file object_fetcher.h.
typedef object_fetcher_traits<DerivedT>::HistoryTN AbstractObjectFetcher< DerivedT >::HistoryTN |
Definition at line 84 of file object_fetcher.h.
typedef object_fetcher_traits<DerivedT>::ReflogTN AbstractObjectFetcher< DerivedT >::ReflogTN |
Definition at line 85 of file object_fetcher.h.
|
inlineexplicitprotected |
Definition at line 264 of file object_fetcher.h.
|
inlineprotected |
Internal function used to download objects defined by the given content hash. This needs to be implemented depending on the concrete implementation of this base class.
object_hash | the content hash of the object to be downloaded |
file_path | temporary file path to store the download result |
Definition at line 276 of file object_fetcher.h.
Referenced by AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::Fetch(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchCatalog(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchHistory(), and AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchReflog().
|
inlineprotected |
Definition at line 280 of file object_fetcher.h.
|
inline |
Downloads and opens a catalog. Note that the user is responsible to remove the catalog object after usage.
catalog_hash | the content hash of the catalog object |
catalog_path | the root_path the catalog is mounted on |
catalog | pointer to the fetched catalog object pointer |
is_nested | a hint if the catalog to be loaded is a nested one |
parent | (optional) parent catalog of the requested catalog |
Definition at line 155 of file object_fetcher.h.
Referenced by swissknife::RootChainWalker::FetchCatalog(), and AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchCatalog().
|
inline |
Definition at line 226 of file object_fetcher.h.
|
inline |
Downloads and opens (read-only) a history database. Note that the user is responsible to remove the history object after usage. The fetched SQLite database file will be unlinked automatically during the destruction of the HistoryTN object.
history | pointer to a history database object pointer |
history_hash | (optional) the content hash of the history database if left blank, the latest one is downloaded |
Definition at line 115 of file object_fetcher.h.
Referenced by swissknife::RootChainWalker::FetchHistory(), and AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchHistory().
|
inline |
Definition at line 218 of file object_fetcher.h.
|
inline |
Fetches and opens the manifest of the repository this object fetcher is configured for. Note that the user is responsible to clean up this object.
manifest | pointer to a manifest object pointer |
Definition at line 100 of file object_fetcher.h.
Referenced by AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchManifest(), and AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::GetHistoryHash().
|
inline |
Definition at line 211 of file object_fetcher.h.
|
inline |
Definition at line 182 of file object_fetcher.h.
Referenced by AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchReflog().
|
inline |
Definition at line 241 of file object_fetcher.h.
|
inlineprotected |
Retrieves the history content hash of the HEAD history database from the repository's manifest
Definition at line 296 of file object_fetcher.h.
Referenced by AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchHistory(), and AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::HasHistory().
|
inline |
Definition at line 250 of file object_fetcher.h.
Referenced by AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::GetUrl().
|
inline |
Definition at line 254 of file object_fetcher.h.
|
inline |
Definition at line 259 of file object_fetcher.h.
Referenced by HttpObjectFetcher< CatalogT, HistoryT, ReflogT >::Download(), and LocalObjectFetcher< CatalogT, HistoryT, ReflogT >::Fetch().
|
static |
Definition at line 89 of file object_fetcher.h.
Referenced by LocalObjectFetcher< CatalogT, HistoryT, ReflogT >::FetchManifest(), and HttpObjectFetcher< CatalogT, HistoryT, ReflogT >::FetchManifest().
|
static |
Definition at line 90 of file object_fetcher.h.
Referenced by AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchReflog().
|
private |
Definition at line 310 of file object_fetcher.h.
Referenced by AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::temporary_directory().