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

#include <cache_transport.h>

Classes

class  Frame
 

Public Member Functions

 CacheTransport (int fd_connection)
 
 CacheTransport (int fd_connection, uint32_t flags)
 
 ~CacheTransport ()
 
void SendFrame (Frame *frame)
 
bool RecvFrame (Frame *frame)
 
void FillMsgHash (const shash::Any &hash, cvmfs::MsgHash *msg_hash)
 
bool ParseMsgHash (const cvmfs::MsgHash &msg_hash, shash::Any *hash)
 
void FillObjectType (int object_flags, cvmfs::EnumObjectType *wire_type)
 
bool ParseObjectType (cvmfs::EnumObjectType wire_type, int *object_flags)
 
int fd_connection () const
 

Static Public Attributes

static const char * kEnvReadyNotifyFd
 
static const char kReadyNotification = 'C'
 
static const char kFailureNotification = 'F'
 
static const unsigned char kWireProtocolVersion = 0x01
 
static const unsigned char kFlagHasAttachment = 0x80
 
static const uint32_t kMaxMsgSize = (2 << 24) - 1
 
static const unsigned kHeaderSize = 4
 
static const unsigned kInnerHeaderSize = 2
 
static const uint32_t kFlagSendIgnoreFailure = 0x01
 
static const uint32_t kFlagSendNonBlocking = 0x02
 

Private Member Functions

void SendData (void *message, uint32_t msg_size, void *attachment=NULL, uint32_t att_size=0)
 
void SendNonBlocking (struct iovec *iov, unsigned iovcnt)
 
bool RecvHeader (uint32_t *size, bool *has_attachment)
 

Private Attributes

int fd_connection_
 
uint32_t flags_
 

Static Private Attributes

static const unsigned kMaxStackAlloc = 256 * 1024
 

Detailed Description

Sending and receiving with a file descriptor. Does not take the ownership of the file descriptor.

Definition at line 45 of file cache_transport.h.

Constructor & Destructor Documentation

CacheTransport::CacheTransport ( int  fd_connection)
explicit

Definition at line 286 of file cache_transport.cc.

Here is the call graph for this function:

CacheTransport::CacheTransport ( int  fd_connection,
uint32_t  flags 
)

Definition at line 294 of file cache_transport.cc.

Here is the call graph for this function:

CacheTransport::~CacheTransport ( )
inline

Definition at line 137 of file cache_transport.h.

Member Function Documentation

int CacheTransport::fd_connection ( ) const
inline

Definition at line 147 of file cache_transport.h.

Referenced by ExternalCacheManager::~ExternalCacheManager().

Here is the caller graph for this function:

void CacheTransport::FillMsgHash ( const shash::Any hash,
cvmfs::MsgHash *  msg_hash 
)
void CacheTransport::FillObjectType ( int  object_flags,
cvmfs::EnumObjectType *  wire_type 
)

Definition at line 323 of file cache_transport.cc.

Referenced by ExternalCacheManager::Flush().

Here is the caller graph for this function:

bool CacheTransport::ParseMsgHash ( const cvmfs::MsgHash &  msg_hash,
shash::Any hash 
)
bool CacheTransport::ParseObjectType ( cvmfs::EnumObjectType  wire_type,
int *  object_flags 
)

Definition at line 359 of file cache_transport.cc.

bool CacheTransport::RecvFrame ( CacheTransport::Frame frame)

Definition at line 378 of file cache_transport.cc.

Referenced by ExternalCacheManager::Create(), CachePlugin::HandleRequest(), and ExternalCacheManager::MainRead().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CacheTransport::RecvHeader ( uint32_t *  size,
bool *  has_attachment 
)
private

Definition at line 439 of file cache_transport.cc.

Referenced by RecvFrame().

Here is the call graph for this function:

Here is the caller graph for this function:

void CacheTransport::SendData ( void *  message,
uint32_t  msg_size,
void *  attachment = NULL,
uint32_t  att_size = 0 
)
private

Definition at line 452 of file cache_transport.cc.

Referenced by SendFrame().

Here is the call graph for this function:

Here is the caller graph for this function:

void CacheTransport::SendNonBlocking ( struct iovec *  iov,
unsigned  iovcnt 
)
private

Definition at line 504 of file cache_transport.cc.

Referenced by SendData().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int CacheTransport::fd_connection_
private
uint32_t CacheTransport::flags_
private

Definition at line 160 of file cache_transport.h.

Referenced by SendData(), and SendNonBlocking().

const char * CacheTransport::kEnvReadyNotifyFd
static
Initial value:
=
"__CVMFS_CACHE_EXTERNAL_PIPE_READY__"

When this environment variable is set, the plugin will notify a cvmfs client once it is ready to accept connections.

Definition at line 51 of file cache_transport.h.

Referenced by cvmcache_is_supervised(), CachePlugin::Listen(), CachePlugin::MainProcessRequests(), CachePlugin::NotifySupervisor(), and ExternalCacheManager::SpawnPlugin().

const char CacheTransport::kFailureNotification = 'F'
static

Definition at line 53 of file cache_transport.h.

Referenced by CachePlugin::Listen().

const unsigned char CacheTransport::kFlagHasAttachment = 0x80
static

This is or-ed to the version number if the message has an attachment. In this case, the 2 bytes after the header specify the size of the protobuf message alone.

Definition at line 64 of file cache_transport.h.

Referenced by RecvHeader(), and SendData().

const uint32_t CacheTransport::kFlagSendIgnoreFailure = 0x01
static
const uint32_t CacheTransport::kFlagSendNonBlocking = 0x02
static

Definition at line 83 of file cache_transport.h.

Referenced by SendData(), and CachePlugin::SendDetachRequests().

const unsigned CacheTransport::kHeaderSize = 4
static

The first byte has the wire protocol version, optionally or-ed with the "has attachment" flag. The other three bytes encode the overall message size in little-endian.

Definition at line 74 of file cache_transport.h.

Referenced by RecvHeader(), and SendData().

const unsigned CacheTransport::kInnerHeaderSize = 2
static

The "inner header" are two byte following the header. The two bytes encode in little-endian the size of the protobuf message alone, if there is an attachment. The inner header is only present if there is an attachment.

Definition at line 80 of file cache_transport.h.

Referenced by RecvFrame(), and SendData().

const uint32_t CacheTransport::kMaxMsgSize = (2 << 24) - 1
static

Maximum size of the protobuf message and the attachment, should it exist.

Definition at line 68 of file cache_transport.h.

Referenced by RecvHeader(), and SendData().

const unsigned CacheTransport::kMaxStackAlloc = 256 * 1024
staticprivate

Definition at line 150 of file cache_transport.h.

Referenced by RecvFrame().

const char CacheTransport::kReadyNotification = 'C'
static
const unsigned char CacheTransport::kWireProtocolVersion = 0x01
static

Version of the wire protocol. The effective protocol version is negotiated through the handshake.

Definition at line 58 of file cache_transport.h.

Referenced by RecvHeader(), and SendData().


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