Commit Graph

69 Commits

Author SHA1 Message Date
Tomasz Grabiec
808f70b6c3 collection_type_impl: Introduce is_any_live() 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
300bacb3d9 collection_type_impl: Introduce is_empty() 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
95b71f220c types: collection_type_impl: Introduce serialize_mutation_form_only_live()
For serializing only live elements of the collection. Will be needed
by query path.
2015-03-30 09:07:00 +02:00
Avi Kivity
17b929d739 db: implement as_cql3_type() for collections 2015-03-26 18:14:35 +01:00
Avi Kivity
1c1c4f923a db: fix collection_type_impl::deserialize_mutation_form() types
It accepts a bytes_view instead of the type-safe wrapper.
2015-03-26 14:31:01 +02:00
Avi Kivity
6a8b682c0e db: add collection_type_impl::mutation_view::materialize()
Converts a mutation_view to a mutation, so it can be modified.
2015-03-26 12:14:01 +02:00
Avi Kivity
f983ab41a3 db: get rid of object_opt
As Tomasz noticed, boost::any can be empty, so optional<> functionality is
not needed.
2015-03-24 08:23:34 +01:00
Avi Kivity
c77648da6e db: add collection tombstones 2015-03-23 21:54:22 +02:00
Avi Kivity
62ee57b953 db: wrap collection_type_impl::mutation's vector in a struct
This will allow us to introduce a tombstone alongside.
2015-03-23 21:54:22 +02:00
Tomasz Grabiec
0330568977 db: Handle range queries on clustering key
That also includes prefix range queries (partially constrained keys).
2015-03-20 19:20:59 +01:00
Tomasz Grabiec
c656674ab6 types: Introduce tri_compare() 2015-03-20 18:59:58 +01:00
Tomasz Grabiec
90298af614 db: Cleanup atomic_cell naming
atomic_cell -> atomic_cell_type
atomic_cell::one -> atomic_cell
atomic_cell::view -> atomic_cell_view
2015-03-20 18:59:29 +01:00
Tomasz Grabiec
49b7a166a8 keys: Make key components non-optional 2015-03-19 14:54:41 +01:00
Tomasz Grabiec
3e230bd42c types: Introduce equal() and less_compare()
For use with sequence comparators like lexicographical_compare().
2015-03-19 14:54:41 +01:00
Tomasz Grabiec
cb4c874bf9 types: Introduce lexicographical_tri_compare() 2015-03-19 14:54:29 +01:00
Tomasz Grabiec
fffa35ac6b types: Make abstract_type::validate() work on bytes_view 2015-03-17 15:56:29 +01:00
Tomasz Grabiec
4b33888c23 types: Add algorithms for comparing optional types 2015-03-17 15:56:28 +01:00
Tomasz Grabiec
e3a04ae21b types: Introduce generic is_prefixed_by() 2015-03-17 15:56:28 +01:00
Tomasz Grabiec
1d5de9e428 types: Introduce lexicographical_compare() version with third sequence 2015-03-17 15:56:28 +01:00
Avi Kivity
6fee695095 db: replace most uses of protocol_version with serialization_format
Better type safety.
2015-03-16 18:15:16 +02:00
Avi Kivity
923496056a db: add set_type_impl::serialize_partially_deserialized_form() 2015-03-16 16:36:14 +02:00
Avi Kivity
4bbfc3c23b db: export collection_type_impl::pack() 2015-03-16 16:36:14 +02:00
Dor Laor
7921ef406a db: serialize via bytes_iterator instead of std::ostream
Instead of using inefficient std::ostream, use our own 'bytes' iterator class.
Compute ahead of time the length of the byte buffer.
Afterwards serialize the objects into it.

Gives ~X5 boost over previus results (that sometimes don't even
finish in reasonable time)

[avi: add missing include]
2015-03-16 07:07:25 +02:00
Tomasz Grabiec
2ee58d66d6 Merge tag 'avi/collections/v3'
Conflicts:
	tests/urchin/cql_query_test.cc

