![]() |
CernVM-FS
2.13.0
|
#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 = "__CVMFS_CACHE_EXTERNAL_PIPE_READY__" |
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 |
Sending and receiving with a file descriptor. Does not take the ownership of the file descriptor.
Definition at line 56 of file cache_transport.h.
|
explicit |
CacheTransport::CacheTransport | ( | int | fd_connection, |
uint32_t | flags | ||
) |
|
inline |
Definition at line 148 of file cache_transport.h.
|
inline |
Definition at line 158 of file cache_transport.h.
Referenced by ExternalCacheManager::~ExternalCacheManager().
void CacheTransport::FillMsgHash | ( | const shash::Any & | hash, |
cvmfs::MsgHash * | msg_hash | ||
) |
Definition at line 294 of file cache_transport.cc.
Referenced by ExternalCacheManager::Flush(), ExternalCacheManager::GetSize(), CachePlugin::HandleBreadcrumbLoad(), CachePlugin::HandleList(), ExternalCacheManager::Pread(), ExternalCacheManager::Reset(), and ExternalCacheManager::StoreBreadcrumb().
void CacheTransport::FillObjectType | ( | int | object_flags, |
cvmfs::EnumObjectType * | wire_type | ||
) |
Definition at line 313 of file cache_transport.cc.
Referenced by ExternalCacheManager::Flush().
bool CacheTransport::ParseMsgHash | ( | const cvmfs::MsgHash & | msg_hash, |
shash::Any * | hash | ||
) |
Definition at line 323 of file cache_transport.cc.
Referenced by CachePlugin::HandleBreadcrumbStore(), CachePlugin::HandleObjectInfo(), CachePlugin::HandleRead(), CachePlugin::HandleRefcount(), CachePlugin::HandleStore(), and ExternalCacheManager::LoadBreadcrumb().
bool CacheTransport::ParseObjectType | ( | cvmfs::EnumObjectType | wire_type, |
int * | object_flags | ||
) |
Definition at line 346 of file cache_transport.cc.
bool CacheTransport::RecvFrame | ( | CacheTransport::Frame * | frame | ) |
Definition at line 364 of file cache_transport.cc.
Referenced by ExternalCacheManager::Create(), CachePlugin::HandleRequest(), and ExternalCacheManager::MainRead().
|
private |
Definition at line 437 of file cache_transport.cc.
Referenced by RecvFrame().
|
private |
Definition at line 450 of file cache_transport.cc.
Referenced by SendFrame().
void CacheTransport::SendFrame | ( | CacheTransport::Frame * | frame | ) |
Definition at line 525 of file cache_transport.cc.
Referenced by ExternalCacheManager::Create(), CachePlugin::HandleBreadcrumbLoad(), CachePlugin::HandleBreadcrumbStore(), CachePlugin::HandleHandshake(), CachePlugin::HandleInfo(), CachePlugin::HandleList(), CachePlugin::HandleObjectInfo(), CachePlugin::HandleRead(), CachePlugin::HandleRefcount(), CachePlugin::HandleShrink(), CachePlugin::HandleStore(), CachePlugin::HandleStoreAbort(), CachePlugin::SendDetachRequests(), and ExternalCacheManager::~ExternalCacheManager().
|
private |
Definition at line 500 of file cache_transport.cc.
Referenced by SendData().
|
private |
Definition at line 170 of file cache_transport.h.
Referenced by CacheTransport(), fd_connection(), RecvFrame(), RecvHeader(), SendData(), and SendNonBlocking().
|
private |
Definition at line 171 of file cache_transport.h.
Referenced by SendData(), and SendNonBlocking().
|
static |
When this environment variable is set, the plugin will notify a cvmfs client once it is ready to accept connections.
Definition at line 62 of file cache_transport.h.
Referenced by cvmcache_is_supervised(), CachePlugin::Listen(), CachePlugin::MainProcessRequests(), CachePlugin::NotifySupervisor(), and ExternalCacheManager::SpawnPlugin().
|
static |
Definition at line 64 of file cache_transport.h.
Referenced by CachePlugin::Listen().
|
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 75 of file cache_transport.h.
Referenced by RecvHeader(), and SendData().
|
static |
Definition at line 93 of file cache_transport.h.
Referenced by CachePlugin::HandleRequest(), SendData(), CachePlugin::SendDetachRequests(), and SendNonBlocking().
|
static |
Definition at line 94 of file cache_transport.h.
Referenced by SendData(), and CachePlugin::SendDetachRequests().
|
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 85 of file cache_transport.h.
Referenced by RecvHeader(), and SendData().
|
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 91 of file cache_transport.h.
Referenced by RecvFrame(), and SendData().
|
static |
Maximum size of the protobuf message and the attachment, should it exist.
Definition at line 79 of file cache_transport.h.
Referenced by RecvHeader(), and SendData().
|
staticprivate |
Definition at line 161 of file cache_transport.h.
Referenced by RecvFrame().
|
static |
Definition at line 63 of file cache_transport.h.
Referenced by CachePlugin::Listen(), CachePlugin::ProcessRequests(), and ExternalCacheManager::SpawnPlugin().
|
static |
Version of the wire protocol. The effective protocol version is negotiated through the handshake.
Definition at line 69 of file cache_transport.h.
Referenced by RecvHeader(), and SendData().