Commit Graph

2310 Commits

Author SHA1 Message Date
Asias He
febf32acfa gossip: Add default constructor for endpoint_state 2015-03-18 09:07:42 +08:00
Asias He
4772d18a6c gossip: Return reference in endpoint_state::get_application_state_map 2015-03-18 09:07:42 +08:00
Asias He
2f693d93e0 gossip: Return optional in endpoint_state::get_application_state 2015-03-18 09:07:42 +08:00
Asias He
b0c1be2412 gossip: Introduce the_failure_detector()
The global failure_detector instance.
2015-03-18 09:07:41 +08:00
Asias He
d4395c2d5d gossip: Rename beforechange to before_change 2015-03-18 09:07:41 +08:00
Asias He
40c1f6a4db gossip: Add operator== for inet_address 2015-03-18 09:07:41 +08:00
Avi Kivity
5a6bef867c Merge branch 'master' of github.com:cloudius-systems/seastar into urchin 2015-03-17 15:48:42 +02:00
Tomasz Grabiec
a7d6e22baf sstring: fix bounds checks in find()
'end' iterator was set past the end if pos != 0.
2015-03-17 15:37:54 +02:00
Avi Kivity
d49804ad73 cql: maps: drop unused Java declarations 2015-03-16 18:27:42 +02:00
Tomasz Grabiec
a757041fdd Merge tag 'avi/serialization_format/v2'
From Avi:

The protocol_version variable is problematic for two reasons:
- as an integer, it can get confused with a nearby unrelated integer argument
- it represents a layering violation, where the transport protocol leaks into
  the database layer

Fix by abstracting it with a new serialization_format class.  The transport
layer converts protocol_version to serialization_format.
2015-03-16 17:19:59 +01:00
Avi Kivity
6fee695095 db: replace most uses of protocol_version with serialization_format
Better type safety.
2015-03-16 18:15:16 +02:00
Avi Kivity
2ae36bdc98 maps: fix parameter mismatch in call to get_with_protocol_version() 2015-03-16 18:10:09 +02:00
Avi Kivity
0710704311 transport: propagate serialization_format to query_options 2015-03-16 18:10:09 +02:00
Avi Kivity
3aa8231c7a db: add serialization_format class
This is an abstraction layer boundary between transport and the rest of the
code.  Instead of the protocol version permeating through the code, encapsulate
it in a serialization_format variable.

This is intended to replace all uses of protocol_version outside transport.
2015-03-16 18:10:09 +02:00
Tomasz Grabiec
5c1ec6f046 Merge tag 'avi/collections/some-set-ops/v3'
From Avi:

Supports cql syntax:

  set set_column = { 1, 2, 3 }
  set set_column = set_col + { 1, 2, 3 }
2015-03-16 16:14:44 +01:00
Avi Kivity
c99185677b tests: add test for set literals and set addiitions 2015-03-16 16:45:36 +02:00
Avi Kivity
e28938b8d6 tests: fix cql_query_test indentation 2015-03-16 16:45:36 +02:00
Avi Kivity
333e48230f cql: convert prepend/addition grammar 2015-03-16 16:45:36 +02:00
Avi Kivity
8d94ab490a cql: implement operation::set_value for sets 2015-03-16 16:45:36 +02:00
Avi Kivity
a6a186fd8c cql: convert operation::prepend to C++ 2015-03-16 16:45:36 +02:00
Avi Kivity
9b77f7cc8a cql: convert operation::subtraction to C++ 2015-03-16 16:45:36 +02:00
Avi Kivity
807c5e6eb2 cql: convert operation::addition to C++ 2015-03-16 16:45:34 +02:00
Avi Kivity
ae1d622591 cql: convert sets::setter to C++ 2015-03-16 16:44:00 +02:00
Avi Kivity
e903a3b2c6 cql: convert sets::adder to C++ 2015-03-16 16:44:00 +02:00
Avi Kivity
e8f3776c15 cql: make sets::value::_elements public
Users of a value will want to make use of it.
2015-03-16 16:44:00 +02:00
Avi Kivity
44c929f6f5 cql: convert maps::putter to C++ 2015-03-16 16:44:00 +02:00
Avi Kivity
aa8834a260 cql: add column_identifier::operator!=() 2015-03-16 16:44:00 +02:00
Avi Kivity
d7023d54b8 cql: enable grammar for set literals 2015-03-16 16:44:00 +02:00
Avi Kivity
83d7e24469 cql3: convert sets::literal, sets::value, sets::delayed_value to C++ 2015-03-16 16:43:59 +02:00
Avi Kivity
923496056a db: add set_type_impl::serialize_partially_deserialized_form() 2015-03-16 16:36:14 +02:00
Avi Kivity
0d0a4192f4 db: add mutation::set_cell() helper
Rather than checking for a static vs. clustered cell at the call site,
to this in one place.
2015-03-16 16:36:14 +02:00
Avi Kivity
4bbfc3c23b db: export collection_type_impl::pack() 2015-03-16 16:36:14 +02:00
Avi Kivity
7a235e031b unimplemented: add collection range tombstones 2015-03-16 16:36:14 +02:00
Avi Kivity
1ac75b1609 db: add to_hex(bytes_view) variant
Useful for debugging.
2015-03-16 16:36:14 +02:00
Avi Kivity
f3d75d3169 db: fix listlike_partial_deserializing_iterator taking reference to temporary 2015-03-16 16:36:14 +02:00
Asias He
5f2c156d41 gossip: Convert to use bytes version of serialize 2015-03-16 12:46:37 +01:00
Asias He
2e24dc93f4 util: Add bytes version of serialize_string 2015-03-16 12:46:37 +01:00
Asias He
b9a67c6d67 util: Add bytes version of serialize_int8 2015-03-16 12:46:37 +01:00
Avi Kivity
ceb4778ad2 Merge branch 'log-exceptions' 2015-03-16 10:14:23 +02:00
Nadav Har'El
c0d7e4e748 core: implement future<> sleep()
Seastar applications obviously cannot use the Posix sleep() function, or
the entire thread will block. This patch implements future<> sleep(duration)
where as expected, the future becomes ready when the given duration passes.

