Use the keyspace_metadata type for keyspace creation functions. This is
needed to be able to have a mapping from keyspace name to keyspace
metadata for various call-sites.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
The API needs the database distribute object to get information from it.
This adds a database reference the API context so it would be
available in the API.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Pekka says:
"We are going to keep the ks_meta_data class around and use it in core
code like the migration manager. Therefore, clean up the class and move
it to the database.hh where user_types_metadata also is defined in. As a
bonus, this also fixes the circular dependency between ks_meta_data.hh
and database.hh."
Follow the naming convention set by user_types_metadata and rename
ks_meta_data to keyspace_metadata.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
The implementation part of ks_meta_data is just few lines of code.
Inline that to the database.hh header file.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
The code generation generate an enum_wrapper for the enum that defined
in the swagger definition file.
This patch adds more functionality to the enum_wrapper:
It is now possible to cast the enum to other enum if wrapped enum is a
subset of the target enum, this is a reverse functionality of
constructing an enum from another enum.
The wrapper now support comparison operator, begin, end method and the
++ operator, with that the boost::irange is used to return a range
object so the the enum values can be iterate using for range loop.
This is an example of the added methods, After code generation:
template<class T>
operator T() const {
switch(v) {
case my_object_enum_var::VAL1: return T::VAL1;
case my_object_enum_var::VAL2: return T::VAL2;
case my_object_enum_var::VAL3: return T::VAL3;
default: return T::VAL1;
}
}
typedef typename std::underlying_type<my_object_enum_var>::type
pos_type;
enum_var_wrapper& operator++() {
v = static_cast<my_object_enum_var>(static_cast<pos_type>(v) + 1);
return *this;
}
enum_var_wrapper& operator++(int) {
return ++(*this);
}
bool operator==(const enum_var_wrapper& c) const {
return v == c.v;
}
bool operator!=(const enum_var_wrapper& c) const {
return v != c.v;
}
bool operator<=(const enum_var_wrapper& c) const {
return static_cast<pos_type>(v) <= static_cast<pos_type>(c.v);
}
static enum_var_wrapper begin() {
return enum_var_wrapper(my_object_enum_var::VAL1);
}
static enum_var_wrapper end() {
return enum_var_wrapper(my_object_enum_var::NUM_ITEMS);
}
static boost::integer_range<enum_var_wrapper> all_items() {
return boost::irange(begin(), end());
}
This generated code code be found after compilation at:
./build/release/gen/apps/httpd/demo.json.hh
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Pekka says:
"There's a user_types_metadata type defined in database.hh. Use that and
remove the left-over ut_meta_data from initial CQL translations."
Conflicts:
thrift/handler.cc
There's a user_types_metadata type in database.hh. Use it and drop the
left-over ut_meta_data from Origin.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Move ks_meta_data code out of line in preparation for switching to the
user_types_metadata type that is defined in database.hh.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This is slightly awkwards, since the directory structure is not sharded.
This requires some processing to occur outside the shard, while the rest
is sharded.
Returning a reference to the keyspace is dangerous in that the keyspace can
be moved away, when we start futurizing the add_keyspace() process. Make
it return void and look up the keyspace at the point of use.
This patchset adds thread support to seastar. Threads can use the normal
seastar API, and may also "block" by calling future<>::get() on an
unavailable future. Synchronous and asynchronous code may be intermixed.
Threads may not issue blocking operating system calls.
This adds a counters to net protocol client.
The client would holds counter for the successfully completed, the
exception recieved and as the sent queue is based on the future queue
a counter for pending to sent messages.
The number of messages that waiting for reply is retrieved from the size
of the outstanding table.
The counters are updated by the helper send function as part of the
messages sending flow.
The counters are part of the stat structure and the client has an
internal getter to be able to change their values and a getter that
returns a copy of the counters.
swapcontext() is expensive as it invokes system calls. Replace it with
setjmp()/longjmp(). We still use setcontext() initially, since that's
the most reasonable portable method of setting up a stack.
Context switch time (measured by thread_context_switch) is reduced to
120ns (from 450ns), with inefficiencies in the test itself and in future<>
dominating.
Add a thread class that can be used to launch a blockable thread of
execution. Within a thread, future<>::get() can be called on an
unavailable future, in which case it blocks until the future is made ready.
Add methods to get and manipulate the current bloom filter false positive
chance - this is a per-cf field that lives in CFMetaData for Origin, so we'll
have it in the schema.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Following what happened to others: we can now include memtable.hh
without including database.hh
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>