Commit Graph

19 Commits

Author SHA1 Message Date
Pekka Enberg
99c7dabd2a cql3/tuples: Unset value support 2017-01-27 09:24:36 +02:00
Pekka Enberg
be0351b49c cql3: Introduce raw_value and raw_value_view types
Currently, the code is using bytes_opt and bytes_view_opt to represent
CQL values, which can hold a value or null. In preparation for
supporting a third state, unset value introduced in CQL v4, introduce
new raw_value and raw_value_view types and use them instead.

The new types are based on boost::variant<> and are capable of holding
null, unset values, and blobs that represent a value.
2017-01-26 13:50:04 +02:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Tomasz Grabiec
9d11968ad8 Rename serialization_format to cql_serialization_format 2016-02-15 16:53:56 +01:00
Pekka Enberg
9521ef6402 cql3: Remove some ifdef'd code 2015-12-18 13:29:58 +02:00
Avi Kivity
2c3591cbd9 data_value de-any-fication
We use boost::any to convert to and from database values (stored in
serlialized form) and native C++ values.  boost::any captures information
about the data type (how to copy/move/delete etc.) and stores it inside
the boost::any instance.  We later retrieve the real value using
boost::any_cast.

However, data_value (which has a boost::any member) already has type
information as a data_type instance.  By teaching data_type intances about
the corresponding native type, we can elimiante the use of boost::any.

While boost::any is evil and eliminating it improves efficiency somewhat,
the real goal is growing native type support in data_type.  We will use that
later to store native types in the cache, enabling O(log n) access to
collections, O(1) access to tuples, and more efficient large blob support.
2015-10-30 17:38:51 +01:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Pekka Enberg
9f2bcc6a77 cql3: Change bind_and_get() return type to bytes_view_opt
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-24 09:06:13 +03:00
Pekka Enberg
6dee204db2 cql3/query_options: Store values as bytes view
Store values as bytes view when possible. This improves the CQL protocol
option parsing path by avoiding allocating memory and copying individual
values as "bytes" objects.

Please note that we retain the non-view version for internal queries
where performance is not as important.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-24 09:06:13 +03:00
Avi Kivity
a8f957b692 Merge "CQL3 tuples cleanup" from Paweł
"These are some minor fixes and improvements for issues pointed out
during review."
2015-08-17 10:51:58 +03:00
Paweł Dziepak
fc7062f5d2 cql3: tuples: get rid of lambda in std::transform()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-17 09:26:19 +02:00
Paweł Dziepak
3be8e3638e cql3: add missing std::move() in tuples::in_value()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-17 09:11:53 +02:00
Paweł Dziepak
b74c7824bb cql3: reserve vector capacity in tuple::in_value constructor 2015-08-17 09:07:52 +02:00
Pekka Enberg
5b9901d693 cql3/query_options: Encapsulate underlying values
Encapsulate the '_values' vector to make it easier to switch the
underlying type from bytes_opt to bytes_view_opt.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-17 09:48:58 +03:00
Paweł Dziepak
9f2fd53a6e cql3: trasnlate remaining parts of tuples.hh to C++
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:58:06 +02: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
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
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
Avi Kivity
609bda59f5 cql3: convert tuples.hh to C++ 2015-04-15 15:35:30 +03:00