In Origin, some places in CQL3 package treat ColumnDefinition as
ColumnSpecification. Origin solves that by making ColumnDefinition
extend ColumnSpecification.
I find it much simpler to provide an external adapter, which is cached
as a field for efficiency. Another, more important, reason for this
solution is that column_specifications are passed around as
shared_ptrs and I don't want to add unnecessary indirection to
column_definition accesses just because of that, to make it inherit
from column_specification.
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).
This patch includes a helper function that executes a function for each entry
in a directory. It is future based and can include in the future, future-based
code to asychronously read, for instance, an sstable.
At the moment, it only scan all keyspaces and make sure they appear in the
keyspaces hash.
Both the database and keyspace classes gain a populate<T> factory that returns a
populated database. At this point, the names found are just listed, but not really
stored anywhere.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This is the directory from which we will read the sstables.
Code to actually parse them will come later.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
In some cases, deserialize() can return a null object (if there were zero
input bytes).
In others, it cannot (for string or blob types).
Change the return type to optional<any> and adapt the deserialiation code
to deal with it.
Dynamic types come and go, so they need to be reference counted.
Switch data_type to using a shared_ptr<> for its implementation.
Since thread_ptr is not thread safe, the global primitive types must be
thread_local.
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.