CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CachePlugin Class Referenceabstract

#include <channel.h>

Inheritance diagram for CachePlugin:
Collaboration diagram for CachePlugin:

Classes

struct  Info
 
struct  ObjectInfo
 
class  SessionCtxGuard
 
struct  SessionInfo
 
struct  UniqueRequest
 

Public Member Functions

bool Listen (const std::string &locator)
 
virtual ~CachePlugin ()
 
void ProcessRequests (unsigned num_workers)
 
bool IsRunning ()
 
void Terminate ()
 
void WaitFor ()
 
void AskToDetach ()
 
unsigned max_object_size () const
 
uint64_t capabilities () const
 

Static Public Attributes

static const unsigned kPbProtocolVersion = 1
 
static const uint64_t kSizeUnknown = uint64_t(-1)
 

Protected Member Functions

 CachePlugin (uint64_t capabilities)
 
virtual cvmfs::EnumStatus ChangeRefcount (const shash::Any &id, int32_t change_by)=0
 
virtual cvmfs::EnumStatus GetObjectInfo (const shash::Any &id, ObjectInfo *info)=0
 
virtual cvmfs::EnumStatus Pread (const shash::Any &id, uint64_t offset, uint32_t *size, unsigned char *buffer)=0
 
virtual cvmfs::EnumStatus StartTxn (const shash::Any &id, const uint64_t txn_id, const ObjectInfo &info)=0
 
virtual cvmfs::EnumStatus WriteTxn (const uint64_t txn_id, unsigned char *buffer, uint32_t size)=0
 
virtual cvmfs::EnumStatus AbortTxn (const uint64_t txn_id)=0
 
virtual cvmfs::EnumStatus CommitTxn (const uint64_t txn_id)=0
 
virtual cvmfs::EnumStatus GetInfo (Info *info)=0
 
virtual cvmfs::EnumStatus Shrink (uint64_t shrink_to, uint64_t *used_bytes)=0
 
virtual cvmfs::EnumStatus ListingBegin (uint64_t lst_id, cvmfs::EnumObjectType type)=0
 
virtual cvmfs::EnumStatus ListingNext (int64_t lst_id, ObjectInfo *item)=0
 
virtual cvmfs::EnumStatus ListingEnd (int64_t lst_id)=0
 
virtual cvmfs::EnumStatus LoadBreadcrumb (const std::string &fqrn, manifest::Breadcrumb *breadcrumb)=0
 
virtual cvmfs::EnumStatus StoreBreadcrumb (const std::string &fqrn, const manifest::Breadcrumb &breadcrumb)=0
 

Private Member Functions

uint64_t NextSessionId ()
 
uint64_t NextTxnId ()
 
uint64_t NextLstId ()
 
bool HandleRequest (int fd_con)
 
void HandleHandshake (cvmfs::MsgHandshake *msg_req, CacheTransport *transport)
 
void HandleRefcount (cvmfs::MsgRefcountReq *msg_req, CacheTransport *transport)
 
void HandleObjectInfo (cvmfs::MsgObjectInfoReq *msg_req, CacheTransport *transport)
 
void HandleRead (cvmfs::MsgReadReq *msg_req, CacheTransport *transport)
 
void HandleStore (cvmfs::MsgStoreReq *msg_req, CacheTransport::Frame *frame, CacheTransport *transport)
 
void HandleStoreAbort (cvmfs::MsgStoreAbortReq *msg_req, CacheTransport *transport)
 
void HandleInfo (cvmfs::MsgInfoReq *msg_req, CacheTransport *transport)
 
void HandleShrink (cvmfs::MsgShrinkReq *msg_req, CacheTransport *transport)
 
void HandleList (cvmfs::MsgListReq *msg_req, CacheTransport *transport)
 
void HandleBreadcrumbStore (cvmfs::MsgBreadcrumbStoreReq *msg_req, CacheTransport *transport)
 
