Commit Graph

29 Commits

Author SHA1 Message Date
Tomasz Grabiec
89aa2f75e5 thrift: Fix name clash between unimplemented() and namespace "unimplemented" 2015-03-11 14:56:10 +01:00
Avi Kivity
a49330095a db: wrap bytes in atomic_cell format
We use bytes for many different things, and it is easy to get confused as
to what format the data is actually in.

Fix that for atomic_cell by proving wrappers.  atomic_cell::one corresponds
to a bytes object holding exactly one atomic cell, and atomic_cell::view is
a bytes_view to an atomic_cell.  The static functions of atomic_cell itself
are privatized to prevent the unwashed masses from using them on the wrong
objects.

Since a row entry can hold either a an atomic cell, or a collection,
depending on the schema, also introduce a variant type
atomic_cell_or_collection and allow the user to pick the type explicitly.
Internally both are stored as bytes object.
2015-03-04 15:49:35 +02:00
Tomasz Grabiec
74295a9759 db: Use opaque bytes for cell values instead of boost::any
Storing cells as boost::any objects makes us use expensive
boost::any_cast to access the data. This change replaces boost::any
with bytes object which holds the value in serialized form (the same
as will be used for on-wire format).

If the cell type is atomic, you use fields accessors defined in
atomic_cell class, eg like this:

if (column.type.is_atomic()) {
   if (atomic_cell::is_live(c) {
      auto timestamp = atomic_cell::timestamp(c);
      ...
   }
}

Eventually we could switch to a more officient semi-serialized form
with native byte order but I don't want to introduce it just yet for
simplicity.
2015-02-27 10:59:43 +01:00
Tomasz Grabiec
a61d9ee18e schema: Add static columns to schema 2015-02-27 10:48:56 +01:00
Avi Kivity
2720ba34bf db: shard data
Add database::shard_of() to compute the shard hosting the partition
(with a simplistic algorithm, but perhaps not too bad).

Convert non-metadata invoke_on_all() and local calls on the database
to use shard_of().
2015-02-23 11:37:12 +02:00
Avi Kivity
0db67ff121 thrift: add foreign_ptr<> variant to complete()
Some calls will return complex types, so allow them to return a foreign_ptr<>
to ensure cleanup will happen in the correct place.
2015-02-23 11:37:12 +02:00
Avi Kivity
cb63d16b40 thrift: get rid of useless try/catch
Exceptions are now handled with then_wrapped(), nothing is left to catch.
2015-02-19 18:00:03 +02:00
Avi Kivity
70381a6da5 db: distribute database object
s/database/distributed<database>/ everywhere.

Use simple distribution rules: writes are broadcast, reads are local.
This causes tremendous data duplication, but will change soon.
2015-02-19 17:53:13 +02:00
Avi Kivity
3ec83658f3 thrift: store the keyspace name in set_keyspace()
The keyspace pointer is only valid for the local shard.
2015-02-19 15:55:17 +02:00
Avi Kivity
93818692e1 thrift: add adapter from futures to thrift completion objects
Futures hold either a value or an exception; thrift uses two separate
function objects to signal completion, one for success, the other for
an exception.

Add a helper to pass the result of a future to either of these.
2015-02-19 09:32:18 +02:00
Avi Kivity
96a93a2d8c thrift: add workaround for compile breakage due to thrift code generator 2015-02-19 09:32:18 +02:00
Tomasz Grabiec
2244eab6c1 db: Steal data from mutations when applying
Taking mutations by r-value reference allows us to avoid copies.
2015-02-09 10:28:44 +01:00
Tomasz Grabiec
48c11a01db db: Add ability to apply mutations into the database
For simplicity partition data is stored using the same object which is
used for mutations: mutation_partition. Later we can introduce a more
efficient version.
2015-02-09 10:28:44 +01:00
Tomasz Grabiec
654372f368 schema: Allow regular column names to have arbitrary type
Regular columns may have names of arbitrary type. See
https://issues.apache.org/jira/browse/CASSANDRA-8178

Primary key columns are UTF8.

This change also does some refactoring of the schema object to make
the change easier to digest (more encapsulation).
2015-02-04 10:29:00 +01:00
Tomasz Grabiec
4d41d10d99 Extract schema to a separate class 2015-01-29 15:53:05 +01:00
Avi Kivity
80408329e0 db: rename data types to conform to origin conventions 2015-01-05 13:48:38 +02:00
Avi Kivity
1b837160f1 thrift: drop unneeded using declaration 2015-01-05 13:26:55 +02:00
Avi Kivity
833d5c2262 thrift: fix get_slice column index calculations
Both lower and upper bound calculations were broken.

Fix by using iterators instead of calculating indices using std::distance().
2014-12-30 15:34:27 +02:00
Avi Kivity
1ce15a9466 thrift: partial support for get_slice() 2014-12-28 13:42:25 +02:00
Avi Kivity
45cd105571 db: sort column names
Cassandra allows even regular columns to be treated as a sorted map
(column name -> value), accessing it with get_slice(), so sort the column
names to support this.
2014-12-28 13:42:25 +02:00
Avi Kivity
39176a9439 thrift: partially implement batch_mutate()
Only mutate case (not deletion) for ordinary columns.
2014-12-28 10:03:17 +02:00
Avi Kivity
baa16f6692 thrift: stub execute_cql3_query()
Allows us to proceed further with cassandra-stress.
2014-12-28 10:03:17 +02:00
Avi Kivity
9951a68836 thrift: add exception helpers
Thrift-generated exceptions lack reasonable constructors, so add helpers.
2014-12-28 10:03:17 +02:00
Avi Kivity
de349cd205 db: store keys and values as serialized bytes, not boost::any
While less efficient, it's similar to what origin does, so will be easier
to follow.
2014-12-28 10:03:17 +02:00
Avi Kivity
a7360a3ce1 thrift: implement set_keyspace RPC 2014-12-24 09:40:52 +02:00
Avi Kivity
72ab87f41f thrift: support system_add_keyspace 2014-12-23 18:41:29 +02:00
Avi Kivity
4a3f3847e8 thrift: support set_cql_version 2014-12-23 18:41:29 +02:00
Avi Kivity
a49fd99327 thrift: create a database and pass it to the server
Not sharded yet.
2014-12-23 18:41:29 +02:00
Avi Kivity
094329a95e Move apps/seastar/* to top level 2014-12-22 16:15:37 +02:00