Commit Graph

21 Commits

Author SHA1 Message Date
Asias He
18435837dd Add abstract_type::compare_unsigned() helper 2015-01-15 09:05:48 +08:00
Avi Kivity
50f280261c db: fix definition of int32_type 2015-01-14 11:38:41 +02:00
Glauber Costa
7f96fc9509 db: read all keyspaces from directory structure
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>
2015-01-13 10:41:13 +02:00
Avi Kivity
99489ff580 db: add uuid type 2015-01-12 14:21:19 +02:00
Avi Kivity
df83ccec41 db: add bytes_opt (=optional<bytes>) 2015-01-12 11:18:47 +02:00
Avi Kivity
c05640fb5d db: add to_hex(bytes) 2015-01-12 11:18:25 +02:00
Avi Kivity
a7723cf641 db: add timestamp type
Based on db_clock::time_point
2015-01-11 15:46:03 +02:00
Avi Kivity
a5c98d32c3 db: add timeuuid type 2015-01-11 15:46:03 +02:00
Avi Kivity
4b4f1606e6 db: add date_type 2015-01-06 15:27:17 +02:00
Avi Kivity
cfd86d70f8 db: extract default compare method into a default_less<> helper
The helper is a little more flexible in that it accepts a comparator,
instead of using <.
2015-01-06 15:26:45 +02:00
Avi Kivity
a191d598c2 db: implement boolean type 2015-01-06 15:26:40 +02:00
Avi Kivity
e733c2a45a db: change abstract_type::deserialize to allow null objects
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.
2015-01-06 12:49:47 +02:00
Avi Kivity
1fe6bf687d db: de-pimpl data_type
Since origin tends to cast around, we should allow that too, by exposing
the implementation type and using a shared_ptr instead of a value class.
2015-01-05 15:55:30 +02:00
Avi Kivity
82c4920f1c db: copy correct partition_key_type
Specify this-> so we use the variable we just moved into, rather than the
one we just moved from.
2015-01-05 14:03:47 +02:00
Avi Kivity
80408329e0 db: rename data types to conform to origin conventions 2015-01-05 13:48:38 +02:00
Avi Kivity
efc868d1e6 db: extend data_type to be able to support dynamic types
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.
2015-01-05 13:26:56 +02:00
Avi Kivity
f09684aba2 db: non-creating find_partition() and find_row()
Find a partition or row using the key, return null if not found.
2014-12-28 13:42:25 +02:00
Avi Kivity
58e64ea231 db: add helpers for finding/inserting a row or partition 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
ab26aef422 db: add data_type::less()
Compares two values belonging to a data type.
2014-12-28 10:03:17 +02:00
Avi Kivity
641c859903 db: add in-memory database
Simplistic database using std::map<> to hold rows, and boost::any to
hold values.

Supports:
  - multiple key spaces
  - multiple column families
  - a few data types

Does not support:
  - container data types
  - secondary indexes
  - composites
  - validators
2014-12-23 18:41:29 +02:00