1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -32,27 +32,39 @@
class MessageQTestSuite;
namespace messageqcpp
namespace messageqcpp
{
class IOSocket;
class SocketParms;
// Might want to expand on this / derive from it to include things like uncompressed
// Might want to expand on this / derive from it to include things like uncompressed
// data size, etc...
class Stats
{
public:
Stats() : data_sent(0), data_recvd(0)
{ }
virtual ~Stats() { }
virtual uint64_t dataSent() { return data_sent; }
virtual uint64_t dataRecvd() { return data_recvd; }
virtual void dataSent(uint64_t amt) { data_sent += amt; }
virtual void dataRecvd(uint64_t amt) { data_recvd += amt; }
public:
Stats() : data_sent(0), data_recvd(0)
{ }
virtual ~Stats() { }
virtual uint64_t dataSent()
{
return data_sent;
}
virtual uint64_t dataRecvd()
{
return data_recvd;
}
virtual void dataSent(uint64_t amt)
{
data_sent += amt;
}
virtual void dataRecvd(uint64_t amt)
{
data_recvd += amt;
}
private:
uint64_t data_sent;
uint64_t data_recvd;
uint64_t data_sent;
uint64_t data_recvd;
};
/** an abstract socket class interface
@ -61,110 +73,110 @@ private:
class Socket
{
public:
/** dtor
*
*/
virtual ~Socket() {}
/** dtor
*
*/
virtual ~Socket() {}
/** open the socket
*
*/
virtual void open() = 0;
/** open the socket
*
*/
virtual void open() = 0;
/** read a message from the socket
*
* wait for and return a message from the socket. The deafult timeout waits forever. Note that
* eventhough struct timespec has nanosecond resolution, this method only has millisecond resolution.
*/
virtual const SBS read(const struct timespec* timeout=0, bool* isTimeOut = NULL, Stats *stats = NULL) const = 0;
/** read a message from the socket
*
* wait for and return a message from the socket. The deafult timeout waits forever. Note that
* eventhough struct timespec has nanosecond resolution, this method only has millisecond resolution.
*/
virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL, Stats* stats = NULL) const = 0;
/** write a message to the socket
*
* write a message to the socket
*/
virtual void write(const ByteStream& msg, Stats *stats = NULL) = 0;
virtual void write_raw(const ByteStream& msg, Stats *stats = NULL) const = 0;
virtual void write(SBS msg, Stats *stats = NULL) = 0;
/** write a message to the socket
*
* write a message to the socket
*/
virtual void write(const ByteStream& msg, Stats* stats = NULL) = 0;
virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const = 0;
virtual void write(SBS msg, Stats* stats = NULL) = 0;
/** close the socket
*
*/
virtual void close() = 0;
/** close the socket
*
*/
virtual void close() = 0;
/** bind to a port
*
*/
virtual void bind(const struct sockaddr* serv_addr) = 0;
/** bind to a port
*
*/
virtual void bind(const struct sockaddr* serv_addr) = 0;
/** listen for connections
*
*/
virtual void listen(int backlog=5) = 0;
/** listen for connections
*
*/
virtual void listen(int backlog = 5) = 0;
/** return an (accepted) IOSocket ready for I/O
*
*/
virtual const IOSocket accept(const struct timespec* timeout=0) = 0;
/** return an (accepted) IOSocket ready for I/O
*
*/
virtual const IOSocket accept(const struct timespec* timeout = 0) = 0;
/** connect to a server socket
*
*/
virtual void connect(const sockaddr* serv_addr) = 0;
/** connect to a server socket
*
*/
virtual void connect(const sockaddr* serv_addr) = 0;
/** test if this socket is open
*
*/
virtual const bool isOpen() const = 0;
/** test if this socket is open
*
*/
virtual const bool isOpen() const = 0;
/** get the SocketParms
*
*/
virtual const SocketParms socketParms() const = 0;
/** get the SocketParms
*
*/
virtual const SocketParms socketParms() const = 0;
/** set the SocketParms
*
*/
virtual void socketParms(const SocketParms& socketParms) = 0;
/** set the SocketParms
*
*/
virtual void socketParms(const SocketParms& socketParms) = 0;
/** set the sockaddr struct
*
*/
virtual void sa(const sockaddr* sa) = 0;
/** set the sockaddr struct
*
*/
virtual void sa(const sockaddr* sa) = 0;
/** dynamically allocate a copy of this object
*
*/
virtual Socket* clone() const = 0;
/** dynamically allocate a copy of this object
*
*/
virtual Socket* clone() const = 0;
/** set the connection timeout (in ms)
*
*/
virtual void connectionTimeout(const struct ::timespec* timeout) = 0;
/** set the connection timeout (in ms)
*
*/
virtual void connectionTimeout(const struct ::timespec* timeout) = 0;
/** set the connection protocol to be synchronous
*
*/
virtual void syncProto(bool use) = 0;
/** set the connection protocol to be synchronous
*
*/
virtual void syncProto(bool use) = 0;
virtual const int getConnectionNum() const = 0;
virtual const int getConnectionNum() const = 0;
/** return the address as a string
*
*/
virtual const std::string addr2String() const = 0;
/** return the address as a string
*
*/
virtual const std::string addr2String() const = 0;
/** compare 2 addresses
*
*/
virtual const bool isSameAddr(const Socket* rhs) const = 0;
/** compare 2 addresses
*
*/
virtual const bool isSameAddr(const Socket* rhs) const = 0;
virtual bool isConnected() const = 0;
virtual bool isConnected() const = 0;
virtual bool hasData() const = 0;
/*
* allow test suite access to private data for OOB test
*/
friend class ::MessageQTestSuite;
/*
* allow test suite access to private data for OOB test
*/
friend class ::MessageQTestSuite;
};