Commit Graph

1598 Commits

Author SHA1 Message Date
Tomasz Grabiec
d243fb7a01 cql3: Pass sstrings as const& where applicable 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
213d029a22 cql3: Make restriction::bounds() return a vector of optionals 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
4478da3c45 cql3: make modification_statement::_column_operations mutable
Note: "final" in Java means that the reference can't change, but the
object pointed to by the reference can.
2015-02-04 10:29:00 +01:00
Tomasz Grabiec
602e6a9c17 cql3: Add missing default implementation of operation::requires_read() 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
792c566c51 cql3: Convert SingleColumnRelation 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
867ec42b59 cql3: Convert Relation 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
ab17520a11 exception: Import UnrecognizedEntityException.java 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
9d2d85ffe6 cql3: Convert Operator.java
"operator" is a reserved name in C++, so I decided to name this class
"operator_type".

Note: NEQ.reverse() returns NEQ in Origin. I'm not sure if it's a bug
or not, I replicated it as is.
2015-02-04 10:29:00 +01:00
Tomasz Grabiec
fc2d98431a cql3: Implement some to_string() methods 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
88e276d272 Introduce to_string() working on vectors of printable 2015-02-04 10:28:59 +01:00
Tomasz Grabiec
3a6cb52c28 cql3: Make cql_statement::prepare() accept a database reference 2015-02-04 10:28:59 +01:00
Tomasz Grabiec
b7cf3a679d Convert ThriftValidation.validateColumnFamily(String,String)
Unlike origin, we don't use global singleton, but accept a database
reference instead.
2015-02-04 10:28:59 +01:00
Tomasz Grabiec
936587fa36 Extract code from validation.hh into .cc file 2015-02-04 10:28:59 +01:00
Tomasz Grabiec
8655825a2a cql3: Remove already converted code 2015-02-04 10:28:59 +01:00
Tomasz Grabiec
a0b04b9149 cql3: Fix typo 2015-02-04 10:28:59 +01:00
Tomasz Grabiec
cbe1a3d403 schema: Introduce schema::get_column_definition() 2015-02-04 10:28:56 +01:00
Tomasz Grabiec
212bb750ac cql3: Expose column_identifier::raw::prepare_column_identifier()
It's a workaround for C++ not supporting covariant return types with
smart pointers.

When callers know that they call prepare() on column_identifier, they
expect shared_ptr<column_identifier>. But prepare() comes form
abstract base class, and is defined to return shared_ptr<selectable>,
where "selectable" is ancestor of column_identifier.

We can avoid dynamic_cast<> here by calling a non-polymorphic
prepare_column_identifier() when the type is known.

Needed from modification_statement::parsed::prepare().
2015-02-04 10:28:56 +01:00
Tomasz Grabiec
6ba3732620 schema: Rename column_kind::PRIMARY -> column_kind::PARTITION
The old name was incorrect.
2015-02-04 10:28:51 +01:00
Tomasz Grabiec
e11e5ff269 cql3: Drop redundant optional<> 2015-02-04 10:28:51 +01:00
Tomasz Grabiec
5710a99f44 cql3: Fix mis-overrides of cql_statement::execute*()
The method may defer so the result is wrapped in future<>.

