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

#include <cache_extern.h>

Inheritance diagram for ExternalCacheManager:
Collaboration diagram for ExternalCacheManager:

Classes

class  PluginHandle
 
struct  ReadOnlyHandle
 
struct  RpcInFlight
 
class  RpcJob
 
struct  Transaction
 

Public Member Functions

virtual ~ExternalCacheManager ()
 
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 AbortTxn (void *txn)
 
virtual int OpenFromTxn (void *txn)
 
virtual int CommitTxn (void *txn)
 
virtual manifest::Breadcrumb LoadBreadcrumb (const std::string &fqrn)
 
virtual bool StoreBreadcrumb (const manifest::Manifest &manifest)
 
virtual void Spawn ()
 
int64_t session_id () const
 
uint32_t max_object_size () const
 
uint64_t capabilities () const
 
pid_t pid_plugin () 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 Member Functions

static PluginHandleCreatePlugin (const std::string &locator, const std::vector< std::string > &cmd_line)
 
static ExternalCacheManagerCreate (int fd_connection, unsigned max_open_fds, const std::string &ident)
 

Static Public Attributes

static const unsigned kPbProtocolVersion = 1
 
- 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

 FRIEND_TEST (T_ExternalCacheManager, TransactionAbort)
 
 ExternalCacheManager (int fd_connection, unsigned max_open_fds)
 
int64_t NextRequestId ()
 
void CallRemotely (RpcJob *rpc_job)
 
int ChangeRefcount (const shash::Any &id, int change_by)
 
int DoOpen (const shash::Any &id)
 
shash::Any GetHandle (int fd)
 
int Flush (bool do_commit, Transaction *transaction)
 

Static Private Member Functions

static void * MainRead (void *data)
 
static int ConnectLocator (const std::string &locator, bool print_error)
 
static bool SpawnPlugin (const std::vector< std::string > &cmd_line)
 

Private Attributes

pid_t pid_plugin_
 
FdTable< ReadOnlyHandlefd_table_
 
CacheTransport transport_
 
int64_t session_id_
 
uint32_t max_object_size_
 
bool spawned_
 
bool terminated_
 
pthread_rwlock_t rwlock_fd_table_
 
atomic_int64 next_request_id_
 
pthread_mutex_t lock_send_fd_
 
std::vector< RpcInFlightinflight_rpcs_
 
pthread_mutex_t lock_inflight_rpcs_
 
pthread_t thread_read_
 
uint64_t capabilities_
 

Static Private Attributes

static const shash::Any kInvalidHandle
 
static const unsigned kMaxSupportedObjectSize = 512 * 1024
 
static const unsigned kMinSupportedObjectSize = 4 * 1024
 

Friends

class ExternalQuotaManager
 

Additional Inherited Members

- Protected Attributes inherited from CacheManager
QuotaManagerquota_mgr_
 

Detailed Description

Definition at line 30 of file cache_extern.h.

Constructor & Destructor Documentation

ExternalCacheManager::~ExternalCacheManager ( )
virtual

Definition at line 414 of file cache_extern.cc.

Here is the call graph for this function:

ExternalCacheManager::ExternalCacheManager ( int  fd_connection,
unsigned  max_open_fds 
)
explicitprivate

Definition at line 391 of file cache_extern.cc.

Here is the call graph for this function:

Member Function Documentation

int ExternalCacheManager::AbortTxn ( void *  txn)
virtual

Implements CacheManager.

Definition at line 76 of file cache_extern.cc.

bool ExternalCacheManager::AcquireQuotaManager ( QuotaManager quota_mgr)
virtual

Implements CacheManager.

Definition at line 85 of file cache_extern.cc.

Referenced by FileSystem::SetupExternalCacheMgr().

Here is the call graph for this function:

Here is the caller graph for this function:

void ExternalCacheManager::CallRemotely ( ExternalCacheManager::RpcJob rpc_job)
private

Definition at line 93 of file cache_extern.cc.

Referenced by ExternalQuotaManager::Cleanup(), ExternalQuotaManager::DoListing(), Flush(), ExternalQuotaManager::GetInfo(), GetSize(), LoadBreadcrumb(), Pread(), Reset(), and StoreBreadcrumb().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t ExternalCacheManager::capabilities ( ) const
inline

Definition at line 100 of file cache_extern.h.

int ExternalCacheManager::ChangeRefcount ( const shash::Any id,
int  change_by 
)
private

Definition at line 126 of file cache_extern.cc.

Here is the call graph for this function:

