Commit Graph

508 Commits

Author SHA1 Message Date
Tomasz Grabiec
f656ae8ed4 db: Encapsulate deletable_row fields 2015-05-13 08:56:54 +02:00
Tomasz Grabiec
56bea440a7 mutation_partition: Pass schema by const& where applicable
If method doesn't want to share schema ownership it doesn't have to
take it by shared pointer. The benefit is that it's slightly cheaper
and those methods may now be called from places which don't own
schema.
2015-05-13 08:56:54 +02:00
Pekka Enberg
11b633208d cql3: Remove Java imports from C++ files
Remove left-over Java imports from files that are already translated to
C++.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:41:12 +03:00
Pekka Enberg
c6da7e6844 cql3: Use std::nullopt constant
There's a std::nullopt constant for unset optionals. Use it.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:37:29 +03:00
Pekka Enberg
d50139351f cql3: Use pragma once everywhere
There's no benefit to using C include guards so switch to pragma once
everywhere for consistency.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:32:56 +03:00
Tomasz Grabiec
b1e45e4401 db: Store ttl in atomic_cell
Origin does that, so should we. Both ttl and expiry time are stored in
sstables. The value of ttl seems to be used to calculate the read
digest (expiry is not used for that).

The API for creating atomic_cells changed a bit.

To create a non-expiring cell:

  atomic_cell::make_live(timestamp, value);

To create an expiring cell:

  atomic_cell::make_live(timestamp, value, expiry, ttl);

or:

  // Expiry is calculated based on current clock reading
  atomic_cell::make_live(timestamp, value, ttl_optional);
2015-05-06 19:42:38 +02:00
Tomasz Grabiec
5ba1486ae7 db: Rename "ttl" to "expiry" when it's used as time point
To avoid confusion with "ttl" the duration.
2015-05-06 17:27:22 +02:00
Tomasz Grabiec
d6a003dc59 gc_clock: Store max_ttl as duration rather than time_point
Extra wrapping in time_point has no point.
2015-05-06 17:22:35 +02:00
Avi Kivity
bc669add40 schema: const correctness
Make schema accessors const, and make schema_ptr refer to a const schema.
2015-05-06 13:52:59 +02:00
Avi Kivity
4593d52444 cql3: remove gunk from lists.hh 2015-04-29 16:31:36 +03:00
Avi Kivity
6290dee438 db: const correctness for abstract_type and friends
Types are immutable.
2015-04-29 15:40:38 +03:00
Avi Kivity
ab60ed8813 db: s/shared_ptr<abstract_type>/data_type/
Also replace derived types (map_type, collection_type, etc.).

As we'll change data_type's definition, this reduces the number of places
that need to be modified later, and is more readable.
2015-04-29 15:09:04 +03:00
Tomasz Grabiec
f00f5f39d9 Merge tag 'avi/remedial-collections-2/v1' from seastar-dev.git
Collection support remedial from Avi.
2015-04-28 17:48:07 +02:00
Avi Kivity
0b09296f5d cql3: enable grammer for collection conditions
map['key'] IN (1, 2, 3)