void HandleBreadcrumbLoad (cvmfs::MsgBreadcrumbLoadReq *msg_req, CacheTransport *transport)
 
void HandleIoctl (cvmfs::MsgIoctl *msg_req)
 
void SendDetachRequests ()
 
void NotifySupervisor (char signal)
 
void LogSessionError (uint64_t session_id, cvmfs::EnumStatus status, const std::string &msg)
 
void LogSessionInfo (uint64_t session_id, const std::string &msg)
 

Static Private Member Functions

static void * MainProcessRequests (void *data)
 
static uint32_t HashUniqueRequest (const UniqueRequest &req)
 

Private Attributes

bool is_local_
 
uint64_t capabilities_
 
int fd_socket_
 
int fd_socket_lock_
 
atomic_int32 running_
 
unsigned num_workers_
 
unsigned max_object_size_
 
uint64_t num_inlimbo_clients_
 
std::string name_
 
atomic_int64 next_session_id_
 
atomic_int64 next_txn_id_
 
atomic_int64 next_lst_id_
 
SmallHashDynamic
< UniqueRequest, uint64_t > 
txn_ids_
 
std::set< int > connections_
 
std::map< uint64_t, SessionInfosessions_
 
pthread_t thread_io_
 
int pipe_ctrl_ [2]
 

Static Private Attributes

static const unsigned kDefaultMaxObjectSize = 256 * 1024
 
static const unsigned kListingSize = 4 * 1024 * 1024
 
static const char kSignalTerminate = 'q'
 
static const char kSignalDetach = 'd'
 

Detailed Description

Definition at line 68 of file channel.h.

Constructor & Destructor Documentation

CachePlugin::~CachePlugin ( )
virtual

Definition at line 190 of file channel.cc.

Here is the call graph for this function:

CachePlugin::CachePlugin ( uint64_t  capabilities)
explicitprotected

Definition at line 169 of file channel.cc.

Here is the call graph for this function:

Member Function Documentation

virtual cvmfs::EnumStatus CachePlugin::AbortTxn ( const uint64_t  txn_id)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleStoreAbort().

Here is the caller graph for this function:

void CachePlugin::AskToDetach ( )

Definition at line 163 of file channel.cc.

Here is the call graph for this function:

uint64_t CachePlugin::capabilities ( ) const
inline

Definition at line 103 of file channel.h.