int ExternalCacheManager::Close ( int  fd)
virtual

Implements CacheManager.

Definition at line 143 of file cache_extern.cc.

Here is the call graph for this function:

int ExternalCacheManager::CommitTxn ( void *  txn)
virtual

Implements CacheManager.

Definition at line 158 of file cache_extern.cc.

Here is the call graph for this function:

int ExternalCacheManager::ConnectLocator ( const std::string &  locator,
bool  print_error 
)
staticprivate

Definition at line 176 of file cache_extern.cc.

Here is the call graph for this function:

ExternalCacheManager * ExternalCacheManager::Create ( int  fd_connection,
unsigned  max_open_fds,
const std::string &  ident 
)
static

Definition at line 209 of file cache_extern.cc.

Referenced by FileSystem::SetupExternalCacheMgr().

Here is the call graph for this function:

Here is the caller graph for this function:

ExternalCacheManager::PluginHandle * ExternalCacheManager::CreatePlugin ( const std::string &  locator,
const std::vector< std::string > &  cmd_line 
)
static

Tries to connect to the plugin at locator, or, if it doesn't exist, spawns a new plugin using cmdline. Two processes could try to spawn the plugin at the same time. In this case, the plugin should indicate to the client to retry connecting.

Definition at line 261 of file cache_extern.cc.

Referenced by FileSystem::SetupExternalCacheMgr().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements CacheManager.

Definition at line 298 of file cache_extern.cc.

string ExternalCacheManager::Describe ( )
virtual

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

Implements CacheManager.

Definition at line 309 of file cache_extern.cc.

bool ExternalCacheManager::DoFreeState ( void *  data)
protectedvirtual

Reimplemented from CacheManager.

Definition at line 314 of file cache_extern.cc.

int ExternalCacheManager::DoOpen ( const shash::Any id)
private

Definition at line 322 of file cache_extern.cc.

Referenced by Open().

Here is the call graph for this function:

Here is the caller graph for this function:

int ExternalCacheManager::DoRestoreState ( void *  data)
protectedvirtual

Reimplemented from CacheManager.

Definition at line 345 of file cache_extern.cc.

Here is the call graph for this function:

void * ExternalCacheManager::DoSaveState ( )
protectedvirtual

Reimplemented from CacheManager.

Definition at line 373 of file cache_extern.cc.

int ExternalCacheManager::Dup ( int  fd)
virtual

Implements CacheManager.

Definition at line 383 of file cache_extern.cc.

int ExternalCacheManager::Flush ( bool  do_commit,
Transaction transaction 
)
private

Definition at line 433 of file cache_extern.cc.

Referenced by OpenFromTxn(), and Write().

Here is the call graph for this function:

Here is the caller graph for this function:

ExternalCacheManager::FRIEND_TEST ( T_ExternalCacheManager  ,
TransactionAbort   
)
private
shash::Any ExternalCacheManager::GetHandle ( int  fd)
private

Definition at line 471 of file cache_extern.cc.

Referenced by GetSize(), Pread(), and Readahead().

Here is the caller graph for this function:

int64_t ExternalCacheManager::GetSize ( int  fd)
virtual

Implements CacheManager.

Definition at line 478 of file cache_extern.cc.

Here is the call graph for this function:

virtual CacheManagerIds ExternalCacheManager::id ( )
inlinevirtual

Implements CacheManager.

Definition at line 65 of file cache_extern.h.

manifest::Breadcrumb ExternalCacheManager::LoadBreadcrumb ( const std::string &  )
virtual

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 681 of file cache_extern.cc.

Here is the call graph for this function:

void * ExternalCacheManager::MainRead ( void *  data)
staticprivate

Definition at line 502 of file cache_extern.cc.

Referenced by Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t ExternalCacheManager::max_object_size ( ) const
inline

Definition at line 99 of file cache_extern.h.

int64_t ExternalCacheManager::NextRequestId ( )
inlineprivate
int ExternalCacheManager::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 575 of file cache_extern.cc.

Here is the call graph for this function:

int ExternalCacheManager::OpenFromTxn ( void *  txn)
virtual

Implements CacheManager.

Definition at line 580 of file cache_extern.cc.

Here is the call graph for this function:

pid_t ExternalCacheManager::pid_plugin ( ) const
inline

Definition at line 101 of file cache_extern.h.

Referenced by ExternalQuotaManager::GetPid().

Here is the caller graph for this function:

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

Implements CacheManager.

Definition at line 603 of file cache_extern.cc.