etc.
2015-04-28 18:17:25 +03:00
Avi Kivity
993db76ef8 cql3: fix column_condition::collection_in_condition() naming 2015-04-28 18:16:49 +03:00
Avi Kivity
44f44bbeeb cql3: convert collection-related items in single_column_relation to C++ 2015-04-28 18:01:54 +03:00
Avi Kivity
97f689eb03 cql3: convert single_column_restriction::IN_with_marker to C++ 2015-04-28 18:00:35 +03:00
Avi Kivity
9c446a5465 cql3: convert RequestValidations.java to C++ 2015-04-28 17:05:32 +03:00
Tomasz Grabiec
02eb356cae Merge tag 'avi/remedial-collections-1/v1' from seastar-dev.git
Implementation of missing collections functionality from Avi.
2015-04-28 14:28:14 +02:00
Avi Kivity
448d67053f cql3: convert operation::prepend to C++ 2015-04-28 12:13:38 +03:00
Avi Kivity
abca68458e cql3: convert lists::prepender to C++
Note the original code contains a bug, causing the prepended literal to
be reversed.  The conversion (and Origin) are fixed.
2015-04-28 12:13:38 +03:00
Avi Kivity
4736504f4a cql3: convert lists::marker::bind() to C++ 2015-04-28 12:13:38 +03:00
Avi Kivity
9131c094a7 cql3: convert lists::precision_time to C++ 2015-04-28 12:13:38 +03:00
Avi Kivity
38a09a6c1a cql3: remove gunk from lists.hh 2015-04-28 12:10:33 +03:00
Avi Kivity
47f1fe8eb5 cql3: implement list append operation
UPDATE tab SET mylist = mylist + [1, 2, 3]
2015-04-27 14:54:16 +03:00
Avi Kivity
dc9e705952 cql3: convert lists::appender to C++ 2015-04-27 14:53:51 +03:00
Avi Kivity
f1219c1d74 cql3: enable collections in column_condition 2015-04-27 14:43:43 +03:00
Tomasz Grabiec
6e78344c87 Merge tag 'avi/usertypes-addendum/v1' from seastar-dev.git 2015-04-27 12:53:00 +02:00
Avi Kivity
23db4e0b54 db: rename db_tuple_type to tuple_type
Now that we reclaimed the tuple_type name, use it for its rightful owner.
2015-04-27 12:27:18 +02:00
Avi Kivity
01347bf091 cql3: enable grammar for frozen<type> 2015-04-26 19:25:39 +03:00
Avi Kivity
74cd3a58ef cql3: add frozen type support to cql3_type 2015-04-26 19:25:39 +03:00
Avi Kivity
3fec0842ef cql3: enable grammar for user type names 2015-04-26 19:25:39 +03:00
Avi Kivity
bc1ab16adc cql3: convert reserved_type_names() in grammar 2015-04-26 19:25:39 +03:00
Avi Kivity
6f2751750f cql3: add uninitialized<> helper for ANTLR
ANTLR insists on default-initializing rule return values, which doesn't
always make sense.  Rather than wrapping with optional<> or shared_ptr<>,
introduce a specialized wrapper that only handles late initialization (by
assignment).

Example:

  foo returns [uninitialized<some_type> ret]
     ...
         { $ret = ...; }
2015-04-26 19:25:39 +03:00
Avi Kivity
0ef85e2be6 cql3: implement cql3_type support for user types 2015-04-26 19:25:39 +03:00
Avi Kivity
7f781e314e cql3: add ut_name ostream operator 2015-04-26 19:25:39 +03:00
Avi Kivity
bc4d23883b cql3: simplify ut_name constructor
shared_ptr<> is already optional, so remove the outer optional<> wrapper.
2015-04-26 19:25:39 +03:00
Avi Kivity
31133ee47a cql3: disambiguate join() call in cql3_type
Gets confused with boost::join() due to ADL, when boost::join() is available.
2015-04-26 18:45:59 +03:00
Avi Kivity
8825a2bd74 cql3: add missing include to ut_name.hh 2015-04-26 18:45:59 +03:00
Tomasz Grabiec
1c3275c950 mutation: Encapsulate fields 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
a9972b4b28 Relax header dependencies 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
731a63e371 schema: Embed raw_schema inside schema
Public fields got encapsulated.
2015-04-24 18:01:01 +02:00
Avi Kivity
dabe70c9a2 cql3: remove Java remnants from maps.hh
The code was converted to C++ but the old Java remained.
2015-04-21 10:57:35 +03:00
Avi Kivity
7f78618a64 cql3: remove gunk from constants.hh 2015-04-21 10:41:20 +03:00
Avi Kivity
b4e380b922 cql3: enable user_type literal grammar 2015-04-20 16:15:35 +03:00
Avi Kivity
c01515d291 cql3: convert user_types.hh to C++ 2015-04-20 16:15:35 +03:00
Avi Kivity
3920ab18b2 cql3: enable user type grammar for field selection 2015-04-20 16:15:35 +03:00
Avi Kivity
f841a05475 cql3: convert selectable::with_field_selection to C++
Due to circular dependencies (selectable::with_field_selection ->
  column_identifier -> selectable) a new header file was created.
2015-04-20 16:15:34 +03:00
Avi Kivity
fa961f1e5e cql3: convert field_selector to C++ 2015-04-20 16:15:34 +03:00
Avi Kivity
3d38708434 cql3: pass a database& instance to most foo::raw::prepare() variants
To prepare a user-defined type, we need to look up its name in the keyspace.
While we get the keyspace name as an argument to prepare(), it is useless
without the database instance.

Fix the problem by passing a database reference along with the keyspace.
This precolates through the class structure, so most cql3 raw types end up
receiving this treatment.

Origin gets along without it by using a singleton.  We can't do this due
to sharding (we could use a thread-local instance, but that's ugly too).

Hopefully the transition to a visitor will clean this up.
2015-04-20 16:15:34 +03:00