Commit Graph

16 Commits

Author SHA1 Message Date
Tomasz Grabiec
22e379e786 keys: Move operator<< functions to .cc file 2015-04-22 19:01:16 +02:00
Tomasz Grabiec
bacede04b2 types: Expose component iterators in tuple_wrapper
This automatically exposes them in partition_key and clustering_key too.

The iterators return bytes_view to components.

For example:

  schema s;
  partition_key k;

  for (bytes_view component : boost::make_iterator_range(key.begin(s), key.end(s))) {
     // ...
  }
2015-04-16 14:04:04 +02:00
Tomasz Grabiec
5ef11d113a types: Improve code readability 2015-04-16 14:04:04 +02:00
Tomasz Grabiec
4c418ddef8 types: Use enum rather than bool in tuple_type template parameter
The 'bool' type doesn't hold any meaning on its own, which makes the
template instantiation sites not very readable:

  tuple_type<true>

To improve that, we can introduce an enum class which is meaningful in
every context:

  tuple_type<allow_prefixes::yes>
2015-04-16 14:57:21 +03:00
Avi Kivity
e9774fe1e1 db: adjust lexicographical_tri_compare to take a bounded type list
When comparing tuples, we don't want to overrun the type list.
2015-04-10 22:26:41 +03:00
Avi Kivity
a9ce81a2f8 db: add ostream operator for exploded_clustering_prefix 2015-04-01 20:12:39 +03:00
Tomasz Grabiec
7a6dd463dd types: Optimize serialization of single-element tuples
There are two sides of this optimization:

 1) We don't store the length of the last component, so the
    representation is now shorter.

 2) A single-element tuple is serialized exactly as the component it
    holds, which allows us to optimize conversions for such keys.
2015-03-26 10:21:48 +01: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
3176be2610 keys: Use trichotomic comparators where possible
Trichotomic version reduces comparison count almost by half.
2015-03-20 18:59:58 +01:00
Tomasz Grabiec
d8fd79a072 keys: Fix prefixable_full_tuple::is_prefixed_by()
Spotted during code review.
2015-03-20 18:59:57 +01:00
Tomasz Grabiec
ebfc1ffb20 query: Add facilities for printing query request 2015-03-20 18:59:29 +01:00
Tomasz Grabiec
bdbd5547e3 db: Cleanup key names
clustering_key::one -> clustering_key
clustering_key::prefix::one -> clustering_key_prefix
partition_key::one -> partition_key
clustering_prefix -> exploded_clustering_prefix
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
300a9572bd types: De-virtualize tuple_type
tuple_type is for managing our internal representation of keys. It
shares some interface with abstract_type, but the latter is a basis
for types of data stored in cells. tuple_type does not need to hide
behind a virtual interface.

Note: there is a TupleType in Origin, but it serves a different purpose.
2015-03-19 12:55:28 +01:00
Tomasz Grabiec
6197c5306d db: Optimize range tombstone lookups
From O(N) to O(log(N)) where N is the number of range tombstones.
2015-03-17 15:56:29 +01:00
Tomasz Grabiec
1b1af8cdfd db: Introduce types to hold keys
Holding keys and their prefixes as "bytes" is error prone. It's easy
to mix them up (or use wrong types). This change adds wrappers for
keys with accessors which are meant to make misuses as difficult as
possible.

Prefix and full keys are now distinguished. Places which assumed that
the representation is the same (it currently is) were changed not to
do so. This will allow us to introduce more compact storage for non-prefix
keys.
2015-03-17 15:56:29 +01:00