Commit Graph

1166 Commits

Author SHA1 Message Date
Asias He
4e13844f4b io: Import io/IVersionedSerializer.java 2015-01-04 18:36:51 +08:00
Asias He
3fbb10b9ea db: Add stub db.cc file 2015-01-04 10:46:25 +02:00
Asias He
bfc17d2841 db: Convert db/composites/CellName.java to C++ 2015-01-04 10:46:25 +02:00
Asias He
72f5e22316 db: Convert db/composites/CBuilder.java to C++ 2015-01-04 10:46:24 +02:00
Asias He
5239ace214 db: Convert db/composites/Composite.java to C++ 2015-01-04 10:46:24 +02:00
Asias He
99d06f3698 db: Import db/composites/* 2015-01-04 10:46:23 +02:00
Pekka Enberg
36359850e6 cql3: Switch to our own shared_ptr implementation
Suggested by Avi.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-04 10:45:19 +02:00
Pekka Enberg
3368d44af7 cql3: Use optional for cf_name
Suggested by Avi.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-04 10:45:18 +02:00
Pekka Enberg
9292815bd9 cql3: convert Term to C++
This is not 1:1 conversion because some Term inner classes derive from
Term itself which is not allowed in C++. I therefore moved some of the
inner class definitions outside of Term.

Another painpoint is Terminal.bind() method which returns 'this'. I
changed the API to require callers to pass shared_ptr<terminal> which is
returned in place of 'this'. I went for shared_ptr because I wasn't able
to convince myself that the lifetime rules allow unique_ptr...

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-04 10:42:52 +02:00
Avi Kivity
98ac429983 Merge branch 'cql3/statement' of github.com:cloudius-systems/seastar-dev into db 2015-01-01 15:39:33 +02:00
Pekka Enberg
537cc42397 cql3: convert SchemaAlteringStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
Pekka Enberg
479c370212 cql3: use unique_ptr for cf_name to allow nullptr
There are cf_statement derived classes that pass 'null' as 'cf_name'.
Switch to unique_ptr to allow that.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
Pekka Enberg
046d827be6 cql3: Fix use_statement class override annotations
Add a missing override annotation to the use_statement class.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
Pekka Enberg
5e4fc9b88c cql3: convert TruncateStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
Avi Kivity
852f63f918 Merge branch 'cql' into db
Convert AggregateFcts, adding some infrastructure along the way.
2014-12-31 18:04:14 +02:00
Pekka Enberg
18d92f6cd6 cql3: convert AssignmentTestable to C++
The conversion is not 1:1 because 'enum class' in C++ does not support
methods. As the methods are rather simple, I moved them out of the class
as standalone functions.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-31 18:04:08 +02:00
Avi Kivity
7cab37ddad cql: convert AggregateFcts to C++
Use templates to reduce code duplication for each data type.
2014-12-31 16:09:21 +02:00
Avi Kivity
3900173c75 db: add data_type_for<> helper
Converts C++ data type to corresponding data_type class, during compile time.
2014-12-31 16:07:50 +02:00
Avi Kivity
d19043fca2 db: add data_type::decompose
Convert any -> bytes.
2014-12-31 16:07:17 +02:00
Avi Kivity
719a7f87f3 cql: add helpers for constructing native aggregate functions 2014-12-31 16:06:28 +02:00
Avi Kivity
f303499d01 cql: fix native_aggregate_function base classes
Must be public.
2014-12-31 16:05:50 +02:00
Avi Kivity
adc78b8959 cql: fix function/abstract_function inheritence
Make a few functions virtual and fix the types.
2014-12-31 16:04:22 +02:00
Avi Kivity
35608909b0 cql: use optional<bytes> for function arguments and return types
Allow null values.
2014-12-31 16:03:43 +02:00
Nadav Har'El
774579d8b4 Move murmur_hash to the right directory
In the original Java code, MurmurHash was in the "utils" package, not
"util", so move it to a new "utils" directory (and namespace), not
"util".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-30 17:43:30 +02:00
Avi Kivity
cf2152555a Merge branch 'master' into db
Fixes from seastar.
2014-12-30 17:04:23 +02:00
Nadav Har'El
5b071fd224 sstring: support to_sstring() for floating-point
std::to_string() can also convert a floating-point argument to string,
using the "%f" printf format (see
	http://en.cppreference.com/w/cpp/string/basic_string/to_string )
So add this support to our to_sstring() as well.

Note that if you want to use a different format, e.g., "%g", you can,
by using the to_sstring_sprintf function, for example

	to_sstring_sprintf(12345678.9, "%g")

results in "1.23457e+07".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-30 17:00:46 +02:00
Tomasz Grabiec
c2fe4c3e29 memcached/tests.py: wait for memcached process before proceeding
To ensure that the old process is no longer running when the new one
is started.
2014-12-30 17:00:44 +02:00
Pekka Enberg
c5d8506086 cql3: use unique_ptr for parsed_statement::prepare()
We cannot keep a C++ reference to the statement object because we then
lose ownership information. Start using unique_ptr as suggested by Avi
instead.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 16:27:47 +02:00
Avi Kivity
ddeb9aee13 Merge branch 'cql3/statement' of github.com:cloudius-systems/seastar-dev into db
From Pekka:

"Here's a v2 of a patch series that converts some CQL3 AST statement base
classes to C++."
2014-12-30 15:53:59 +02:00
Pekka Enberg
de4f0f8455 cql3: convert CFStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:59 +02:00
Pekka Enberg
229b44968a cql3: convert CFName to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:59 +02:00
Pekka Enberg
cff499989d cql3: convert UseStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
a17c3f8993 cql3: convert ParsedStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
7edbcb1ae9 cql3: convert ColumnSpecification to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
bb46ca9003 cql3: convert ColumnIdentifier to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
5025ebfb61 cql3: convert VariableSpecifications to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Avi Kivity
833d5c2262 thrift: fix get_slice column index calculations
Both lower and upper bound calculations were broken.

Fix by using iterators instead of calculating indices using std::distance().
2014-12-30 15:34:27 +02:00
Gleb Natapov
6ad9114c0b reactor: add at_destroy() function to the reactor and use it
Unfortunately at_exit() cannot be used to delete objects since when
it runs the reactor is still active and deleted object may still been used.
We need another API that runs its task after reactor is already stopped.
at_destroy() will be such api.
2014-12-30 15:21:10 +02:00
Gleb Natapov
2fb7490bf9 stream: reset subscription's stream pointer in stream's destructor 2014-12-30 15:21:08 +02:00
Pekka Enberg
bf3112f331 cql3: convert CQLStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 10:03:44 +02:00
Avi Kivity
a99c732577 Merge branch 'cql' into db
More cql3 conversions.
2014-12-30 09:03:57 +02:00
Avi Kivity
f9c7eb3e9b cql3: convert NativeScalarFunction to C++ 2014-12-30 09:00:22 +02:00
Avi Kivity
66138dc189 cql3: convert NativeAggregateFunction to C++
Requires virtual inheritence from functions::function due to an
inheritence diamond.
2014-12-30 09:00:22 +02:00
Avi Kivity
9a2c40c931 cql3: convert AggregateFunction to C++ 2014-12-30 09:00:22 +02:00
Avi Kivity
a4f64e980c cql3: convert NativeFunction to C++ 2014-12-30 09:00:22 +02:00
Avi Kivity
8be65f234d Merge branch 'log' into db
Basic sl4j compatible logger.
2014-12-29 19:02:54 +02:00
Nadav Har'El
6710a97537 Convert util/MurmurHash.java to C++
Port the Murmur hash functions from Java to C++. This is ironic,
because these functions actually originated in C code, which the
Cassandra guys converted to Java :-)

The Murmur hash is used in Cassandra for several things, including the
bloom filter (which is part of each sstable), and the default
data partitioner (Murmur3Partitioner).

I tested on some example string that all three methods (hash32, hash2_64
and hash3_x64_128) produce exactly the same output in the new C++ code as
they do in the original Java functions. This is important, because we want
the C++ node to be able to run alongside Java nodes, so they have to agree
on the same hash function.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
[avi: update configure.py]
2014-12-29 19:01:12 +02:00
Avi Kivity
eee158ed22 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Merge seastar framework fixes.
2014-12-29 17:49:04 +02:00
Nadav Har'El
7a84dff0b2 sstring: constructor from C string
The constructor from "const char_type *" wouldn't really work when
char_type != char, because strlen() won't work on such pointers.

It is more convenient to have a constructor from an ordinary const char *
(e.g., a C string literal), and solve the type problem with an ugly cast.

This only makes sense when sizeof(char_type)==1 (i.e., it is char, unsigned
char, or signed char), but I think we make this assumption in other places
as well (e.g., in determining the size we need to allocate).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-29 17:29:32 +02:00
Nadav Har'El
f7fbf8ba02 sstring: add operator[]
std::string has an operator[] to get access (read or modify) to one
character in the string. This patch adds the same operator for our
sstring.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-29 17:29:10 +02:00