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

#include <reactor.h>

Public Types

enum  Request {
  kQuit = 0, kEcho, kGenerateToken, kGetTokenId,
  kCheckToken, kSubmitPayload, kCommit, kError,
  kTestCrash
}
 

Public Member Functions

 Reactor (int fdin, int fdout)
 
virtual ~Reactor ()
 
bool Run ()
 

Static Public Member Functions

static Request ReadRequest (int fd, std::string *data)
 
static bool WriteRequest (int fd, Request req, const std::string &data)
 
static bool ReadReply (int fd, std::string *data)
 
static bool WriteReply (int fd, const std::string &data)
 
static bool ExtractStatsFromReq (JsonDocument *req, perf::Statistics *stats, std::string *start_time)
 

Protected Member Functions

virtual bool HandleGenerateToken (const std::string &req, std::string *reply)
 
virtual bool HandleGetTokenId (const std::string &req, std::string *reply)
 
virtual bool HandleCheckToken (const std::string &req, std::string *reply)
 
virtual bool HandleSubmitPayload (int fdin, const std::string &req, std::string *reply)
 
virtual bool HandleCommit (const std::string &req, std::string *reply)
 
virtual PayloadProcessorMakePayloadProcessor ()
 
virtual CommitProcessorMakeCommitProcessor ()
 

Private Member Functions

bool HandleRequest (Request req, const std::string &data)
 

Private Attributes

int fdin_
 
int fdout_
 
std::map< std::string,
perf::Statistics * > 
statistics_map_
 

Detailed Description

This is the main event loop of the cvmfs_receiver program.

It implements a synchronous protocol, reading JSON requests from the fdin_ file descriptor and writing JSON responses to fdout_. It handles the framing of the protocol and the dispatching of the different types of events to specific handler methods.

Definition at line 28 of file reactor.h.

Member Enumeration Documentation

Enumerator
kQuit 
kEcho 
kGenerateToken 
kGetTokenId 
kCheckToken 
kSubmitPayload 
kCommit 
kError 
kTestCrash 

Definition at line 30 of file reactor.h.

Constructor & Destructor Documentation

receiver::Reactor::Reactor ( int  fdin,
int  fdout 
)

Definition at line 176 of file reactor.cc.

receiver::Reactor::~Reactor ( )
virtual

Definition at line 178 of file reactor.cc.

Member Function Documentation

bool receiver::Reactor::ExtractStatsFromReq ( JsonDocument req,
perf::Statistics stats,
std::string *  start_time 
)
static

Definition at line 122 of file reactor.cc.

Referenced by HandleCommit().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::HandleCheckToken ( const std::string &  req,
std::string *  reply 
)
protectedvirtual

Definition at line 262 of file reactor.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::HandleCommit ( const std::string &  req,
std::string *  reply 
)
protectedvirtual

Definition at line 389 of file reactor.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::HandleGenerateToken ( const std::string &  req,
std::string *  reply 
)
protectedvirtual

Definition at line 196 of file reactor.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::HandleGetTokenId ( const std::string &  req,
std::string *  reply 
)
protectedvirtual

Definition at line 242 of file reactor.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::HandleRequest ( Request  req,
const std::string &  data 
)
private

Definition at line 480 of file reactor.cc.

Referenced by Run().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::HandleSubmitPayload ( int  fdin,
const std::string &  req,
std::string *  reply 
)
protectedvirtual

Definition at line 319 of file reactor.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

CommitProcessor * receiver::Reactor::MakeCommitProcessor ( )
protectedvirtual

Definition at line 476 of file reactor.cc.

Referenced by HandleCommit().

Here is the caller graph for this function:

PayloadProcessor * receiver::Reactor::MakePayloadProcessor ( )
protectedvirtual

Definition at line 472 of file reactor.cc.

Referenced by HandleSubmitPayload().

Here is the caller graph for this function:

bool receiver::Reactor::ReadReply ( int  fd,
std::string *  data 
)
static

Definition at line 87 of file reactor.cc.

Here is the call graph for this function:

Reactor::Request receiver::Reactor::ReadRequest ( int  fd,
std::string *  data 
)
static

Definition at line 37 of file reactor.cc.

Referenced by Run().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::Run ( )

Definition at line 180 of file reactor.cc.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::WriteReply ( int  fd,
const std::string &  data 
)
static

Definition at line 107 of file reactor.cc.

Referenced by HandleRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

bool receiver::Reactor::WriteRequest ( int  fd,
Request  req,
const std::string &  data 
)
static

Definition at line 71 of file reactor.cc.

Here is the call graph for this function:

Member Data Documentation

int receiver::Reactor::fdin_
private

Definition at line 73 of file reactor.h.

Referenced by HandleRequest(), and Run().

int receiver::Reactor::fdout_
private

Definition at line 74 of file reactor.h.

Referenced by HandleRequest().

std::map<std::string, perf::Statistics*> receiver::Reactor::statistics_map_
private

Definition at line 76 of file reactor.h.


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