CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StreamingCacheManager Class Reference

#include <cache_stream.h>

Inheritance diagram for StreamingCacheManager:
Collaboration diagram for StreamingCacheManager:

Classes

struct  Counters
 
struct  FdInfo
 
struct  SavedState
 

Public Member Functions

 StreamingCacheManager (unsigned max_open_fds, CacheManager *cache_mgr, download::DownloadManager *regular_download_mgr, download::DownloadManager *external_download_mgr, size_t buffer_size, perf::Statistics *statistics)
 
virtual ~StreamingCacheManager ()
 
void SetRegularDownloadManager (download::DownloadManager *download_mgr)
 
void SetExternalDownloadManager (download::DownloadManager *download_mgr)
 
virtual CacheManagerIds id ()
 
virtual std::string Describe ()
 
virtual bool AcquireQuotaManager (QuotaManager *quota_mgr)
 
virtual int Open (const LabeledObject &object)
 
virtual int64_t GetSize (int fd)
 
virtual int Close (int fd)
 
virtual int64_t Pread (int fd, void *buf, uint64_t size, uint64_t offset)
 
virtual int Dup (int fd)
 
virtual int Readahead (int fd)
 
virtual uint32_t SizeOfTxn ()
 
virtual int StartTxn (const shash::Any &id, uint64_t size, void *txn)
 
virtual void CtrlTxn (const Label &label, const int flags, void *txn)
 
virtual int64_t Write (const void *buf, uint64_t size, void *txn)
 
virtual int Reset (void *txn)
 
virtual int OpenFromTxn (void *txn)
 
virtual int AbortTxn (void *txn)
 
virtual int CommitTxn (void *txn)
 
virtual void Spawn ()
 
virtual manifest::Breadcrumb LoadBreadcrumb (const std::string &fqrn)
 
virtual bool StoreBreadcrumb (const manifest::Manifest &manifest)
 
CacheManagerMoveOutBackingCacheMgr (int *root_fd)
 
int PlantFd (int fd_in_cache_mgr)
 
const Counterscounters () const
 
- Public Member Functions inherited from CacheManager
virtual ~CacheManager ()
 
int ChecksumFd (int fd, shash::Any *id)
 
int OpenPinned (const LabeledObject &object)
 
bool Open2Mem (const LabeledObject &object, unsigned char **buffer, uint64_t *size)
 
bool CommitFromMem (const LabeledObject &object, const unsigned char *buffer, const uint64_t size)
 
QuotaManagerquota_mgr ()
 
void * SaveState (const int fd_progress)
 
int RestoreState (const int fd_progress, void *state)
 
void FreeState (const int fd_progress, void *state)
 
CacheManagerIds PeekState (void *state)
 

Static Public Attributes

static const size_t kDefaultBufferSize = 64 * 1024 * 1024
 
- Static Public Attributes inherited from CacheManager
static const uint64_t kSizeUnknown = uint64_t(-1)
 
static const int kLabelCatalog = 0x01
 
static const int kLabelPinned = 0x02
 
static const int kLabelVolatile = 0x04
 
static const int kLabelExternal = 0x08
 
static const int kLabelChunked = 0x10
 
static const int kLabelCertificate = 0x20
 
static const int kLabelMetainfo = 0x40
 
static const int kLabelHistory = 0x80
 

Protected Member Functions

virtual void * DoSaveState ()
 
virtual int DoRestoreState (void *data)
 
virtual bool DoFreeState (void *data)
 
- Protected Member Functions inherited from CacheManager
 CacheManager ()
 

Private Member Functions

download::DownloadManagerSelectDownloadManager (const FdInfo &info)
 
int64_t Stream (const FdInfo &info, void *buf, uint64_t size, uint64_t offset)
 

Private Attributes

UniquePtr< CacheManagercache_mgr_
 
download::DownloadManagerregular_download_mgr_
 
download::DownloadManagerexternal_download_mgr_
 
pthread_mutex_t * lock_fd_table_
 
FdTable< FdInfofd_table_
 
UniquePtr< RingBufferbuffer_
 
SmallHashDynamic< shash::Any,
RingBuffer::ObjectHandle_t
buffered_objects_
 
pthread_mutex_t * lock_buffer_
 
UniquePtr< Counterscounters_
 

Additional Inherited Members

