![]() |
CernVM-FS
2.10.0
|
#include <fetch.h>
Classes | |
struct | ThreadLocalStorage |
Public Member Functions | |
Fetcher (CacheManager *cache_mgr, download::DownloadManager *download_mgr, BackoffThrottle *backoff_throttle, perf::StatisticsTemplate statistics, bool external_data=false) | |
~Fetcher () | |
int | Fetch (const shash::Any &id, const uint64_t size, const std::string &name, const zlib::Algorithms compression_algorithm, const CacheManager::ObjectType object_type, const std::string &alt_url="", off_t range_offset=-1) |
CacheManager * | cache_mgr () |
download::DownloadManager * | download_mgr () |
Private Types | |
typedef std::map< shash::Any, std::vector< int > * > | ThreadQueues |
Private Member Functions | |
FRIEND_TEST (T_Fetcher, GetTls) | |
FRIEND_TEST (T_Fetcher, SignalWaitingThreads) | |
ThreadLocalStorage * | GetTls () |
void | CleanupTls (ThreadLocalStorage *tls) |
void | SignalWaitingThreads (const int fd, const shash::Any &id, ThreadLocalStorage *tls) |
int | OpenSelect (const shash::Any &id, const std::string &name, const CacheManager::ObjectType object_type) |
![]() | |
SingleCopy () | |
Private Attributes | |
bool | external_ |
pthread_key_t | thread_local_storage_ |
ThreadQueues | queues_download_ |
pthread_mutex_t * | lock_queues_download_ |
std::vector< ThreadLocalStorage * > | tls_blocks_ |
pthread_mutex_t * | lock_tls_blocks_ |
CacheManager * | cache_mgr_ |
download::DownloadManager * | download_mgr_ |
BackoffThrottle * | backoff_throttle_ |
perf::Counter * | n_downloads |
perf::Counter * | n_invocations |
Friends | |
void * | TestGetTls (void *data) |
void * | TestFetchCollapse (void *data) |
void * | TestFetchCollapse2 (void *data) |
void | TLSDestructor (void *data) |
The Fetcher uses a cache manager and a download manager in order to provide a (virtual) file descriptor to a requested object, which is valid in the context of the cache manager. If the object is not in the cache, it is downloaded and stored in the cache.
Concurrent download requests for the same id are collapsed.
|
private |
cvmfs::Fetcher::Fetcher | ( | CacheManager * | cache_mgr, |
download::DownloadManager * | download_mgr, | ||
BackoffThrottle * | backoff_throttle, | ||
perf::StatisticsTemplate | statistics, | ||
bool | external_data = false |
||
) |
cvmfs::Fetcher::~Fetcher | ( | ) |
|
inline |
Definition at line 85 of file fetch.h.
Referenced by catalog::ClientCatalogManager::LoadCatalog(), catalog::ClientCatalogManager::UnloadCatalog(), and catalog::ClientCatalogManager::~ClientCatalogManager().
|
private |
Called when a thread exists, releases a ThreadLocalStorage object and removes the pointer to it from tls_blocks_.
Definition at line 50 of file fetch.cc.
Referenced by cvmfs::TLSDestructor(), and ~Fetcher().
|
inline |
Definition at line 86 of file fetch.h.
Referenced by catalog::ClientCatalogManager::LoadCatalog().
int cvmfs::Fetcher::Fetch | ( | const shash::Any & | id, |
const uint64_t | size, | ||
const std::string & | name, | ||
const zlib::Algorithms | compression_algorithm, | ||
const CacheManager::ObjectType | object_type, | ||
const std::string & | alt_url = "" , |
||
off_t | range_offset = -1 |
||
) |
Definition at line 81 of file fetch.cc.
Referenced by cvmfs::cvmfs_open(), cvmfs::cvmfs_read(), MountPoint::FetchHistory(), catalog::ClientCatalogManager::LoadCatalogCas(), LibContext::Open(), cvmfs::Pin(), and LibContext::Pread().
|
private |
|
private |
|
private |
|
private |
|
private |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
Definition at line 160 of file fetch.h.
Referenced by cache_mgr(), OpenSelect(), and SignalWaitingThreads().
|
private |
Definition at line 161 of file fetch.h.
Referenced by download_mgr().
|
private |
|
private |
Definition at line 151 of file fetch.h.
Referenced by Fetcher(), SignalWaitingThreads(), and ~Fetcher().
|
private |
Definition at line 158 of file fetch.h.
Referenced by Fetcher(), cvmfs::TLSDestructor(), and ~Fetcher().
|
private |
|
private |
|
private |
Definition at line 150 of file fetch.h.
Referenced by SignalWaitingThreads().
|
private |
Key to the thread's ThreadLocalStorage memory
Definition at line 148 of file fetch.h.
Referenced by Fetcher(), and ~Fetcher().
|
private |
All the threads register their thread local storage here, so that it can be cleaned up properly in the destructor of Fetcher.
Definition at line 157 of file fetch.h.
Referenced by cvmfs::TLSDestructor(), and ~Fetcher().