We have not yet provided a newer version (0.6) but we changed the code quite a bit to do two things:
1) make use of CQL instead of thrift
2) have an intermediate proxy so the website system can connect to the proxy, really fast, instead of directly connecting to ONE Cassandra node which could be dead at that time (i.e. the proxy can connect to any number of nodes at leisure and let you free of dealing with that problem.) What this gives a snap_child process is the ability to connect to one place and get database answers from any number of databases. This generally makes it a lot faster.
The CQL works using the C/C++ driver so we should have minimal support needed on that side. However, the snapdbproxy daemon is part of the snapwebsites/lib and snapwebsites/src/snapdbproxy directories from the snapcpp project. This is why we are not going to provide a new download any time soon.
The existing version (0.5.22) runs with thrift and we won't be supporting it anymore. Sorry. But Cassandra is really going with CQL so we do think that the old interface is not going to continue to work "forever".
Note that the users of the library should see no difference except for the IP address and port used to connect. Everything else is still 99% compatible. However, we may change that soon, especially for the way to gather the data about the cluster (it's actually very slow and we want to avoid it.)
And when will the new version be released?
We are hesitating as the new version is mostly compatible with the old one, but it has some "strange" feature and requires another library and daemon to work (snapdbproxy).
So it is rather complicated to make a viable release with the new version at this point.
Just in case, the source code can be found in snapcpp on github.
:D thats a real huge project, why keep everything in one repository, its hard to find them
Well, as far as Snap! C++ is concerned, it makes it easier for the build system to keep everything up to date. All of those projects are not (yet) in Debian so it allows one who wants to recompile all of the snapcpp environment to do so easily...
😂how many dependencies needed for this library
I tried to build the missing dependencies, and when i was building advgetopt, it asked for Doxygen and SnapDoxygen, the document generating tool? Is that necessary?😂
I am not good at Linux or CMake, actually I am not a programmer at all.😂
Well... if you are not a programmer, I'm not too sure you'd want to have
libQtCassandra
in the first place... That's really only for programmers.Now, version 0.5 used Thrift and had an interface that encompassed thrift well. On the other hand, 0.6 uses CQL. The nice scheme we had with Thrift is fairly broken. The way CQL functions is quite different and either way we really needed to have a proxy for two reasons:
fork()
, it breaks really bad.Anyway, the dependencies are numerous. If you want to use
libQtCassandra
as it was used in 0.5, with the Cassandra, Context, Table, Row, Cell objects, then you need everything in snapcpp, pretty much:libQtCassandra
itself does not depend on another library anymore (we now have removed the need forcontrolledvars
), however, it still requires the topcmake
folder to run cmake against it.snapdbproxy
, you need to compile it which requiresadvgetopt
andlibsnapwebsites
snapdbproxy
you need thesnapcommunicator
daemon too (yes,snapdbproxy
andsnapcommunicator
are both daemons)libsnapwebsites
library depends onas2js
,csspp
,log4cplus
,libtld
,libQtSerialization
, andlibQtCassandra
(more or less, all of thecontrib
folder...)So the easiest is probably to recompile all of the
snapcpp
environment.This should work by first retrieving all the files and then running two scripts:
You may want to check out the two scripts before running them to make sure it will work on your machine.
The
snap-ubuntu-packages
makes sure all the system packages (stuff not included in yourcontrib
folder) is installed on your machine and thus everything runs. If you want absolutely everything (including the documentation which is supposed to be option, indeed) then you can use the--optional
flag as in:Yet again, if you are not a programmer, I'm not too sure why you'd want to go through all of this trouble... B-)
That's 2 C++ drivers mentioned in Cassandra Documentation, I don't know which is easier to learn, I picked this one just cause you said it follows Qt syntax, and I thought it should be easy for a Qt learner to get started. Or will you recommend me to use the other one?
Hi Samuel,
The
QCassandraSession
andQCassandraQuery
objects give you a trulyobject-oriented, C++ friendly interface, where I've wrapped all of the
major calls provided by the
cassandra-cpp
driver. I find theirinterface, which is a mix of object-orientation with a C-only syntax, to
be difficult to work with (their documentation leaves a lot to be desired).
So if you want to play with creating databases, tables, and rows and
adding and selecting data, I recommend you start there.
Ah. I see.
Yes. I would suggest you use version 0.5 if you do not mind using Thrift. However, they are deprecating that interface. Many little things won't work quite right.
libQtCassandra 0.6 has two sides, one part which offers the Cassandra, Context, Table, Row, Cell tree. If you ignore that side completely, then you could use it but you will also need the other C++ driver. So 0.6 is a wrapper of the C++ driver that comes from the Cassandra people.They wrote the code in C++, but made their interface only accessible through C-like functions. Our library transforms that in an object oriented Qt compatible library. In this case the object you deal with are main Session and Query objects. There is MetaData which let you get the structure of the database (the name of contexts, tables, columns.)
So, if you want to use CQL, you probably want to use their driver only because either way you'd have to have both with libQtCassandra 0.6+.
I've found a more user friendly documentation for the C/C++ driver here:
http://datastax.github.io/cpp-driver/topics/
It is just like the documentation in the code, it does not really tell you that much, but it is easy to follow. That being said, it does not help the fact that this is C and not C++... unfortunately.
This seemed simpler but isn't it another driver——nothing to do with yours?
libQtCassandra 0.6 is a wrapper around the datastax C/C++ driver.
C looks simpler until you understand how to use C++ properly. Then it becomes dramatically harder.
😂I'm sorry I am not good at English, neither.
Did you mean C is hard for a C++ user?
Last edit: Samuel 2016-10-19
Yes. C++ offers one thing called RAII which makes is dead easy to do certain things which are otherwise extremely tedious in C.
Say one of your functions deals with 3 files and 10 memory buffers. In C, if you detect an error, you will have to make sure that those 13 resources are released before you call the return statement. If you have 20 return statements in your function, now you need 20 times the code used to release those 13 resources. Either that, or you use the
goto
instruction (which many people do).In C++, all those resources are in your objects. When you throw an exception, use the return statement or exit the function some other way, "magic" happens... all the resources are automatically released for you. You need ZERO thinking power to remember to release anything. Once you are used to that, switching back to C is a terribly difficult move.
Same problem happened to DataStax?