Here is the call graph for this function:

int ExternalCacheManager::Readahead ( int  fd)
virtual

Implements CacheManager.

Definition at line 645 of file cache_extern.cc.

Here is the call graph for this function:

int ExternalCacheManager::Reset ( void *  txn)
virtual

Implements CacheManager.

Definition at line 654 of file cache_extern.cc.

Here is the call graph for this function:

int64_t ExternalCacheManager::session_id ( ) const
inline

Definition at line 98 of file cache_extern.h.

virtual uint32_t ExternalCacheManager::SizeOfTxn ( )
inlinevirtual

Implements CacheManager.

Definition at line 79 of file cache_extern.h.

Here is the call graph for this function:

void ExternalCacheManager::Spawn ( )
virtual

Implements CacheManager.

Definition at line 739 of file cache_extern.cc.

Here is the call graph for this function:

bool ExternalCacheManager::SpawnPlugin ( const std::vector< std::string > &  cmd_line)
staticprivate

Returns true if the plugin could be spawned or was spawned by another process.

Definition at line 750 of file cache_extern.cc.

Here is the call graph for this function:

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

Implements CacheManager.

Definition at line 810 of file cache_extern.cc.

Here is the call graph for this function:

bool ExternalCacheManager::StoreBreadcrumb ( const manifest::Manifest manifest)
virtual

Reimplemented from CacheManager.

Definition at line 714 of file cache_extern.cc.

Here is the call graph for this function:

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

Implements CacheManager.

Definition at line 829 of file cache_extern.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class ExternalQuotaManager
friend

Definition at line 32 of file cache_extern.h.

Member Data Documentation

FdTable<ReadOnlyHandle> ExternalCacheManager::fd_table_
private

Definition at line 289 of file cache_extern.h.

Referenced by GetHandle(), and OpenFromTxn().

std::vector<RpcInFlight> ExternalCacheManager::inflight_rpcs_
private

Definition at line 302 of file cache_extern.h.

Referenced by MainRead().

const shash::Any ExternalCacheManager::kInvalidHandle
staticprivate

The null hash (hashed output is all null bytes) serves as a marker for an invalid handle

Definition at line 113 of file cache_extern.h.

Referenced by GetSize(), Pread(), and Readahead().

const unsigned ExternalCacheManager::kMaxSupportedObjectSize = 512 * 1024
staticprivate

Objects cannot be larger than 512 kB. Keeps transaction memory consumption under control.

Definition at line 118 of file cache_extern.h.

const unsigned ExternalCacheManager::kMinSupportedObjectSize = 4 * 1024
staticprivate

Statistically, at least half of our objects should not be further chunked.

Definition at line 122 of file cache_extern.h.

const unsigned ExternalCacheManager::kPbProtocolVersion = 1
static

Definition at line 35 of file cache_extern.h.

pthread_mutex_t ExternalCacheManager::lock_inflight_rpcs_
private

Definition at line 303 of file cache_extern.h.

Referenced by ExternalCacheManager(), MainRead(), and ~ExternalCacheManager().

pthread_mutex_t ExternalCacheManager::lock_send_fd_
private

Serialize concurrent write access to the session fd

Definition at line 301 of file cache_extern.h.

Referenced by ExternalCacheManager(), and ~ExternalCacheManager().

uint32_t ExternalCacheManager::max_object_size_
private

Definition at line 292 of file cache_extern.h.

Referenced by Create(), Flush(), MainRead(), max_object_size(), Pread(), SizeOfTxn(), StartTxn(), and Write().

atomic_int64 ExternalCacheManager::next_request_id_
private

Definition at line 296 of file cache_extern.h.

Referenced by ExternalCacheManager(), and NextRequestId().

pid_t ExternalCacheManager::pid_plugin_
private

Definition at line 288 of file cache_extern.h.

Referenced by Create(), and pid_plugin().

pthread_rwlock_t ExternalCacheManager::rwlock_fd_table_
private
bool ExternalCacheManager::spawned_
private

Definition at line 293 of file cache_extern.h.

Referenced by Spawn(), and ~ExternalCacheManager().

bool ExternalCacheManager::terminated_
private

Definition at line 294 of file cache_extern.h.

Referenced by MainRead(), and ~ExternalCacheManager().

pthread_t ExternalCacheManager::thread_read_
private

Definition at line 304 of file cache_extern.h.

Referenced by ExternalCacheManager(), Spawn(), and ~ExternalCacheManager().

CacheTransport ExternalCacheManager::transport_
private

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