For example, one can do:

    sleep(1s).then([] { std::cout << "Done.\n"; });

This can be useful as an example of futures and continuations in the
Seastar tutorial, and people might find other uses for it.

This sleep() is implemented in terms of timer<>. sleep() is easier to use
and more aligned with the rest of Seastar (it uses then() for the
continuation instead of a set_callback() method). The downside of sleep()
compared to a timer is that it cannot be canceled once started.

In this version, sleep() is implemented without shared_ptr, making the
implementation a tiny bit more efficient. There is still a heap allocation
(this is unavoidable because std::function requires a copyable type)
but no reference counting. Unfortunately, this requires us to use bare
"new" and "delete".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-16 10:02:06 +02:00
Avi Kivity
facb2ffdc6 build: allow disabling debug info generation
Closes #37.
2015-03-16 07:53:54 +02:00
Dor Laor
7921ef406a db: serialize via bytes_iterator instead of std::ostream
Instead of using inefficient std::ostream, use our own 'bytes' iterator class.
Compute ahead of time the length of the byte buffer.
Afterwards serialize the objects into it.

Gives ~X5 boost over previus results (that sometimes don't even
finish in reasonable time)

[avi: add missing include]
2015-03-16 07:07:25 +02:00
Dor Laor
a9e77e1211 uuid: add 'bytes' serialization helpers 2015-03-16 06:58:30 +02:00
Dor Laor
29c21f1eda db: move tiny write util template to serialization.hh 2015-03-16 06:58:23 +02:00
Avi Kivity
e6828d7ad0 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Conflicts:
	configure.py
2015-03-15 20:39:30 +02:00
Avi Kivity
d2c0e485f8 posix: fix posix::recv return
Shuts up warning in gcc 5, and is aligned with the other methods.
2015-03-15 20:18:17 +02:00
Avi Kivity
24bc1b4126 build: improve seastar.pc generation
Generate at build time, so it gets rebuilt even if build/ is wiped out.
2015-03-15 18:13:29 +02:00
Nadav Har'El
25c37c92f5 core: fix engine_exit()
engine_exit() without a parameter is meant to do engine().exit(0).
We do this, but forget to return from this function, so after calling
engine().exit(0), it continued on and crashed.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-15 16:17:25 +02:00
Avi Kivity
f8c69904cd build: fix seastar.pc generation
Need to ensure the directory is there first.
2015-03-15 16:16:41 +02:00
Nadav Har'El
3578d3d016 build: make it easy to compile a Seastar-based project
This patch makes compiling a file "hello.cc" using seastar as simple as:

g++ `pkg-config --cflags --libs build/release/seastar.pc` hello.cc

Our current build system makes it very hard for users to build a project
*using* Seastar - basically requiring them to integrate their project into
the Seastar tree and its Makefile into our "ninja" framework.

This patch simplifies things considerably by doing two things:

First it builds an archive of all Seastar objects - build/$mode/libseastar.a.

But this in itself is not enough - the user wouldn't know how to use it
(currently, -Wl,--whole-archive is needed, unfortunately, because of reliance
of C++ static constructors), and will also need a long list of other
libraries, as wall as various definitions and include paths during compilation.

The solution is to use pkg-config, which has become the de-facto standard
method on Linux for makefiles to figure out how to compile with a certain
library. With this patch, someone can do this for example, to compile
tests/fileiotests.cc:

g++ `pkg-config --cflags --libs build/release/seastar.pc` tests/fileiotest.cc

Note how we have a different ".pc" file for each mode, with the appropriate
compile and link flags. A more eleborate example with separate compile and
link stages will use "pkg-config --cflags" on the compilation stage, and
"--libs" on the linking stage.

Eventually, we should have a "ninja install", which will install libseastar.a
and seastar.pc to their system-wide default location, and then the above
command line will become as simple as:

g++ `pkg-config --cflags --libs seastar` tests/fileiotest.cc

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-15 15:49:48 +02:00