[tgrabiec: fixed compilation error in cql3/maps.hh]
2015-03-12 11:30:17 +01:00
Avi Kivity
ca308698df collection_type_impl: add to_value(mutation_view)
Allows collapsing a mutation into a literal.
2015-03-12 10:10:42 +02:00
Avi Kivity
7c5d865aac db: add map_type::serialize_partially_deserialized_from
Add a way to convert a vector of pairs of serialized key/values to
the fully serializied form; useful for map literals.
2015-03-12 10:10:42 +02:00
Avi Kivity
fc9a8d6efd db: add collection_type_impl::pack
A helper function for other operations, as all collections share
the basic serialized format.
2015-03-12 10:10:42 +02:00
Avi Kivity
3c63f77824 db: split collection_type_impl::mutation into an owning and view types
The view type is more efficient, but less safe.
2015-03-12 10:10:42 +02:00
Avi Kivity
0bd44deca9 db: add abstract_type::as_less_comparator()
Returns a binary predicate that allows comparing two values belonging
to the type, suitable for STL containers and algorithms.
2015-03-12 10:10:41 +02:00
Avi Kivity
769824655e types: add forward declarations for collection serialization operations 2015-03-12 09:56:53 +02:00
Avi Kivity
fb876cb6f2 db: implement list_type 2015-03-12 09:56:53 +02:00
Avi Kivity
488ac10369 db: add set type implementation 2015-03-12 09:56:53 +02:00
Tomasz Grabiec
76c3509501 transport: Handle result_message::rows in CQL3 server 2015-03-11 16:01:13 +01:00
Tomasz Grabiec
6b30b4a2cd types: Introduce types::is_reversed() 2015-03-11 14:56:10 +01:00
Tomasz Grabiec
5f6d02df62 types: Make underlying_type() return shared_ptr<abstract_type> 2015-03-11 14:56:10 +01:00
Avi Kivity
06bd67c221 db: move map_type:impl::mutation and associated helpers to collection_type_impl
Turns out the sets and lists also use the same data type, with sets using
a fake value type, and lists using a fake key type.
2015-03-11 14:42:42 +02:00
Avi Kivity
5f309f4d33 db: add empty_type
Used in sets for the value type.
2015-03-11 14:42:42 +02:00
Avi Kivity
da902a4c17 db: add helper for interning types; use in map_type
Avoid code repetition for other collections.
2015-03-11 14:42:42 +02:00
Avi Kivity
5bff24c292 db: constify standard data_types
Lest someone accidentally move them away or assign into them.
2015-03-05 22:20:04 +02:00
Tomasz Grabiec
3db3207b85 Merge branch seastar-dev.git 'collections'
Collections support from Avi.
2015-03-05 20:25:48 +01:00
Avi Kivity
98f2a51df9 db: implement collection mutation merging
Only for maps, as they are the only collection implemented at present.
2015-03-05 18:11:37 +02:00
Avi Kivity
b5571e4c18 db: implement map_type (partial) 2015-03-05 15:31:50 +02:00
Avi Kivity
56d5c24a6a db: implement CollectionType (partial) 2015-03-05 14:04:19 +02:00
Avi Kivity
853d0b2ca0 abstract_type: implement freeze() 2015-03-05 14:03:35 +02:00
Asias He
0036ee16d8 types: Add read_simple_short_string
bytes_view version of deserialize_string
2015-03-05 18:25:24 +08:00
Avi Kivity
6d18aa8f20 Decompose database.hh, types.hh into smaller headers
Avoid include hell for new code.
2015-03-04 16:18:48 +02:00
Nadav Har'El
6f2a2529a2 add "double" and "float" types
Implement "double" and "float" cql types.

This implementation doesn't touch serialization.hh (which should be
eventually removed) and rather follows the other examples in types.cc.
It is relatively ugly, because of all the cleverness of our "general"
byte swapping implementation actually works only for integer types, and
we need to get it to work for float/double as well.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-04 10:54:19 +01:00
Pekka Enberg
99a09020e8 types: Fix bytes_type_impl string conversion
Tomek points out that:

  Origin calls org.apache.cassandra.utils.Hex#hexToBytes here, which is
  not what to_bytes() does. BytesType.getSerializer().toString() calls
  ByteBufferUtil.bytesToHex(value), so you should call to_hex() here.

Fix that up.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-02 10:38:27 +01:00
Tomasz Grabiec
1f9d22f7e3 types: Fix read_simple*() variants to work for unaligned positions
Since types can be embedded at any position in memory we cannot assume
alignment.

Side note: It seems that on x86 access to the variable via packed<>
does not result in any extra instructions.
2015-02-27 10:48:56 +01:00
Tomasz Grabiec
00984609cb types: Add abstract_tyep::is_value_compatible_with() method 2015-02-27 10:48:56 +01:00