I think we don't need to wrap arguments in shared_ptr<> because they
may come from the request state object.
2015-02-04 10:28:51 +01:00
Tomasz Grabiec
ed0500e1cd tuple: Remove dead code 2015-02-04 10:28:51 +01:00
Tomasz Grabiec
25cdd44144 types: Fix compare_unsigned()
In lexicographical order length is compared second.
2015-02-04 10:28:51 +01:00
Tomasz Grabiec
1610a58293 types: Relax include 2015-02-04 10:28:47 +01:00
Tomasz Grabiec
a89ea75494 validation: Fix incorrect format specifier 2015-02-04 10:24:08 +01:00
Tomasz Grabiec
5049ed8ae6 Merge branch 'master' of github.com:cloudius-systems/seastar 2015-01-30 09:34:58 +01:00
Tomasz Grabiec
af7f315339 Merge branch 'tgrabiec/cql3' of github.com:cloudius-systems/seastar-dev
Mutation data model and cql3 conversions.
2015-01-30 08:42:49 +01:00
Tomasz Grabiec
e38fb6bdbf cql3: Convert DeleteStatement 2015-01-29 19:41:00 +01:00
Tomasz Grabiec
b70b4c1957 cql3: Convert UpdateStatement 2015-01-29 19:41:00 +01:00
Tomasz Grabiec
7dae2d0923 cql3: Convert Setter 2015-01-29 19:41:00 +01:00
Tomasz Grabiec
ab1bdf1b82 cql3: expose Operation.execute() interface 2015-01-29 19:41:00 +01:00
Tomasz Grabiec
d8982abf81 cql3: Allow bind_and_get() to return an optional value
In Origin it can be null and it has a different meaning than empty
value. See org.apache.cassandra.cql3.Constants.Setter#execute.
2015-01-29 19:41:00 +01:00
Tomasz Grabiec
496e5c651f cql3: Convert more of ModificationStatement 2015-01-29 19:41:00 +01:00
Tomasz Grabiec
58677dc911 service: Convert StorageProxy 2015-01-29 19:40:58 +01:00
Tomasz Grabiec
09a893aed4 service: Import StorageProxy.java 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
ea3f83754f service: convert ClientState 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
2294c6b1e0 service: Import ClientState.java 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
d4b6f7abc3 cql3: Convert more of ConsistencyLevel 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
64412ff3dd cql3: Cleanup modification_statement 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
a738365e6f cql3: Convert ModificationStatement.processedKeys 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
73a4ba8fd2 cql3: Add validation.hh
validate_cql_key() is based on validate_key() from ThriftValidation. I
didn't name it thrift_validation.hh though because it's meant to work
on CQL model, not thrift. For instance, it's using our
schema::partition_key_type, which is not thrift-compatible.
2015-01-29 19:40:07 +01:00
Tomasz Grabiec
ef430a605c db: Convert ThriftValidation 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
69ba3de601 thrift: Import ThriftValidation.java 2015-01-29 19:40:07 +01:00
Tomasz Grabiec
2006a75403 Add unimplemented.hh
The problem is that while we are converting some code, we don't want
to convert some aspects of it. For example we don't want to implement
indexing supporting yet. To better track those places, we insert a
statement in those places which can be easily tracked down when the
time comes. This patch adds a header where those statements are
grouped.

Alternative is to use comments, but comments are free text so we
can't force common syntax on them.
2015-01-29 19:40:02 +01:00
Tomasz Grabiec
15bc1a8af3 db: Introduce mutation model
This model is meant to follow CQL more closely than the model in
Origin. We have direct representations for CQL rows and cells.

We avoid using thrift concepts here. Here's how some of the Origin's
classes map to this:

 Mutation -> mutation
 ColumnFamily -> partition
 CellName -> clustering_key/clustering_prefix and column_id
 Cell -> atomic_cell (not for collection types though)

Note about CounterMutation. CounterMutation is for modifying counter
tables. A counter table can only have one column, the counter
value. In Origin CounterMutation is a subclass of IMutation which
represents mutations on counter tables. The only field it adds is
consistency level. I think we don't need to have a separate class for
this, at least in the generic code, which simplifies things. We can
check whether the table is a counter table from the schema and we can
pass the consistency level from QueryOptions during serialization.
2015-01-29 18:55:24 +01:00
Tomasz Grabiec
64128dc117 cql3: Convert UpdateParameters 2015-01-29 18:55:24 +01:00
Tomasz Grabiec
2a35e4e5a4 config: Delete cf_meta_data and column_definition
Converted code should use abstractions from database.hh now.
2015-01-29 18:55:24 +01:00
Tomasz Grabiec
159099e854 cql3: use our schema classes instead of the converts from config:: 2015-01-29 18:55:24 +01:00
Tomasz Grabiec
185e443624 cql3: Allow restriction::values() to return missing values
Origin allows nulls here.
2015-01-29 18:55:24 +01:00
Tomasz Grabiec
333d1f259f Stub schema::is_dense() and schema::is_counter() 2015-01-29 18:55:24 +01:00
Tomasz Grabiec
34616107a9 Add column_definition::is_static() 2015-01-29 18:55:23 +01:00