- Protected Attributes inherited from CacheManager
QuotaManagerquota_mgr_
 

Detailed Description

Cache manager that streams regular files using a download manager and stores file catalogs in an underlying cache manager.

Definition at line 31 of file cache_stream.h.

Constructor & Destructor Documentation

StreamingCacheManager::StreamingCacheManager ( unsigned  max_open_fds,
CacheManager cache_mgr,
download::DownloadManager regular_download_mgr,
download::DownloadManager external_download_mgr,
size_t  buffer_size,
perf::Statistics statistics 
)

Definition at line 232 of file cache_stream.cc.

Here is the call graph for this function:

StreamingCacheManager::~StreamingCacheManager ( )
virtual

Definition at line 261 of file cache_stream.cc.

Member Function Documentation

virtual int StreamingCacheManager::AbortTxn ( void *  txn)
inlinevirtual

Implements CacheManager.

Definition at line 92 of file cache_stream.h.

bool StreamingCacheManager::AcquireQuotaManager ( QuotaManager quota_mgr)
virtual

Implements CacheManager.

Definition at line 273 of file cache_stream.cc.

int StreamingCacheManager::Close ( int  fd)
virtual

Implements CacheManager.

Definition at line 340 of file cache_stream.cc.

Here is the call graph for this function:

virtual int StreamingCacheManager::CommitTxn ( void *  txn)
inlinevirtual

Implements CacheManager.

Definition at line 93 of file cache_stream.h.

const Counters& StreamingCacheManager::counters ( ) const
inline

Definition at line 113 of file cache_stream.h.

virtual void StreamingCacheManager::CtrlTxn ( const Label label,
const int  flags,
void *  txn 
)
inlinevirtual

Implements CacheManager.

Definition at line 83 of file cache_stream.h.

std::string StreamingCacheManager::Describe ( )
virtual

Return a human readable description of the cache instance. Used in cvmfs_talk.

Implements CacheManager.

Definition at line 269 of file cache_stream.cc.

bool StreamingCacheManager::DoFreeState ( void *  data)
protectedvirtual

Reimplemented from CacheManager.

Definition at line 436 of file cache_stream.cc.

int StreamingCacheManager::DoRestoreState ( void *  data)
protectedvirtual

Reimplemented from CacheManager.

Definition at line 413 of file cache_stream.cc.

Here is the call graph for this function:

void * StreamingCacheManager::DoSaveState ( )
protectedvirtual

Reimplemented from CacheManager.

Definition at line 406 of file cache_stream.cc.

int StreamingCacheManager::Dup ( int  fd)
virtual

Implements CacheManager.

Definition at line 321 of file cache_stream.cc.

Here is the call graph for this function:

int64_t StreamingCacheManager::GetSize ( int  fd)
virtual

Implements CacheManager.

Definition at line 305 of file cache_stream.cc.

Here is the call graph for this function:

virtual CacheManagerIds StreamingCacheManager::id ( )
inlinevirtual

Implements CacheManager.

Definition at line 65 of file cache_stream.h.

virtual manifest::Breadcrumb StreamingCacheManager::LoadBreadcrumb ( const std::string &  )
inlinevirtual

While not strictly necessary, cache managers often have a directory associated with them. This directory is currently used to find the cached manifest copy, the cvmfschecksum.$reponame file. This is important to make pre-loaded alien caches work, even in a tiered setup.

Reimplemented from CacheManager.

Definition at line 97 of file cache_stream.h.

CacheManager * StreamingCacheManager::MoveOutBackingCacheMgr ( int *  root_fd)

Definition at line 444 of file cache_stream.cc.

Here is the call graph for this function:

int StreamingCacheManager::Open ( const LabeledObject object)
virtual

Opening an object might get it from a third-party source, e.g. when the tiered cache manager issues a copy-up operation. In this case it is beneficial to register the object with the accurate meta-data, in the same way it is done during transactions.

Implements CacheManager.

Definition at line 280 of file cache_stream.cc.

int StreamingCacheManager::OpenFromTxn ( void *  txn)
virtual

Implements CacheManager.

Definition at line 397 of file cache_stream.cc.

int StreamingCacheManager::PlantFd ( int  fd_in_cache_mgr)

Definition at line 300 of file cache_stream.cc.

Referenced by RestoreState().

Here is the caller graph for this function:

