Commit Graph

24 Commits

Author SHA1 Message Date
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
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
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
00984609cb types: Add abstract_tyep::is_value_compatible_with() method 2015-02-27 10:48:56 +01:00
Nadav Har'El
8701273006 Add inet type
In v2: rebase, and add a more descriptive exception if trying to deserialize
an ipv6 address.

Add to list of types the Internet address type, known as INET in CQL
or as InetAddressType in the Cassandra code.

I based this code on stuff I found in InetAddressType and
InetAddressSerializer in the Cassandra code.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-02-25 15:57:05 +01:00
Pekka Enberg
fd0a6e0596 types: Fix bytes_type_impl unimplemented methods
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-02-25 13:39:10 +02:00
Pekka Enberg
9f49033279 types: Use integer_type_impl for long_type_impl
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-02-25 13:17:36 +02:00
Pekka Enberg
e98584713e types: Introduce generic integer_type_impl
Introduce a generic integer_type_impl that's based on int32_type_impl.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-02-25 13:17:36 +02:00
Pekka Enberg
bd9547ba77 types: Use sizeof(int32_t) instead of hard-coded 4
Switch to sizeof in preparation for converting int32_type_impl into a
generic integer_type_impl.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-02-25 13:08:16 +02:00
Avi Kivity
a2519926a6 db: add some iostream output operators
Helps debugging
2015-02-19 15:56:26 +02:00
Tomasz Grabiec
245f4dfe00 types: Avoid allocation in simple_type_impl::less() 2015-02-17 12:43:15 +02:00
Tomasz Grabiec
700799e965 types: Make deserialize() work on bytes_view 2015-02-17 12:43:15 +02:00
Tomasz Grabiec
6cde02cbc7 types: Make equal/hash/less work on bytes_view
The serialized value is not always a standalone "bytes" object, it can
be embedded in a larger chunk. It's much faster to work on the data
in-place.
2015-02-17 12:43:15 +02:00
Tomasz Grabiec
63d152ece8 types: Introduce abstract_type::as_cql3_type()
Origin also has it.
2015-02-12 19:40:58 +01:00
Tomasz Grabiec
863d305a66 types: Make from_string() work on sstring_view 2015-02-12 19:40:58 +01:00
Tomasz Grabiec
f1c9f64a25 types: Implement string conversions for int32_type and string_type 2015-02-09 10:28:44 +01:00
Tomasz Grabiec
f61d637cdb types: Mark bytes_type as byte order comparable 2015-01-29 15:02:27 +01:00
Tomasz Grabiec
65d2707794 types: Add support for equality and hashing of serialized values 2015-01-29 15:02:27 +01:00
Tomasz Grabiec
b0215f0fdc types: Mark string_type as byte order comparable 2015-01-29 15:02:26 +01:00
Tomasz Grabiec
ddcc750210 types: Mark date_type as byte order comparable and compare as such 2015-01-29 15:02:26 +01:00
Tomasz Grabiec
17b9babd91 Extract types related stuff from database.{cc,hh} to types.{cc,hh} 2015-01-29 15:02:19 +01:00