forked from datastax/cpp-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
instruction_win_lin.txt.txt
41 lines (29 loc) · 2.92 KB
/
instruction_win_lin.txt.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Cassandra C++ driver: General Instructions
(with some Ubuntu- and Windows-specific info. For OS X please refer to macosx_instruction.txt)
----------------------------------------------------------------------------------------------------------------
1. How to build the project
- Dependencies: Boost (ver 1.41+), zlib, openssl, libssh2, cmake.
Boost.Log is helpful but not necessary.
- under Ubuntu LTS (Precise) or Debian Wheezy you can get them all with:
$> sudo apt-get install build-essential cmake libasio-dev libboost-system-dev libboost-thread-dev libboost-test-dev libboost-program-options-dev libboost-filesystem-dev libboost-log-dev libssh2-1-dev
- under CentOS/RHEL 6.4 you can get all the dependencies with:
$> sudo yum install gcc-c++ glibc glibc-devel boost boost-devel openssl openssl-devel libssh2 libssh2-devel zlib zlib-devel make cmake
- Under Windows Boost and libssh2 must be compiled manually. Zlib and openssl binaries are available from GnuWin project. Only the 32-bit version was tested. Please remember that whenever you wish to use dynamically linked libraries (DLLs), they must be located in right directory. For the 64-bit DLLs the right directoy is c:/Windows/System32 (sic) and the 32-bit ones in c:/windows/SysWOW64 (sic). You can also place them in situ (i.e. together with build products).
2. Random remarks
- As the IDE for Linux we recommend Eclipse with Git plugin.
- We use CppCheck to statically validate the code against c++03 standard.
- There exists a good (proprietary) plugin for VS2010: Visual Assist X. It makes IntelliSense work well with C++.
3. How it works?
- cql_cluster_t - This class holds the list of available hosts and creates new sessions. In addition, it creates a thread which is responsible for asynchronous I/O.
- cql_session_t - Session is a sequence of queries and responses to/from DB. It holds a list of active cql_connection_t's. Connections are created according to policies. Unused ones are moved to _trashcan, and then (if idle fo 10 minutes) closed.
- cql_connection_t - Single connection to the DB. It handles the options, exchanges START frames and provides authorization. A connection holds up to 128 virtual streams (cql_stream_t), so it can serve 128 concurrent queries. The class uses boost::asio for network I/O and returns responses by boost::promise.
4. Code Style:
- class names follow the general scheme "cql_xxx_yyy_t". The class "xxx_yyy" shall be put in files xxx_yyy.cpp and xxx_yyy.hpp.
- snake_case namespace names.
- snake_case method names and arguments.
- _snake_case class member fields (i.e. preceded with underscore).
- generics: template<class TMyParam, int Size>
- We recommend formatting with `astyle' command (Linux).
- No `using namespace ...' in header files. We avoid `using namespace' in general.
- Doxygen comments. Some day...
- For complex classes we use pimpl pattern with abstract base class.