virtual cvmfs::EnumStatus CachePlugin::ChangeRefcount ( const shash::Any id,
int32_t  change_by 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleRefcount().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::CommitTxn ( const uint64_t  txn_id)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleStore().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::GetInfo ( Info info)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleInfo().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::GetObjectInfo ( const shash::Any id,
ObjectInfo info 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleObjectInfo().

Here is the caller graph for this function:

void CachePlugin::HandleBreadcrumbLoad ( cvmfs::MsgBreadcrumbLoadReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 226 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleBreadcrumbStore ( cvmfs::MsgBreadcrumbStoreReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 200 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleHandshake ( cvmfs::MsgHandshake *  msg_req,
CacheTransport transport 
)
private

Definition at line 253 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleInfo ( cvmfs::MsgInfoReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 279 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleIoctl ( cvmfs::MsgIoctl *  msg_req)
private

Definition at line 303 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleList ( cvmfs::MsgListReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 321 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleObjectInfo ( cvmfs::MsgObjectInfoReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 377 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleRead ( cvmfs::MsgReadReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 408 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleRefcount ( cvmfs::MsgRefcountReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 447 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CachePlugin::HandleRequest ( int  fd_con)
private

Definition at line 474 of file channel.cc.

Referenced by MainProcessRequests().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleShrink ( cvmfs::MsgShrinkReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 555 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleStore ( cvmfs::MsgStoreReq *  msg_req,
CacheTransport::Frame frame,
CacheTransport transport 
)
private

Definition at line 604 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::HandleStoreAbort ( cvmfs::MsgStoreAbortReq *  msg_req,
CacheTransport transport 
)
private

Definition at line 575 of file channel.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

static uint32_t CachePlugin::HashUniqueRequest ( const UniqueRequest req)
inlinestaticprivate

Definition at line 213 of file channel.h.

Referenced by CachePlugin().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CachePlugin::IsRunning ( )

Definition at line 690 of file channel.cc.

Referenced by Terminate(), and WaitFor().

Here is the caller graph for this function:

bool CachePlugin::Listen ( const std::string &  locator)

Definition at line 695 of file channel.cc.

Here is the call graph for this function:

virtual cvmfs::EnumStatus CachePlugin::ListingBegin ( uint64_t  lst_id,
cvmfs::EnumObjectType  type 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleList().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::ListingEnd ( int64_t  lst_id)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleList().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::ListingNext ( int64_t  lst_id,
ObjectInfo item 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleList().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::LoadBreadcrumb ( const std::string &  fqrn,
manifest::Breadcrumb breadcrumb 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleBreadcrumbLoad().

Here is the caller graph for this function:

void CachePlugin::LogSessionError ( uint64_t  session_id,
cvmfs::EnumStatus  status,
const std::string &  msg 
)
private

Definition at line 763 of file channel.cc.

Referenced by HandleBreadcrumbStore(), HandleInfo(), HandleIoctl(), HandleList(), HandleObjectInfo(), HandleRead(), HandleRefcount(), HandleShrink(), HandleStore(), and HandleStoreAbort().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::LogSessionInfo ( uint64_t  session_id,
const std::string &  msg 
)
private

Definition at line 752 of file channel.cc.

Referenced by HandleIoctl().

Here is the call graph for this function:

Here is the caller graph for this function:

void * CachePlugin::MainProcessRequests ( void *  data)
staticprivate

Definition at line 780 of file channel.cc.

Referenced by ProcessRequests().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned CachePlugin::max_object_size ( ) const
inline

Definition at line 102 of file channel.h.

uint64_t CachePlugin::NextLstId ( )
inlineprivate

Definition at line 210 of file channel.h.

Referenced by HandleList().

Here is the caller graph for this function:

uint64_t CachePlugin::NextSessionId ( )
inlineprivate

Definition at line 204 of file channel.h.

Referenced by HandleHandshake().

Here is the caller graph for this function:

uint64_t CachePlugin::NextTxnId ( )
inlineprivate

Definition at line 207 of file channel.h.

Referenced by HandleStore().

Here is the caller graph for this function:

void CachePlugin::NotifySupervisor ( char  signal)
private

Used during startup to synchronize with the cvmfs client.

Definition at line 882 of file channel.cc.

Referenced by Listen(), and ProcessRequests().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::Pread ( const shash::Any id,
uint64_t  offset,
uint32_t *  size,
unsigned char *  buffer 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleRead().

Here is the caller graph for this function:

void CachePlugin::ProcessRequests ( unsigned  num_workers)

Definition at line 891 of file channel.cc.

Here is the call graph for this function:

void CachePlugin::SendDetachRequests ( )
private

Definition at line 900 of file channel.cc.

Referenced by MainProcessRequests().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::Shrink ( uint64_t  shrink_to,
uint64_t *  used_bytes 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleShrink().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::StartTxn ( const shash::Any id,
const uint64_t  txn_id,
const ObjectInfo info 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleStore().

Here is the caller graph for this function:

virtual cvmfs::EnumStatus CachePlugin::StoreBreadcrumb ( const std::string &  fqrn,
const manifest::Breadcrumb breadcrumb 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleBreadcrumbStore().

Here is the caller graph for this function:

void CachePlugin::Terminate ( )

Definition at line 914 of file channel.cc.

Referenced by ~CachePlugin().

Here is the call graph for this function:

Here is the caller graph for this function:

void CachePlugin::WaitFor ( )

Definition at line 924 of file channel.cc.

Here is the call graph for this function:

virtual cvmfs::EnumStatus CachePlugin::WriteTxn ( const uint64_t  txn_id,
unsigned char *  buffer,
uint32_t  size 
)
protectedpure virtual

Implemented in anonymous_namespace{libcvmfs_cache.cc}::ForwardCachePlugin.

Referenced by HandleStore().

Here is the caller graph for this function:

Member Data Documentation

uint64_t CachePlugin::capabilities_
private

Definition at line 249 of file channel.h.

Referenced by capabilities(), and HandleHandshake().

std::set<int> CachePlugin::connections_
private

Definition at line 265 of file channel.h.

Referenced by MainProcessRequests(), and SendDetachRequests().

int CachePlugin::fd_socket_
private

Definition at line 250 of file channel.h.

Referenced by Listen(), MainProcessRequests(), and ~CachePlugin().

int CachePlugin::fd_socket_lock_
private

Definition at line 251 of file channel.h.

Referenced by Listen(), and ~CachePlugin().

bool CachePlugin::is_local_
private

Definition at line 248 of file channel.h.

Referenced by HandleHandshake(), and Listen().

const unsigned CachePlugin::kDefaultMaxObjectSize = 256 * 1024
staticprivate

Definition at line 140 of file channel.h.

const unsigned CachePlugin::kListingSize = 4 * 1024 * 1024
staticprivate

Definition at line 141 of file channel.h.

Referenced by HandleList().

const unsigned CachePlugin::kPbProtocolVersion = 1
static

Definition at line 70 of file channel.h.

Referenced by HandleHandshake().

const char CachePlugin::kSignalDetach = 'd'
staticprivate

Definition at line 143 of file channel.h.

Referenced by AskToDetach(), and MainProcessRequests().

const char CachePlugin::kSignalTerminate = 'q'
staticprivate

Definition at line 142 of file channel.h.

Referenced by Terminate().

const uint64_t CachePlugin::kSizeUnknown = uint64_t(-1)
static
unsigned CachePlugin::max_object_size_
private

Definition at line 254 of file channel.h.

Referenced by HandleHandshake(), HandleRead(), HandleRequest(), HandleStore(), and max_object_size().

std::string CachePlugin::name_
private

Definition at line 260 of file channel.h.

Referenced by HandleHandshake().

atomic_int64 CachePlugin::next_lst_id_
private

Definition at line 263 of file channel.h.

Referenced by CachePlugin(), and NextLstId().

atomic_int64 CachePlugin::next_session_id_
private

Definition at line 261 of file channel.h.

Referenced by CachePlugin(), and NextSessionId().

atomic_int64 CachePlugin::next_txn_id_
private

Definition at line 262 of file channel.h.

Referenced by CachePlugin(), and NextTxnId().

uint64_t CachePlugin::num_inlimbo_clients_
private

Number of clients undergoing a reload, i.e. they promise to come back and open a new connection soon.

Definition at line 259 of file channel.h.

Referenced by HandleIoctl(), and MainProcessRequests().

unsigned CachePlugin::num_workers_
private

Definition at line 253 of file channel.h.

Referenced by ProcessRequests().

int CachePlugin::pipe_ctrl_[2]
private

Definition at line 268 of file channel.h.

Referenced by AskToDetach(), CachePlugin(), MainProcessRequests(), Terminate(), and ~CachePlugin().

atomic_int32 CachePlugin::running_
private

Definition at line 252 of file channel.h.

Referenced by IsRunning(), ProcessRequests(), and Terminate().

std::map<uint64_t, SessionInfo> CachePlugin::sessions_
private
pthread_t CachePlugin::thread_io_
private

Definition at line 267 of file channel.h.

Referenced by CachePlugin(), ProcessRequests(), Terminate(), and WaitFor().

SmallHashDynamic<UniqueRequest, uint64_t> CachePlugin::txn_ids_
private

Definition at line 264 of file channel.h.

Referenced by CachePlugin(), HandleStore(), HandleStoreAbort(), and MainProcessRequests().


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