int64_t StreamingCacheManager::Pread ( int  fd,
void *  buf,
uint64_t  size,
uint64_t  offset 
)
virtual

Implements CacheManager.

Definition at line 356 of file cache_stream.cc.

Here is the call graph for this function:

int StreamingCacheManager::Readahead ( int  fd)
virtual

Implements CacheManager.

Definition at line 381 of file cache_stream.cc.

Here is the call graph for this function:

virtual int StreamingCacheManager::Reset ( void *  txn)
inlinevirtual

Implements CacheManager.

Definition at line 90 of file cache_stream.h.

download::DownloadManager * StreamingCacheManager::SelectDownloadManager ( const FdInfo info)
private

Depending on info.flags, selects either the regular or the external download manager

Definition at line 132 of file cache_stream.cc.

Referenced by Stream().

Here is the call graph for this function:

Here is the caller graph for this function:

void StreamingCacheManager::SetExternalDownloadManager ( download::DownloadManager download_mgr)
inline

Definition at line 61 of file cache_stream.h.

Referenced by MountPoint::Create().

Here is the caller graph for this function:

void StreamingCacheManager::SetRegularDownloadManager ( download::DownloadManager download_mgr)
inline

Definition at line 58 of file cache_stream.h.

Referenced by MountPoint::Create().

Here is the caller graph for this function:

virtual uint32_t StreamingCacheManager::SizeOfTxn ( )
inlinevirtual

Implements CacheManager.

Definition at line 79 of file cache_stream.h.

virtual void StreamingCacheManager::Spawn ( )
inlinevirtual

Implements CacheManager.

Definition at line 95 of file cache_stream.h.

virtual int StreamingCacheManager::StartTxn ( const shash::Any id,
uint64_t  size,
void *  txn 
)
inlinevirtual

Implements CacheManager.

Definition at line 80 of file cache_stream.h.

virtual bool StreamingCacheManager::StoreBreadcrumb ( const manifest::Manifest manifest)
inlinevirtual

Reimplemented from CacheManager.

Definition at line 100 of file cache_stream.h.

int64_t StreamingCacheManager::Stream ( const FdInfo info,
void *  buf,
uint64_t  size,
uint64_t  offset 
)
private

Streams an object using the download manager. The complete object is read and its size is returned (-errno on error). The given section of the object is copied into the provided buffer, which may be NULL if only the size of the object is relevant.

Definition at line 141 of file cache_stream.cc.

Referenced by GetSize(), and Pread().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int64_t StreamingCacheManager::Write ( const void *  buf,
uint64_t  size,
void *  txn 
)
inlinevirtual

Implements CacheManager.

Definition at line 86 of file cache_stream.h.

Member Data Documentation

UniquePtr<RingBuffer> StreamingCacheManager::buffer_
private

A small in-memory cache to avoid frequent re-downloads if multiple blocks from the same chunk are read

Definition at line 168 of file cache_stream.h.

Referenced by Stream(), and StreamingCacheManager().

SmallHashDynamic<shash::Any, RingBuffer::ObjectHandle_t> StreamingCacheManager::buffered_objects_
private

Definition at line 169 of file cache_stream.h.

Referenced by Stream(), and StreamingCacheManager().

UniquePtr<Counters> StreamingCacheManager::counters_
private

Definition at line 172 of file cache_stream.h.

Referenced by counters(), and Stream().

download::DownloadManager* StreamingCacheManager::external_download_mgr_
private

Definition at line 161 of file cache_stream.h.

Referenced by SelectDownloadManager(), and SetExternalDownloadManager().

FdTable<FdInfo> StreamingCacheManager::fd_table_
private
const size_t StreamingCacheManager::kDefaultBufferSize = 64 * 1024 * 1024
static

Definition at line 33 of file cache_stream.h.

Referenced by RestoreState(), and FileSystem::TriageCacheMgr().

pthread_mutex_t* StreamingCacheManager::lock_buffer_
private

Definition at line 170 of file cache_stream.h.

Referenced by Stream(), StreamingCacheManager(), and ~StreamingCacheManager().

pthread_mutex_t* StreamingCacheManager::lock_fd_table_
private
download::DownloadManager* StreamingCacheManager::regular_download_mgr_
private

Definition at line 160 of file cache_stream.h.

Referenced by SelectDownloadManager(), and SetRegularDownloadManager().


The documentation for this class was generated from the following files: