├── .gitignore ├── .tarballignore ├── LICENSE ├── Makefile.am ├── README ├── SIGNED-OFF-BY ├── TODO ├── bindings ├── c │ └── testcompile.c └── python │ ├── consus.pyx │ └── setup.py ├── client ├── c.cc ├── client.cc ├── client.h ├── configuration.cc ├── configuration.h ├── consus-internal.h ├── controller.cc ├── controller.h ├── pending.cc ├── pending.h ├── pending_begin_transaction.cc ├── pending_begin_transaction.h ├── pending_string.cc ├── pending_string.h ├── pending_transaction_abort.cc ├── pending_transaction_abort.h ├── pending_transaction_commit.cc ├── pending_transaction_commit.h ├── pending_transaction_read.cc ├── pending_transaction_read.h ├── pending_transaction_write.cc ├── pending_transaction_write.h ├── server_selector.cc ├── server_selector.h ├── transaction.cc └── transaction.h ├── common ├── background_thread.cc ├── background_thread.h ├── client_configuration.cc ├── client_configuration.h ├── constants.h ├── consus.cc ├── consus.h ├── coordinator_link.cc ├── coordinator_link.h ├── coordinator_returncode.cc ├── coordinator_returncode.h ├── crc32c.cc ├── crc32c.h ├── data_center.cc ├── data_center.h ├── generate_token.cc ├── generate_token.h ├── ids.cc ├── ids.h ├── kvs.cc ├── kvs.h ├── kvs_configuration.cc ├── kvs_configuration.h ├── kvs_state.cc ├── kvs_state.h ├── lock.cc ├── lock.h ├── macros.h ├── network_msgtype.cc ├── network_msgtype.h ├── partition.cc ├── partition.h ├── paxos_group.cc ├── paxos_group.h ├── ring.cc ├── ring.h ├── transaction_group.cc ├── transaction_group.h ├── transaction_id.cc ├── transaction_id.h ├── transmit_limiter.h ├── txman.cc ├── txman.h ├── txman_configuration.cc ├── txman_configuration.h ├── txman_state.cc ├── txman_state.h ├── util.cc └── util.h ├── configure.ac ├── consus-debug.cc ├── consus.cc ├── consus.supp ├── coordinator ├── coordinator.cc ├── coordinator.h ├── symtable.c ├── transitions.cc ├── transitions.h └── util.h ├── doc ├── .gitignore ├── Makefile ├── assert-same.py ├── consus.tex ├── consus.xtx ├── environs.tex ├── install │ ├── empty │ ├── fedora23-python-prereqs │ ├── fedora23-src-prereqs │ ├── fedora24-python-prereqs │ ├── fedora24-src-prereqs │ ├── fedora25-python-prereqs │ ├── fedora25-src-prereqs │ ├── git │ ├── linux-amd64 │ ├── linux-amd64-home │ ├── source │ ├── ubuntu12.04-python-prereqs │ ├── ubuntu12.04-src-prereqs │ ├── ubuntu14.04-git-prereqs │ ├── ubuntu14.04-python-prereqs │ ├── ubuntu14.04-src-prereqs │ ├── ubuntu16.04-git-prereqs │ ├── ubuntu16.04-python-prereqs │ ├── ubuntu16.04-src-prereqs │ ├── ubuntu16.10-git-prereqs │ ├── ubuntu16.10-python-prereqs │ └── ubuntu16.10-src-prereqs ├── installation.tex └── latex.py ├── include ├── consus-admin.h └── consus.h ├── kvs ├── configuration.cc ├── configuration.h ├── controller.cc ├── controller.h ├── daemon.cc ├── daemon.h ├── datalayer.cc ├── datalayer.h ├── leveldb_datalayer.cc ├── leveldb_datalayer.h ├── lock_manager.cc ├── lock_manager.h ├── lock_replicator.cc ├── lock_replicator.h ├── lock_state.cc ├── lock_state.h ├── main.cc ├── migrator.cc ├── migrator.h ├── read_replicator.cc ├── read_replicator.h ├── replica_set.cc ├── replica_set.h ├── table_key_pair.cc ├── table_key_pair.h ├── write_replicator.cc └── write_replicator.h ├── libconsus.pc.in ├── m4 ├── anal_warnings.m4 ├── ax_check_compile_flag.m4 ├── ax_check_link_flag.m4 └── ax_check_preproc_flag.m4 ├── maint ├── generate-gremlin-include ├── generate-unit-test-gremlins └── valgrind-gremlins ├── man ├── consus-availability-check.1.md ├── consus-coordinator.1.md ├── consus-create-data-center.1.md ├── consus-debug-client-configuration.1.md ├── consus-debug-kvs-configuration.1.md ├── consus-debug-txman-configuration.1.md ├── consus-debug.1.md ├── consus-key-value-store.1.md ├── consus-set-default-data-center.1.md ├── consus-transaction-manager.1.md └── consus.1.md ├── namespace.h ├── test ├── 1-node-1-dc-cluster.gremlin ├── 1-node-2-dc-cluster.gremlin ├── 1-node-3-dc-cluster.gremlin ├── 1-node-4-dc-cluster.gremlin ├── 1-node-5-dc-cluster.gremlin ├── 1-node-6-dc-cluster.gremlin ├── 1-node-7-dc-cluster.gremlin ├── 2-node-1-dc-cluster.gremlin ├── 3-node-1-dc-cluster.gremlin ├── 3-node-2-dc-cluster.gremlin ├── 3-node-3-dc-cluster.gremlin ├── 3-node-4-dc-cluster.gremlin ├── 3-node-5-dc-cluster.gremlin ├── 3-node-6-dc-cluster.gremlin ├── 3-node-7-dc-cluster.gremlin ├── 4-node-1-dc-cluster.gremlin ├── 5-node-1-dc-cluster.gremlin ├── 5-node-2-dc-cluster.gremlin ├── 5-node-3-dc-cluster.gremlin ├── 5-node-4-dc-cluster.gremlin ├── 5-node-5-dc-cluster.gremlin ├── 5-node-6-dc-cluster.gremlin ├── 5-node-7-dc-cluster.gremlin ├── demo.gremlin ├── env.sh ├── paxos │ ├── generalized-brute-force.cc │ ├── generalized-counter-example-generator.cc │ ├── generalized-performance.cc │ └── generalized.cc ├── th.cc ├── th.h ├── th_main.cc └── unit │ ├── 00.client.1n.1dc.gremlin │ ├── 00.client.1n.2dc.gremlin │ ├── 00.client.1n.3dc.gremlin │ ├── 00.client.1n.4dc.gremlin │ ├── 00.client.1n.5dc.gremlin │ ├── 00.client.1n.6dc.gremlin │ ├── 00.client.1n.7dc.gremlin │ ├── 00.client.2n.1dc.gremlin │ ├── 00.client.3n.1dc.gremlin │ ├── 00.client.3n.2dc.gremlin │ ├── 00.client.3n.3dc.gremlin │ ├── 00.client.3n.4dc.gremlin │ ├── 00.client.3n.5dc.gremlin │ ├── 00.client.3n.6dc.gremlin │ ├── 00.client.3n.7dc.gremlin │ ├── 00.client.4n.1dc.gremlin │ ├── 00.client.5n.1dc.gremlin │ ├── 00.client.5n.2dc.gremlin │ ├── 00.client.5n.3dc.gremlin │ ├── 00.client.5n.4dc.gremlin │ ├── 00.client.5n.5dc.gremlin │ ├── 00.client.5n.6dc.gremlin │ ├── 00.client.5n.7dc.gremlin │ ├── 00.client.py │ ├── 00.nop-abort.1n.1dc.gremlin │ ├── 00.nop-abort.1n.2dc.gremlin │ ├── 00.nop-abort.1n.3dc.gremlin │ ├── 00.nop-abort.1n.4dc.gremlin │ ├── 00.nop-abort.1n.5dc.gremlin │ ├── 00.nop-abort.1n.6dc.gremlin │ ├── 00.nop-abort.1n.7dc.gremlin │ ├── 00.nop-abort.2n.1dc.gremlin │ ├── 00.nop-abort.3n.1dc.gremlin │ ├── 00.nop-abort.3n.2dc.gremlin │ ├── 00.nop-abort.3n.3dc.gremlin │ ├── 00.nop-abort.3n.4dc.gremlin │ ├── 00.nop-abort.3n.5dc.gremlin │ ├── 00.nop-abort.3n.6dc.gremlin │ ├── 00.nop-abort.3n.7dc.gremlin │ ├── 00.nop-abort.4n.1dc.gremlin │ ├── 00.nop-abort.5n.1dc.gremlin │ ├── 00.nop-abort.5n.2dc.gremlin │ ├── 00.nop-abort.5n.3dc.gremlin │ ├── 00.nop-abort.5n.4dc.gremlin │ ├── 00.nop-abort.5n.5dc.gremlin │ ├── 00.nop-abort.5n.6dc.gremlin │ ├── 00.nop-abort.5n.7dc.gremlin │ ├── 00.nop-abort.py │ ├── 00.nop-commit.1n.1dc.gremlin │ ├── 00.nop-commit.1n.2dc.gremlin │ ├── 00.nop-commit.1n.3dc.gremlin │ ├── 00.nop-commit.1n.4dc.gremlin │ ├── 00.nop-commit.1n.5dc.gremlin │ ├── 00.nop-commit.1n.6dc.gremlin │ ├── 00.nop-commit.1n.7dc.gremlin │ ├── 00.nop-commit.2n.1dc.gremlin │ ├── 00.nop-commit.3n.1dc.gremlin │ ├── 00.nop-commit.3n.2dc.gremlin │ ├── 00.nop-commit.3n.3dc.gremlin │ ├── 00.nop-commit.3n.4dc.gremlin │ ├── 00.nop-commit.3n.5dc.gremlin │ ├── 00.nop-commit.3n.6dc.gremlin │ ├── 00.nop-commit.3n.7dc.gremlin │ ├── 00.nop-commit.4n.1dc.gremlin │ ├── 00.nop-commit.5n.1dc.gremlin │ ├── 00.nop-commit.5n.2dc.gremlin │ ├── 00.nop-commit.5n.3dc.gremlin │ ├── 00.nop-commit.5n.4dc.gremlin │ ├── 00.nop-commit.5n.5dc.gremlin │ ├── 00.nop-commit.5n.6dc.gremlin │ ├── 00.nop-commit.5n.7dc.gremlin │ ├── 00.nop-commit.py │ ├── 10.single-get.1n.1dc.gremlin │ ├── 10.single-get.1n.2dc.gremlin │ ├── 10.single-get.1n.3dc.gremlin │ ├── 10.single-get.1n.4dc.gremlin │ ├── 10.single-get.1n.5dc.gremlin │ ├── 10.single-get.1n.6dc.gremlin │ ├── 10.single-get.1n.7dc.gremlin │ ├── 10.single-get.2n.1dc.gremlin │ ├── 10.single-get.3n.1dc.gremlin │ ├── 10.single-get.3n.2dc.gremlin │ ├── 10.single-get.3n.3dc.gremlin │ ├── 10.single-get.3n.4dc.gremlin │ ├── 10.single-get.3n.5dc.gremlin │ ├── 10.single-get.3n.6dc.gremlin │ ├── 10.single-get.3n.7dc.gremlin │ ├── 10.single-get.4n.1dc.gremlin │ ├── 10.single-get.5n.1dc.gremlin │ ├── 10.single-get.5n.2dc.gremlin │ ├── 10.single-get.5n.3dc.gremlin │ ├── 10.single-get.5n.4dc.gremlin │ ├── 10.single-get.5n.5dc.gremlin │ ├── 10.single-get.5n.6dc.gremlin │ ├── 10.single-get.5n.7dc.gremlin │ ├── 10.single-get.py │ ├── 10.single-put.1n.1dc.gremlin │ ├── 10.single-put.1n.2dc.gremlin │ ├── 10.single-put.1n.3dc.gremlin │ ├── 10.single-put.1n.4dc.gremlin │ ├── 10.single-put.1n.5dc.gremlin │ ├── 10.single-put.1n.6dc.gremlin │ ├── 10.single-put.1n.7dc.gremlin │ ├── 10.single-put.2n.1dc.gremlin │ ├── 10.single-put.3n.1dc.gremlin │ ├── 10.single-put.3n.2dc.gremlin │ ├── 10.single-put.3n.3dc.gremlin │ ├── 10.single-put.3n.4dc.gremlin │ ├── 10.single-put.3n.5dc.gremlin │ ├── 10.single-put.3n.6dc.gremlin │ ├── 10.single-put.3n.7dc.gremlin │ ├── 10.single-put.4n.1dc.gremlin │ ├── 10.single-put.5n.1dc.gremlin │ ├── 10.single-put.5n.2dc.gremlin │ ├── 10.single-put.5n.3dc.gremlin │ ├── 10.single-put.5n.4dc.gremlin │ ├── 10.single-put.5n.5dc.gremlin │ ├── 10.single-put.5n.6dc.gremlin │ ├── 10.single-put.5n.7dc.gremlin │ ├── 10.single-put.py │ ├── 11.put-get-separate-commits.1n.1dc.gremlin │ ├── 11.put-get-separate-commits.1n.2dc.gremlin │ ├── 11.put-get-separate-commits.1n.3dc.gremlin │ ├── 11.put-get-separate-commits.1n.4dc.gremlin │ ├── 11.put-get-separate-commits.1n.5dc.gremlin │ ├── 11.put-get-separate-commits.1n.6dc.gremlin │ ├── 11.put-get-separate-commits.1n.7dc.gremlin │ ├── 11.put-get-separate-commits.2n.1dc.gremlin │ ├── 11.put-get-separate-commits.3n.1dc.gremlin │ ├── 11.put-get-separate-commits.3n.2dc.gremlin │ ├── 11.put-get-separate-commits.3n.3dc.gremlin │ ├── 11.put-get-separate-commits.3n.4dc.gremlin │ ├── 11.put-get-separate-commits.3n.5dc.gremlin │ ├── 11.put-get-separate-commits.3n.6dc.gremlin │ ├── 11.put-get-separate-commits.3n.7dc.gremlin │ ├── 11.put-get-separate-commits.4n.1dc.gremlin │ ├── 11.put-get-separate-commits.5n.1dc.gremlin │ ├── 11.put-get-separate-commits.5n.2dc.gremlin │ ├── 11.put-get-separate-commits.5n.3dc.gremlin │ ├── 11.put-get-separate-commits.5n.4dc.gremlin │ ├── 11.put-get-separate-commits.5n.5dc.gremlin │ ├── 11.put-get-separate-commits.5n.6dc.gremlin │ ├── 11.put-get-separate-commits.5n.7dc.gremlin │ ├── 11.put-get-separate-commits.py │ ├── 12.simple-deadlock.1n.1dc.gremlin │ ├── 12.simple-deadlock.1n.2dc.gremlin │ ├── 12.simple-deadlock.1n.3dc.gremlin │ ├── 12.simple-deadlock.1n.4dc.gremlin │ ├── 12.simple-deadlock.1n.5dc.gremlin │ ├── 12.simple-deadlock.1n.6dc.gremlin │ ├── 12.simple-deadlock.1n.7dc.gremlin │ ├── 12.simple-deadlock.2n.1dc.gremlin │ ├── 12.simple-deadlock.3n.1dc.gremlin │ ├── 12.simple-deadlock.3n.2dc.gremlin │ ├── 12.simple-deadlock.3n.3dc.gremlin │ ├── 12.simple-deadlock.3n.4dc.gremlin │ ├── 12.simple-deadlock.3n.5dc.gremlin │ ├── 12.simple-deadlock.3n.6dc.gremlin │ ├── 12.simple-deadlock.3n.7dc.gremlin │ ├── 12.simple-deadlock.4n.1dc.gremlin │ ├── 12.simple-deadlock.5n.1dc.gremlin │ ├── 12.simple-deadlock.5n.2dc.gremlin │ ├── 12.simple-deadlock.5n.3dc.gremlin │ ├── 12.simple-deadlock.5n.4dc.gremlin │ ├── 12.simple-deadlock.5n.5dc.gremlin │ ├── 12.simple-deadlock.5n.6dc.gremlin │ ├── 12.simple-deadlock.5n.7dc.gremlin │ └── 12.simple-deadlock.py ├── tools ├── availability-check.cc ├── common.cc ├── common.h ├── connect_opts.cc ├── connect_opts.h ├── coordinator.cc ├── create-data-center.cc ├── debug-client-configuration.cc ├── debug-kvs-configuration.cc ├── debug-txman-configuration.cc ├── locate-coordinator-lib.h └── set-default-data-center.cc ├── txman ├── configuration.cc ├── configuration.h ├── controller.cc ├── controller.h ├── daemon.cc ├── daemon.h ├── durable_log.cc ├── durable_log.h ├── generalized_paxos.cc ├── generalized_paxos.h ├── global_voter.cc ├── global_voter.h ├── kvs_lock_op.cc ├── kvs_lock_op.h ├── kvs_read.cc ├── kvs_read.h ├── kvs_write.cc ├── kvs_write.h ├── local_voter.cc ├── local_voter.h ├── log_entry_t.cc ├── log_entry_t.h ├── main.cc ├── paxos_synod.cc ├── paxos_synod.h ├── transaction.cc └── transaction.h └── visibility.h /.gitignore: -------------------------------------------------------------------------------- 1 | # wildcards 2 | .deps 3 | .dirstamp 4 | .libs 5 | *.la 6 | *.lo 7 | *.o 8 | # specific files 9 | /aclocal.m4 10 | /autom4te.cache 11 | /bindings/c/testcompile 12 | /bindings/python/consus.c 13 | /compile 14 | /config.guess 15 | /config.h 16 | /config.h.in 17 | /config.h.in~ 18 | /config.log 19 | /config.status 20 | /config.sub 21 | /configure 22 | /consus 23 | /consus-availability-check 24 | /consus-coordinator 25 | /consus-create-data-center 26 | /consus-debug 27 | /consus-debug-client-configuration 28 | /consus-debug-kvs-configuration 29 | /consus-debug-txman-configuration 30 | /consus-key-value-store 31 | /consus-set-default-data-center 32 | /consus-transaction-manager 33 | /depcomp 34 | /install-sh 35 | /libconsus.pc 36 | /libtool 37 | /ltmain.sh 38 | /m4 39 | /Makefile 40 | /Makefile.in 41 | /man/consus.1 42 | /man/consus.1.h2m 43 | /man/consus-availability-check.1 44 | /man/consus-availability-check.1.h2m 45 | /man/consus-coordinator.1 46 | /man/consus-coordinator.1.h2m 47 | /man/consus-create-data-center.1 48 | /man/consus-create-data-center.1.h2m 49 | /man/consus-debug.1 50 | /man/consus-debug.1.h2m 51 | /man/consus-debug-client-configuration.1 52 | /man/consus-debug-client-configuration.1.h2m 53 | /man/consus-debug-kvs-configuration.1 54 | /man/consus-debug-kvs-configuration.1.h2m 55 | /man/consus-debug-txman-configuration.1 56 | /man/consus-debug-txman-configuration.1.h2m 57 | /man/consus-key-value-store.1 58 | /man/consus-key-value-store.1.h2m 59 | /man/consus-set-default-data-center.1 60 | /man/consus-set-default-data-center.1.h2m 61 | /man/consus-transaction-manager.1 62 | /man/consus-transaction-manager.1.h2m 63 | /missing 64 | /stamp-h1 65 | /test/paxos/generalized 66 | /test/paxos/generalized-brute-force 67 | /test/paxos/generalized-counter-example-generator 68 | /test/paxos/generalized-performance 69 | -------------------------------------------------------------------------------- /.tarballignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | m4/ax_check_link_flag.m4 3 | m4/ax_check_preproc_flag.m4 4 | .tarballignore 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of Consus nor the names of its contributors may be 13 | used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | List of major "TODO" items left: 2 | - Transaction manager replay log on restart. Necessary for txman to come back 3 | after a crash. 4 | - Locking in the key-value store. Necessary to actually uphold serializability. 5 | This will require implementing SCAN first, otherwise it will need to be 6 | rewritten. 7 | - Client-DC affiliation (currently just picks one group at random per 8 | transaction) 9 | - Garbage collection of in-memory structures 10 | - Garbage collection of log 11 | - SCAN(k, n) operation. Equivalent to selecting the next n keys >= k. 12 | - Testing 13 | - Optimization 14 | - Durable log throughput/latency 15 | - Remove early phases of paxos with implicit leader 16 | - removing paxos group should not crash txmen 17 | 18 | 19 | - rate limit p1a messages for global/local gpaxos 20 | 21 | - retransmit m1b via inner machine 22 | - add assert to ensure learned cstruct never goes lower 23 | - every txman operation should check outcome in dispositions and react 24 | appropriately 25 | - configuration serial/de-serial 26 | - Don't log commit record repeatedly 27 | - Don't send commit record repeatedly 28 | - change global voter retransmission (take durability into account so a message 29 | isn't resent before it ever passes the durability barrier). 30 | -------------------------------------------------------------------------------- /bindings/c/testcompile.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016, Robert Escriva, Cornell University 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of Consus nor the names of its contributors may be 13 | * used to endorse or promote products derived from this software without 14 | * specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include 30 | 31 | #ifdef __cplusplus 32 | #error please compile for c, not c++ 33 | #endif 34 | 35 | int 36 | main(int argc, const char* argv[]) 37 | { 38 | argc = argc; 39 | argv = argv; 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /client/consus-internal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of Consus nor the names of its contributors may be 13 | * used to endorse or promote products derived from this software without 14 | * specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef consus_internal_h_ 30 | #define consus_internal_h_ 31 | 32 | /* C */ 33 | #include 34 | #include 35 | 36 | #ifdef __cplusplus 37 | extern "C" 38 | { 39 | #endif /* __cplusplus */ 40 | 41 | int consus_debug_client_configuration(struct consus_client* client, 42 | enum consus_returncode* status, 43 | const char** str); 44 | int consus_debug_txman_configuration(struct consus_client* client, 45 | enum consus_returncode* status, 46 | const char** str); 47 | int consus_debug_kvs_configuration(struct consus_client* client, 48 | enum consus_returncode* status, 49 | const char** str); 50 | 51 | #ifdef __cplusplus 52 | } /* extern "C" */ 53 | #endif /* __cplusplus */ 54 | #endif /* consus_internal_h_ */ 55 | -------------------------------------------------------------------------------- /client/controller.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "client/controller.h" 30 | 31 | using consus::controller; 32 | 33 | controller :: controller(const configuration* config) 34 | : m_config(config) 35 | { 36 | } 37 | 38 | controller :: ~controller() throw () 39 | { 40 | } 41 | 42 | po6::net::location 43 | controller :: lookup(uint64_t id) 44 | { 45 | return m_config->get_address(comm_id(id)); 46 | } 47 | -------------------------------------------------------------------------------- /client/controller.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2017, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_client_controller_h_ 29 | #define consus_client_controller_h_ 30 | 31 | // BusyBee 32 | #include 33 | 34 | // consus 35 | #include "namespace.h" 36 | #include "client/configuration.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | class controller : public ::busybee_controller 41 | { 42 | public: 43 | controller(const configuration* config); 44 | ~controller() throw (); 45 | 46 | public: 47 | virtual po6::net::location lookup(uint64_t id); 48 | 49 | private: 50 | controller(const controller&); 51 | controller& operator = (const controller&); 52 | 53 | private: 54 | const configuration* m_config; 55 | }; 56 | 57 | END_CONSUS_NAMESPACE 58 | 59 | #endif // consus_client_controller_h_ 60 | -------------------------------------------------------------------------------- /client/pending_string.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "client/pending_string.h" 30 | 31 | using consus::pending_string; 32 | 33 | pending_string :: pending_string(const char* s) 34 | : pending(-1, NULL) 35 | , m_str(s) 36 | { 37 | } 38 | 39 | pending_string :: pending_string(const std::string& s) 40 | : pending(-1, NULL) 41 | , m_str(s) 42 | { 43 | } 44 | 45 | pending_string :: ~pending_string() throw () 46 | { 47 | } 48 | 49 | std::string 50 | pending_string :: describe() 51 | { 52 | return "pending_string(" + m_str + ")"; 53 | } 54 | -------------------------------------------------------------------------------- /client/pending_string.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_client_pending_string_h_ 29 | #define consus_client_pending_string_h_ 30 | 31 | // consus 32 | #include "client/pending.h" 33 | #include "client/server_selector.h" 34 | 35 | BEGIN_CONSUS_NAMESPACE 36 | 37 | class pending_string : public pending 38 | { 39 | public: 40 | pending_string(const char* s); 41 | pending_string(const std::string& s); 42 | virtual ~pending_string() throw (); 43 | 44 | public: 45 | virtual std::string describe(); 46 | virtual void kickstart_state_machine(client*) {} 47 | const char* string() { return m_str.c_str(); } 48 | 49 | private: 50 | friend class e::intrusive_ptr; 51 | 52 | private: 53 | std::string m_str; 54 | 55 | private: 56 | pending_string(const pending_string&); 57 | pending_string& operator = (const pending_string&); 58 | }; 59 | 60 | END_CONSUS_NAMESPACE 61 | 62 | #endif // consus_client_pending_string_h_ 63 | -------------------------------------------------------------------------------- /client/server_selector.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // C 29 | #include "client/server_selector.h" 30 | 31 | using consus::server_selector; 32 | 33 | server_selector :: server_selector() 34 | : m_ids() 35 | , m_consumed_idx() 36 | { 37 | } 38 | 39 | server_selector :: ~server_selector() throw () 40 | { 41 | } 42 | 43 | void 44 | server_selector :: set(const comm_id* ids, size_t ids_sz) 45 | { 46 | m_ids = std::vector(ids, ids + ids_sz); 47 | m_consumed_idx = 0; 48 | } 49 | 50 | consus::comm_id 51 | server_selector :: next() 52 | { 53 | if (m_consumed_idx >= m_ids.size()) 54 | { 55 | return comm_id(); 56 | } 57 | 58 | return m_ids[m_consumed_idx++]; 59 | } 60 | 61 | void 62 | server_selector :: clear() 63 | { 64 | m_ids.clear(); 65 | m_consumed_idx = 0; 66 | } 67 | -------------------------------------------------------------------------------- /client/server_selector.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_client_server_selector_h_ 29 | #define consus_client_server_selector_h_ 30 | 31 | // STL 32 | #include 33 | 34 | // consus 35 | #include "namespace.h" 36 | #include "common/ids.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | class server_selector 41 | { 42 | public: 43 | server_selector(); 44 | ~server_selector() throw (); 45 | 46 | public: 47 | void set(const comm_id* ids, size_t ids_sz); 48 | comm_id next(); 49 | void clear(); 50 | 51 | private: 52 | std::vector m_ids; 53 | size_t m_consumed_idx; 54 | }; 55 | 56 | END_CONSUS_NAMESPACE 57 | 58 | #endif // consus_client_server_selector_h_ 59 | -------------------------------------------------------------------------------- /common/client_configuration.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // STL 29 | #include 30 | 31 | // consus 32 | #include "common/client_configuration.h" 33 | 34 | e::unpacker 35 | consus :: client_configuration(e::unpacker up, 36 | cluster_id* cid, 37 | version_id* vid, 38 | uint64_t* flags, 39 | std::vector* txmans) 40 | { 41 | return up >> *cid >> *vid >> *flags >> *txmans; 42 | } 43 | -------------------------------------------------------------------------------- /common/client_configuration.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_client_configuration_h_ 29 | #define consus_common_client_configuration_h_ 30 | 31 | // consus 32 | #include "namespace.h" 33 | #include "common/ids.h" 34 | #include "common/txman.h" 35 | 36 | BEGIN_CONSUS_NAMESPACE 37 | 38 | e::unpacker client_configuration(e::unpacker up, 39 | cluster_id* cid, 40 | version_id* vid, 41 | uint64_t* flags, 42 | std::vector* txmans); 43 | 44 | END_CONSUS_NAMESPACE 45 | 46 | #endif // consus_common_client_configuration_h_ 47 | -------------------------------------------------------------------------------- /common/consus.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_consus_h_ 29 | #define consus_common_consus_h_ 30 | 31 | // e 32 | #include 33 | 34 | // consus 35 | #include 36 | #include "namespace.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | std::ostream& 41 | operator << (std::ostream& lhs, const consus_returncode& rhs); 42 | 43 | e::packer 44 | operator << (e::packer lhs, const consus_returncode& rhs); 45 | e::unpacker 46 | operator >> (e::unpacker lhs, consus_returncode& rhs); 47 | size_t 48 | pack_size(const consus_returncode& p); 49 | 50 | END_CONSUS_NAMESPACE 51 | 52 | #endif // consus_common_consus_h_ 53 | -------------------------------------------------------------------------------- /common/coordinator_returncode.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "common/coordinator_returncode.h" 30 | 31 | e::packer 32 | consus :: operator << (e::packer lhs, const coordinator_returncode& rhs) 33 | { 34 | return lhs << e::pack_uint16(rhs); 35 | } 36 | 37 | e::unpacker 38 | consus :: operator >> (e::unpacker lhs, coordinator_returncode& rhs) 39 | { 40 | return lhs >> e::unpack_uint16(rhs); 41 | } 42 | 43 | size_t 44 | consus :: pack_size(const coordinator_returncode&) 45 | { 46 | return sizeof(uint16_t); 47 | } 48 | -------------------------------------------------------------------------------- /common/coordinator_returncode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_coordinator_returncode_h_ 29 | #define consus_common_coordinator_returncode_h_ 30 | 31 | // C++ 32 | #include 33 | 34 | // e 35 | #include 36 | 37 | // consus 38 | #include "namespace.h" 39 | 40 | BEGIN_CONSUS_NAMESPACE 41 | 42 | // occupies [8832, 8960) 43 | // these are hardcoded as byte strings in coordinator/coordinator.cc 44 | // keep them in sync 45 | enum coordinator_returncode 46 | { 47 | COORD_SUCCESS = 8832, 48 | COORD_MALFORMED = 8833, 49 | COORD_DUPLICATE = 8834, 50 | COORD_NOT_FOUND = 8835, 51 | COORD_UNINITIALIZED = 8837, 52 | COORD_NO_CAN_DO = 8839 53 | }; 54 | 55 | std::ostream& 56 | operator << (std::ostream& lhs, coordinator_returncode rhs); 57 | 58 | e::packer 59 | operator << (e::packer lhs, const coordinator_returncode& rhs); 60 | e::unpacker 61 | operator >> (e::unpacker lhs, coordinator_returncode& rhs); 62 | size_t 63 | pack_size(const coordinator_returncode& rhs); 64 | 65 | END_CONSUS_NAMESPACE 66 | 67 | #endif // consus_common_coordinator_returncode_h_ 68 | -------------------------------------------------------------------------------- /common/crc32c.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_crc32c_h_ 29 | #define consus_common_crc32c_h_ 30 | 31 | // C 32 | #include 33 | #include 34 | 35 | // consus 36 | #include "namespace.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | uint32_t 41 | crc32c(uint32_t init, const unsigned char* data, size_t n); 42 | 43 | END_CONSUS_NAMESPACE 44 | 45 | #endif // consus_common_crc32c_h_ 46 | -------------------------------------------------------------------------------- /common/data_center.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // e 29 | #include 30 | 31 | // consus 32 | #include "common/data_center.h" 33 | 34 | using consus::data_center; 35 | 36 | data_center :: data_center() 37 | : id() 38 | , name() 39 | { 40 | } 41 | 42 | data_center :: data_center(data_center_id i, const std::string& n) 43 | : id(i) 44 | , name(n) 45 | { 46 | } 47 | 48 | data_center :: data_center(const data_center& other) 49 | : id(other.id) 50 | , name(other.name) 51 | { 52 | } 53 | 54 | data_center :: ~data_center() throw () 55 | { 56 | } 57 | 58 | std::ostream& 59 | consus :: operator << (std::ostream& lhs, const data_center& rhs) 60 | { 61 | return lhs << "data_center(id=" << rhs.id.get() 62 | << ", name=\"" << e::strescape(rhs.name) << "\")"; 63 | } 64 | 65 | e::packer 66 | consus :: operator << (e::packer lhs, const data_center& rhs) 67 | { 68 | return lhs << rhs.id << e::slice(rhs.name); 69 | } 70 | 71 | e::unpacker 72 | consus :: operator >> (e::unpacker lhs, data_center& rhs) 73 | { 74 | e::slice name; 75 | lhs = lhs >> rhs.id >> name; 76 | rhs.name = name.str(); 77 | return lhs; 78 | } 79 | -------------------------------------------------------------------------------- /common/data_center.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_data_center_h_ 29 | #define consus_common_data_center_h_ 30 | 31 | // consus 32 | #include "namespace.h" 33 | #include "common/ids.h" 34 | 35 | BEGIN_CONSUS_NAMESPACE 36 | 37 | class data_center 38 | { 39 | public: 40 | data_center(); 41 | data_center(data_center_id id, const std::string& name); 42 | data_center(const data_center& other); 43 | ~data_center() throw (); 44 | 45 | public: 46 | data_center_id id; 47 | std::string name; 48 | }; 49 | 50 | std::ostream& 51 | operator << (std::ostream& lhs, const data_center& rhs); 52 | 53 | e::packer 54 | operator << (e::packer lhs, const data_center& rhs); 55 | e::unpacker 56 | operator >> (e::unpacker lhs, data_center& rhs); 57 | size_t 58 | pack_size(const data_center& dc); 59 | 60 | END_CONSUS_NAMESPACE 61 | 62 | #endif // consus_common_data_center_h_ 63 | -------------------------------------------------------------------------------- /common/generate_token.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Robert Escriva 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // po6 29 | #include 30 | 31 | // BusyBee 32 | #include 33 | 34 | // consus 35 | #include "common/generate_token.h" 36 | 37 | bool 38 | consus :: generate_token(uint64_t* token) 39 | { 40 | po6::io::fd sysrand(open("/dev/urandom", O_RDONLY)); 41 | 42 | if (sysrand.get() < 0) 43 | { 44 | return false; 45 | } 46 | 47 | *token = 0; 48 | 49 | while (*token == 0 || BUSYBEE_IS_ANONYMOUS(*token)) 50 | { 51 | if (sysrand.read(token, sizeof(*token)) != sizeof(*token)) 52 | { 53 | return false; 54 | } 55 | } 56 | 57 | return true; 58 | } 59 | -------------------------------------------------------------------------------- /common/generate_token.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, Robert Escriva 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_generate_token_h_ 29 | #define consus_common_generate_token_h_ 30 | 31 | // C 32 | #include 33 | 34 | // consus 35 | #include "namespace.h" 36 | 37 | BEGIN_CONSUS_NAMESPACE 38 | 39 | bool 40 | generate_token(uint64_t* token); 41 | 42 | END_CONSUS_NAMESPACE 43 | 44 | #endif // consus_common_generate_token_h_ 45 | -------------------------------------------------------------------------------- /common/ids.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "common/ids.h" 30 | 31 | #define CREATE_ID(TYPE) \ 32 | std::ostream& \ 33 | operator << (std::ostream& lhs, const TYPE ## _id& rhs) \ 34 | { \ 35 | return lhs << #TYPE "(" << rhs.get() << ")"; \ 36 | } \ 37 | e::packer \ 38 | operator << (e::packer pa, const TYPE ## _id& rhs) \ 39 | { \ 40 | return pa << rhs.get(); \ 41 | } \ 42 | e::unpacker \ 43 | operator >> (e::unpacker up, TYPE ## _id& rhs) \ 44 | { \ 45 | uint64_t id; \ 46 | up = up >> id; \ 47 | rhs = TYPE ## _id(id); \ 48 | return up; \ 49 | } 50 | 51 | BEGIN_CONSUS_NAMESPACE 52 | 53 | CREATE_ID(abstract) 54 | CREATE_ID(cluster) 55 | CREATE_ID(version) 56 | CREATE_ID(comm) 57 | CREATE_ID(paxos_group) 58 | CREATE_ID(data_center) 59 | CREATE_ID(partition) 60 | 61 | END_CONSUS_NAMESPACE 62 | -------------------------------------------------------------------------------- /common/kvs.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "common/kvs.h" 30 | 31 | using consus::kvs; 32 | 33 | kvs :: kvs() 34 | : id() 35 | , bind_to() 36 | , dc() 37 | { 38 | } 39 | 40 | kvs :: kvs(comm_id i, const po6::net::location& b) 41 | : id(i) 42 | , bind_to(b) 43 | , dc() 44 | { 45 | } 46 | 47 | kvs :: kvs(const kvs& other) 48 | : id(other.id) 49 | , bind_to(other.bind_to) 50 | , dc(other.dc) 51 | { 52 | } 53 | 54 | kvs :: ~kvs() throw () 55 | { 56 | } 57 | 58 | std::ostream& 59 | consus :: operator << (std::ostream& lhs, const kvs& rhs) 60 | { 61 | return lhs << "kvs(id=" << rhs.id.get() << ", bind_to=" << rhs.bind_to << ", dc=" << rhs.dc.get() << ")"; 62 | } 63 | 64 | e::packer 65 | consus :: operator << (e::packer lhs, const kvs& rhs) 66 | { 67 | return lhs << rhs.id << rhs.bind_to << rhs.dc; 68 | } 69 | 70 | e::unpacker 71 | consus :: operator >> (e::unpacker lhs, kvs& rhs) 72 | { 73 | return lhs >> rhs.id >> rhs.bind_to >> rhs.dc; 74 | } 75 | -------------------------------------------------------------------------------- /common/kvs.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_kvs_h_ 29 | #define consus_common_kvs_h_ 30 | 31 | // po6 32 | #include 33 | 34 | // consus 35 | #include "namespace.h" 36 | #include "common/ids.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | class kvs 41 | { 42 | public: 43 | kvs(); 44 | kvs(comm_id id, const po6::net::location& bind_to); 45 | kvs(const kvs& other); 46 | ~kvs() throw (); 47 | 48 | public: 49 | comm_id id; 50 | po6::net::location bind_to; 51 | data_center_id dc; 52 | }; 53 | 54 | std::ostream& 55 | operator << (std::ostream& lhs, const kvs& rhs); 56 | 57 | e::packer 58 | operator << (e::packer lhs, const kvs& rhs); 59 | e::unpacker 60 | operator >> (e::unpacker lhs, kvs& rhs); 61 | size_t 62 | pack_size(const kvs& p); 63 | 64 | END_CONSUS_NAMESPACE 65 | 66 | #endif // consus_common_kvs_h_ 67 | -------------------------------------------------------------------------------- /common/kvs_configuration.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_kvs_configuration_h_ 29 | #define consus_common_kvs_configuration_h_ 30 | 31 | // consus 32 | #include "namespace.h" 33 | #include "common/ids.h" 34 | #include "common/kvs_state.h" 35 | #include "common/ring.h" 36 | 37 | BEGIN_CONSUS_NAMESPACE 38 | 39 | e::unpacker kvs_configuration(e::unpacker up, 40 | cluster_id* cid, 41 | version_id* vid, 42 | uint64_t* flags, 43 | std::vector* kvss, 44 | std::vector* rings); 45 | std::string kvs_configuration(const cluster_id& cid, 46 | const version_id& vid, 47 | uint64_t flags, 48 | const std::vector& kvss, 49 | const std::vector& rings); 50 | 51 | END_CONSUS_NAMESPACE 52 | 53 | #endif // consus_common_kvs_configuration_h_ 54 | -------------------------------------------------------------------------------- /common/lock.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "common/lock.h" 30 | #include "common/macros.h" 31 | 32 | std::ostream& 33 | consus :: operator << (std::ostream& lhs, lock_op rhs) 34 | { 35 | switch (rhs) 36 | { 37 | STRINGIFY(LOCK_LOCK); 38 | STRINGIFY(LOCK_UNLOCK); 39 | default: 40 | lhs << "unknown lock_op"; 41 | } 42 | 43 | return lhs; 44 | } 45 | 46 | e::packer 47 | consus :: operator << (e::packer lhs, const lock_op& rhs) 48 | { 49 | return lhs << e::pack_uint8(rhs); 50 | } 51 | 52 | e::unpacker 53 | consus :: operator >> (e::unpacker lhs, lock_op& rhs) 54 | { 55 | return lhs >> e::unpack_uint8(rhs); 56 | } 57 | 58 | size_t 59 | consus :: pack_size(const lock_op&) 60 | { 61 | return sizeof(uint8_t); 62 | } 63 | -------------------------------------------------------------------------------- /common/lock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_lock_op_h_ 29 | #define consus_common_lock_op_h_ 30 | 31 | // C++ 32 | #include 33 | 34 | // e 35 | #include 36 | 37 | // consus 38 | #include "namespace.h" 39 | 40 | BEGIN_CONSUS_NAMESPACE 41 | 42 | #define WOUND_XACT_ABORT 1 43 | #define WOUND_XACT_DROP_REQ 2 44 | 45 | enum lock_op 46 | { 47 | LOCK_LOCK = 1, 48 | LOCK_UNLOCK = 2 49 | }; 50 | 51 | std::ostream& 52 | operator << (std::ostream& lhs, lock_op rhs); 53 | 54 | e::packer 55 | operator << (e::packer lhs, const lock_op& rhs); 56 | e::unpacker 57 | operator >> (e::unpacker lhs, lock_op& rhs); 58 | size_t 59 | pack_size(const lock_op& rhs); 60 | 61 | END_CONSUS_NAMESPACE 62 | 63 | #endif // consus_common_lock_op_h_ 64 | -------------------------------------------------------------------------------- /common/macros.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef kvs_common_macros_h_ 29 | #define kvs_common_macros_h_ 30 | 31 | #define XSTR(x) #x 32 | #define STR(x) XSTR(x) 33 | #define STRINGIFY(x) case (x): lhs << XSTR(x); break 34 | #define STRINGIFYNS(ns, x) case (ns::x): lhs << XSTR(x); break 35 | #define CSTRINGIFY(x) case (x): return XSTR(x); 36 | 37 | #define _CONCAT(x, y) x ## y 38 | #define CONCAT(x, y) _CONCAT(x, y) 39 | 40 | #endif // kvs_common_macros_h_ 41 | -------------------------------------------------------------------------------- /common/partition.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "common/partition.h" 30 | 31 | using consus::partition; 32 | 33 | partition :: partition() 34 | : index(0) 35 | , id() 36 | , owner() 37 | , next_id() 38 | , next_owner() 39 | { 40 | } 41 | 42 | partition :: ~partition() throw () 43 | { 44 | } 45 | 46 | e::packer 47 | consus :: operator << (e::packer lhs, const partition& rhs) 48 | { 49 | return lhs << rhs.index << rhs.id << rhs.owner << rhs.next_id << rhs.next_owner; 50 | } 51 | 52 | e::unpacker 53 | consus :: operator >> (e::unpacker lhs, partition& rhs) 54 | { 55 | return lhs >> rhs.index >> rhs.id >> rhs.owner >> rhs.next_id >> rhs.next_owner; 56 | } 57 | -------------------------------------------------------------------------------- /common/partition.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_partition_h_ 29 | #define consus_common_partition_h_ 30 | 31 | // consus 32 | #include "namespace.h" 33 | #include "common/ids.h" 34 | 35 | BEGIN_CONSUS_NAMESPACE 36 | 37 | struct partition 38 | { 39 | partition(); 40 | ~partition() throw (); 41 | 42 | uint16_t index; 43 | partition_id id; 44 | comm_id owner; 45 | partition_id next_id; 46 | comm_id next_owner; 47 | }; 48 | 49 | e::packer 50 | operator << (e::packer lhs, const partition& rhs); 51 | e::unpacker 52 | operator >> (e::unpacker lhs, partition& rhs); 53 | size_t 54 | pack_size(const partition& p); 55 | 56 | END_CONSUS_NAMESPACE 57 | 58 | #endif // consus_common_partition_h_ 59 | -------------------------------------------------------------------------------- /common/paxos_group.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_paxos_group_h_ 29 | #define consus_common_paxos_group_h_ 30 | 31 | // consus 32 | #include "namespace.h" 33 | #include "common/constants.h" 34 | #include "common/ids.h" 35 | 36 | BEGIN_CONSUS_NAMESPACE 37 | 38 | class paxos_group 39 | { 40 | public: 41 | paxos_group(); 42 | paxos_group(const paxos_group& other); 43 | ~paxos_group() throw (); 44 | 45 | public: 46 | unsigned quorum() const; 47 | unsigned index(comm_id id) const; 48 | 49 | public: 50 | paxos_group& operator = (const paxos_group& rhs); 51 | 52 | public: 53 | paxos_group_id id; 54 | data_center_id dc; 55 | unsigned members_sz; 56 | comm_id members[CONSUS_MAX_REPLICATION_FACTOR]; 57 | }; 58 | 59 | std::ostream& 60 | operator << (std::ostream& lhs, const paxos_group& rhs); 61 | 62 | e::packer 63 | operator << (e::packer lhs, const paxos_group& rhs); 64 | e::unpacker 65 | operator >> (e::unpacker lhs, paxos_group& rhs); 66 | size_t 67 | pack_size(const paxos_group& p); 68 | 69 | END_CONSUS_NAMESPACE 70 | 71 | #endif // consus_common_paxos_group_h_ 72 | -------------------------------------------------------------------------------- /common/ring.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_ring_h_ 29 | #define consus_common_ring_h_ 30 | 31 | // consus 32 | #include "namespace.h" 33 | #include "common/constants.h" 34 | #include "common/ids.h" 35 | #include "common/partition.h" 36 | 37 | BEGIN_CONSUS_NAMESPACE 38 | 39 | class ring 40 | { 41 | public: 42 | ring(); 43 | ring(data_center_id dc); 44 | ~ring() throw (); 45 | 46 | public: 47 | void get_owners(comm_id owners[CONSUS_KVS_PARTITIONS]); 48 | void set_owners(comm_id owners[CONSUS_KVS_PARTITIONS], uint64_t* post_inc_counter); 49 | 50 | public: 51 | data_center_id dc; 52 | partition partitions[CONSUS_KVS_PARTITIONS]; 53 | }; 54 | 55 | e::packer 56 | operator << (e::packer lhs, const ring& rhs); 57 | e::unpacker 58 | operator >> (e::unpacker lhs, ring& rhs); 59 | size_t 60 | pack_size(const ring& r); 61 | 62 | END_CONSUS_NAMESPACE 63 | 64 | #endif // consus_common_ring_h_ 65 | -------------------------------------------------------------------------------- /common/txman.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "common/txman.h" 30 | 31 | using consus::txman; 32 | 33 | txman :: txman() 34 | : id() 35 | , bind_to() 36 | , dc() 37 | { 38 | } 39 | 40 | txman :: txman(comm_id i, const po6::net::location& b) 41 | : id(i) 42 | , bind_to(b) 43 | , dc() 44 | { 45 | } 46 | 47 | txman :: txman(const txman& other) 48 | : id(other.id) 49 | , bind_to(other.bind_to) 50 | , dc(other.dc) 51 | { 52 | } 53 | 54 | txman :: ~txman() throw () 55 | { 56 | } 57 | 58 | std::ostream& 59 | consus :: operator << (std::ostream& lhs, const txman& rhs) 60 | { 61 | return lhs << "txman(id=" << rhs.id.get() << ", bind_to=" << rhs.bind_to << ", dc=" << rhs.dc.get() << ")"; 62 | } 63 | 64 | e::packer 65 | consus :: operator << (e::packer lhs, const txman& rhs) 66 | { 67 | return lhs << rhs.id << rhs.bind_to << rhs.dc; 68 | } 69 | 70 | e::unpacker 71 | consus :: operator >> (e::unpacker lhs, txman& rhs) 72 | { 73 | return lhs >> rhs.id >> rhs.bind_to >> rhs.dc; 74 | } 75 | -------------------------------------------------------------------------------- /common/txman.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_txman_h_ 29 | #define consus_common_txman_h_ 30 | 31 | // po6 32 | #include 33 | 34 | // consus 35 | #include "namespace.h" 36 | #include "common/ids.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | class txman 41 | { 42 | public: 43 | txman(); 44 | txman(comm_id id, const po6::net::location& bind_to); 45 | txman(const txman& other); 46 | ~txman() throw (); 47 | 48 | public: 49 | comm_id id; 50 | po6::net::location bind_to; 51 | data_center_id dc; 52 | }; 53 | 54 | std::ostream& 55 | operator << (std::ostream& lhs, const txman& rhs); 56 | 57 | e::packer 58 | operator << (e::packer lhs, const txman& rhs); 59 | e::unpacker 60 | operator >> (e::unpacker lhs, txman& rhs); 61 | size_t 62 | pack_size(const txman& p); 63 | 64 | END_CONSUS_NAMESPACE 65 | 66 | #endif // consus_common_txman_h_ 67 | -------------------------------------------------------------------------------- /common/util.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2017, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // STL 29 | #include 30 | 31 | // consus 32 | #include "common/util.h" 33 | 34 | std::string 35 | consus :: prefix_lines(std::string prefix, std::string multiline) 36 | { 37 | std::vector lines = split_by_newlines(multiline); 38 | std::ostringstream ostr; 39 | 40 | for (size_t i = 0; i < lines.size(); ++i) 41 | { 42 | ostr << prefix << lines[i] << "\n"; 43 | } 44 | 45 | return ostr.str(); 46 | } 47 | 48 | std::vector 49 | consus :: split_by_newlines(std::string s) 50 | { 51 | std::vector v; 52 | 53 | while (!s.empty()) 54 | { 55 | size_t idx = s.find_first_of('\n'); 56 | 57 | if (idx == std::string::npos) 58 | { 59 | v.push_back(s); 60 | s = ""; 61 | } 62 | else 63 | { 64 | v.push_back(s.substr(0, idx)); 65 | s = s.substr(idx + 1, s.size()); 66 | } 67 | } 68 | 69 | return v; 70 | } 71 | -------------------------------------------------------------------------------- /common/util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2017, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_common_util_h_ 29 | #define consus_common_util_h_ 30 | 31 | // STL 32 | #include 33 | #include 34 | 35 | // consus 36 | #include "namespace.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | std::string 41 | prefix_lines(std::string prefix, std::string multiline); 42 | 43 | std::vector 44 | split_by_newlines(std::string s); 45 | 46 | END_CONSUS_NAMESPACE 47 | 48 | #endif // consus_common_util_h_ 49 | -------------------------------------------------------------------------------- /consus-debug.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifdef HAVE_CONFIG_H 29 | #include "config.h" 30 | #endif 31 | 32 | // STL 33 | #include 34 | 35 | // e 36 | #include 37 | 38 | int 39 | main(int argc, const char* argv[]) 40 | { 41 | std::vector cmds; 42 | cmds.push_back(e::subcommand("client-configuration", "Show the client configuration")); 43 | cmds.push_back(e::subcommand("txman-configuration", "Show the transaction manager configuration")); 44 | cmds.push_back(e::subcommand("kvs-configuration", "Show the key value store configuration")); 45 | return dispatch_to_subcommands(argc, argv, 46 | "consus debug", "Consus", 47 | PACKAGE_VERSION, 48 | "consus-debug-", 49 | "CONSUS_EXEC_PATH", CONSUS_EXEC_DIR, 50 | &cmds.front(), cmds.size()); 51 | } 52 | -------------------------------------------------------------------------------- /coordinator/symtable.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of Consus nor the names of its contributors may be 13 | * used to endorse or promote products derived from this software without 14 | * specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | /* Replicant */ 30 | #include 31 | 32 | /* consus */ 33 | #include "visibility.h" 34 | #include "coordinator/transitions.h" 35 | 36 | #pragma GCC diagnostic push 37 | #pragma GCC diagnostic ignored "-Wpedantic" 38 | 39 | struct state_machine CONSUS_API rsm = { 40 | consus_coordinator_create, 41 | consus_coordinator_recreate, 42 | consus_coordinator_snapshot, 43 | {{"init", consus_coordinator_init}, 44 | {"data_center_create", consus_coordinator_data_center_create}, 45 | {"data_center_default", consus_coordinator_data_center_default}, 46 | {"txman_register", consus_coordinator_txman_register}, 47 | {"txman_online", consus_coordinator_txman_online}, 48 | {"txman_offline", consus_coordinator_txman_offline}, 49 | {"kvs_register", consus_coordinator_kvs_register}, 50 | {"kvs_online", consus_coordinator_kvs_online}, 51 | {"kvs_offline", consus_coordinator_kvs_offline}, 52 | {"kvs_migrated", consus_coordinator_kvs_migrated}, 53 | {"is_stable", consus_coordinator_is_stable}, 54 | {"tick", consus_coordinator_tick}, 55 | {NULL, NULL}} 56 | }; 57 | 58 | #pragma GCC diagnostic pop 59 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | /consus.aux 2 | /consus.bbl 3 | /consus.dvi 4 | /consus.idx 5 | /consus.ilg 6 | /consus.ind 7 | /consus.log 8 | /consus.out 9 | /consus.P 10 | /consus.pdf 11 | /consus.ps 12 | /consus.stdout.log 13 | /consus.toc 14 | /.consus.xtx.cache 15 | /_minted-consus/ 16 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Configuration variables 2 | 3 | TARGET = consus 4 | 5 | export CROSSTEX_FLAGS:= --add-in --add-proceedings --titlecase=title --cite-by initials 6 | 7 | # Rules that derive from configuration variables 8 | 9 | .PHONY: all clean clobber 10 | 11 | all: $(TARGET).pdf $(TARGET).ps 12 | @echo "SUCCESS: dvi, ps, pdf all up-to-date" 13 | 14 | $(TARGET).dvi: $(TARGET).tex $(wildcard *.tex) $(wildcard */*.tex) $(wildcard */*/*.tex) assert-same.py latex.py Makefile 15 | python2 assert-same.py 16 | python2 latex.py --crosstex --index $(TARGET) 17 | 18 | $(TARGET).ps: $(TARGET).dvi 19 | dvips $(TARGET).dvi 20 | 21 | $(TARGET).pdf: $(TARGET).ps 22 | ps2pdf -dPDFSETTINGS=/prepress -dEmbedAllFonts=true $(TARGET).ps $(TARGET).pdf 23 | 24 | -include $(TARGET).P 25 | 26 | clean: 27 | rm -f $(TARGET).aux $(TARGET).bbl $(TARGET).log $(TARGET).stdout.log $(TARGET).pgf .$(TARGET).xtx.cache $(TARGET).P 28 | 29 | clobber: clean 30 | rm -f $(TARGET).dvi $(TARGET).pdf $(TARGET).ps 31 | -------------------------------------------------------------------------------- /doc/assert-same.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import sys 3 | 4 | SAME = [ 5 | ('install/ubuntu14.04-src-prereqs', 6 | 'install/ubuntu16.04-src-prereqs', 7 | 'install/ubuntu16.10-src-prereqs'), 8 | ('install/fedora23-src-prereqs', 9 | 'install/fedora24-src-prereqs', 10 | 'install/fedora25-src-prereqs'), 11 | ] 12 | 13 | def sha256(f): 14 | return hashlib.sha256(open(f).read()).hexdigest() 15 | 16 | for files in SAME: 17 | if len(files) == 0: continue 18 | ref = sha256(files[0]) 19 | for f in files: 20 | if sha256(f) != ref: 21 | print f, 'does not match other files' 22 | sys.exit(1) 23 | -------------------------------------------------------------------------------- /doc/consus.tex: -------------------------------------------------------------------------------- 1 | \documentclass[10pt,oneside]{book} 2 | 3 | \ifx \HCode\Undef 4 | \newcommand*{\topdir}{.}% 5 | \else 6 | \def\pgfsysdriver{pgfsys-tex4ht.def} 7 | \newcommand*{\topdir}{..}% 8 | \fi 9 | 10 | \usepackage{calc} 11 | \usepackage[capitalise]{cleveref} 12 | \usepackage{enumitem} 13 | \usepackage{environ} 14 | \usepackage{graphicx} 15 | \usepackage{hyperref} 16 | \usepackage{lipsum} 17 | \usepackage{makeidx} 18 | \usepackage{minted} 19 | \usepackage{nameref} 20 | \usepackage{tikz} 21 | \usepackage[tikz]{bclogo} 22 | \usepackage{ulem} 23 | \usepackage[many]{tcolorbox} 24 | \usepackage{etoolbox} 25 | \usepackage{ifthen} 26 | \usepackage{fontawesome} 27 | \usepackage{xcolor} 28 | \usepackage{tabularx} 29 | \usepackage[margin=1in]{geometry} 30 | \usepackage[small,compact]{titlesec} 31 | \usepackage[binary,squaren]{SIunits} 32 | \usepackage[framemethod=tikz]{mdframed} 33 | \usetikzlibrary{arrows} 34 | \usetikzlibrary{calc} 35 | \usetikzlibrary{decorations.markings} 36 | 37 | \hypersetup{colorlinks=true,linkcolor=red,hypertexnames=false,pdfhighlight=/N} 38 | 39 | \makeindex 40 | \AtBeginDocument{\renewcommand{\bibname}{References}} 41 | 42 | \newcommand{\ConsusVersion}{0.0.dev} 43 | \newcommand{\code}[1]{\texttt{#1}} 44 | 45 | % http://texblog.org/2012/03/21/cross-referencing-list-items/ 46 | \makeatletter 47 | \def\namedlabel#1#2{\begingroup 48 | #2% 49 | \def\@currentlabel{#2}% 50 | \phantomsection\label{#1}\endgroup 51 | } 52 | \makeatother 53 | 54 | \setcounter{secnumdepth}{3} 55 | \setcounter{tocdepth}{2} 56 | 57 | \title{Consus Reference Manual v\ConsusVersion} 58 | \author{Consus Team} 59 | 60 | \BeforeBeginEnvironment{minted}{\begin{tcolorbox}}% 61 | \AfterEndEnvironment{minted}{\end{tcolorbox}}% 62 | \newminted{c}{samepage} 63 | \newminted{console}{samepage} 64 | \newminted{go}{samepage} 65 | \newminted{java}{samepage} 66 | \newminted{javascript}{samepage} 67 | \newminted{json}{samepage} 68 | \newminted{pycon}{samepage} 69 | \newminted{python}{samepage} 70 | \newminted{ruby}{samepage} 71 | 72 | \input{\topdir/environs} 73 | 74 | \begin{document} 75 | 76 | \frontmatter 77 | \maketitle 78 | \tableofcontents 79 | 80 | \mainmatter 81 | 82 | \part{Working with Consus} 83 | 84 | \input{\topdir/installation} 85 | 86 | %\part{Developing Consus} 87 | 88 | %\part{API Reference} 89 | 90 | \ifx \HCode\Undef % >>>>>>>>>>>>>>>>>>> 91 | \backmatter 92 | 93 | % Index 94 | \clearpage 95 | \addcontentsline{toc}{chapter}{Index} 96 | \printindex 97 | 98 | % References 99 | \clearpage 100 | \addcontentsline{toc}{chapter}{References} 101 | \bibliographystyle{plain} 102 | \bibliography{consus} 103 | \fi % <<<<<<<<<<<<<<<<<<< 104 | 105 | \end{document} 106 | -------------------------------------------------------------------------------- /doc/consus.xtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rescrv/Consus/bb05df2f314b1dc7510a3fb73604491227ebc516/doc/consus.xtx -------------------------------------------------------------------------------- /doc/environs.tex: -------------------------------------------------------------------------------- 1 | % These boxes are all inspired by a solution from here: 2 | % http://tex.stackexchange.com/questions/66820/how-to-create-highlight-boxes-in-latex 3 | 4 | \NewEnviron{consuscaution}[1] 5 | {\par\medskip\noindent 6 | \begin{tikzpicture} 7 | \node[inner sep=0pt] (box) {\parbox[t]{.99\textwidth}{% 8 | \begin{minipage}{.2\textwidth} 9 | \centering\tikz[scale=5]\node[scale=2]{\bctakecare}; 10 | \end{minipage}% 11 | \begin{minipage}{.75\textwidth} 12 | \textbf{#1}\par\smallskip 13 | \BODY 14 | \end{minipage}\hfill}% 15 | }; 16 | \draw[red!75!black,line width=3pt] 17 | ( $ (box.north east) + (-5pt,3pt) $ ) -- ( $ (box.north east) + (0,3pt) $ ) -- ( $ (box.south east) + (0,-3pt) $ ) -- + (-5pt,0); 18 | \draw[red!75!black,line width=3pt] 19 | ( $ (box.north west) + (5pt,3pt) $ ) -- ( $ (box.north west) + (0,3pt) $ ) -- ( $ (box.south west) + (0,-3pt) $ ) -- + (5pt,0); 20 | \end{tikzpicture}\par\medskip% 21 | } 22 | 23 | % These boxes are all inspired by a solution from here: 24 | % http://tex.stackexchange.com/questions/304449/combine-minted-and-tcolorbox-for-code-from-file-inputminted 25 | 26 | \newcounter{codeCount}[chapter] 27 | \crefname{codeCount}{Code Listing}{Code Listings} 28 | 29 | \tcbuselibrary{listings} 30 | \tcbuselibrary{minted} 31 | 32 | \newcolumntype{\CeX}{>{\centering\let\newline\\\arraybackslash}X}% 33 | \newcommand{\SymbolAndText}[2]{% 34 | \begin{tabularx}{\textwidth}{c\CeX c}% 35 | #1 & #2 36 | \end{tabularx}% 37 | } 38 | 39 | \newtcbinputlisting[use counter=codeCount, number format=\arabic]{\codeFromFile}[4]{% 40 | listing engine=minted, 41 | minted language=#1, 42 | listing file={#2}, 43 | minted options={autogobble,linenos,breaklines}, 44 | listing only, 45 | size=title, 46 | arc=1.5mm, 47 | breakable, 48 | enhanced jigsaw, 49 | colframe=red!75!black, 50 | coltitle=white, 51 | boxrule=0.5mm, 52 | colback=white, 53 | coltext=black, 54 | title=\SymbolAndText{\faCode}{% 55 | \textbf{Code Listing \thetcbcounter}\ifthenelse{\equal{#3}{}}{}{\textbf{:} #3}% 56 | }, 57 | label=code:#4 58 | } 59 | 60 | \newtcblisting[use counter=codeCount, number format=\arabic]{codeBox}[3]{ 61 | listing engine=minted, 62 | minted language=#1, 63 | minted options={autogobble,linenos,breaklines}, 64 | listing only, 65 | size=title, 66 | arc=1.5mm, 67 | breakable, 68 | enhanced jigsaw, 69 | colframe=red!75!black, 70 | coltitle=white, 71 | boxrule=0.5mm, 72 | colback=white, 73 | coltext=black, 74 | title=\SymbolAndText{\faCode}{% 75 | \textbf{Code Listing \thetcbcounter}\ifthenelse{\equal{#2}{}}{}{\textbf{:} #2}% 76 | }, 77 | label=code:#3 78 | } 79 | -------------------------------------------------------------------------------- /doc/install/empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rescrv/Consus/bb05df2f314b1dc7510a3fb73604491227ebc516/doc/install/empty -------------------------------------------------------------------------------- /doc/install/fedora23-python-prereqs: -------------------------------------------------------------------------------- 1 | $ dnf install -y python gcc redhat-rpm-config python-devel 2 | -------------------------------------------------------------------------------- /doc/install/fedora23-src-prereqs: -------------------------------------------------------------------------------- 1 | dnf install -y tar gcc-c++ make pkgconfig popt-devel glog-devel gflags-devel sparsehash-devel leveldb-devel python-devel 2 | -------------------------------------------------------------------------------- /doc/install/fedora24-python-prereqs: -------------------------------------------------------------------------------- 1 | $ dnf install -y python gcc redhat-rpm-config python-devel 2 | -------------------------------------------------------------------------------- /doc/install/fedora24-src-prereqs: -------------------------------------------------------------------------------- 1 | dnf install -y tar gcc-c++ make pkgconfig popt-devel glog-devel gflags-devel sparsehash-devel leveldb-devel python-devel 2 | -------------------------------------------------------------------------------- /doc/install/fedora25-python-prereqs: -------------------------------------------------------------------------------- 1 | $ dnf install -y python gcc redhat-rpm-config python-devel 2 | -------------------------------------------------------------------------------- /doc/install/fedora25-src-prereqs: -------------------------------------------------------------------------------- 1 | dnf install -y tar gcc-c++ make pkgconfig popt-devel glog-devel gflags-devel sparsehash-devel leveldb-devel python-devel 2 | -------------------------------------------------------------------------------- /doc/install/git: -------------------------------------------------------------------------------- 1 | $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 2 | $ for x in po6 e busybee replicant treadstone consus 3 | > do 4 | > pushd $x 5 | > autoreconf -ivf 6 | > ./configure 7 | > make 8 | > make install 9 | > popd 10 | > done 11 | -------------------------------------------------------------------------------- /doc/install/linux-amd64: -------------------------------------------------------------------------------- 1 | $ tar xzvf consus-0.0.dev.linux-amd64.tar.gz -C /usr/local 2 | $ export PATH=/usr/local/consus/bin:${PATH} 3 | -------------------------------------------------------------------------------- /doc/install/linux-amd64-home: -------------------------------------------------------------------------------- 1 | $ tar xzvf consus-0.0.dev.linux-amd64.tar.gz -C "${HOME}" 2 | $ export PATH="${HOME}/consus/bin:${PATH}" 3 | -------------------------------------------------------------------------------- /doc/install/source: -------------------------------------------------------------------------------- 1 | $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 2 | $ TARBALL_PO6=libpo6-0.9.dev 3 | $ TARBALL_E=libe-0.12.dev 4 | $ TARBALL_BUSYBEE=busybee-0.7.dev 5 | $ TARBALL_REPLICANT=replicant-0.9.dev 6 | $ TARBALL_TREADSTONE=libtreadstone-0.3.dev 7 | $ TARBALL_CONSUS=consus-0.0.dev 8 | $ 9 | $ for tarball in ${TARBALL_PO6} ${TARBALL_E} ${TARBALL_BUSYBEE} \ 10 | > ${TARBALL_REPLICANT} ${TARBALL_TREADSTONE} ${TARBALL_CONSUS} 11 | > do 12 | > tar xzvf ${tarball}.tar.gz 13 | > pushd ${tarball} 14 | > ./configure 15 | > make 16 | > make install 17 | > popd 18 | > done 19 | -------------------------------------------------------------------------------- /doc/install/ubuntu12.04-python-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config python python-setuptools python-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu12.04-src-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config libpopt-dev libsparsehash-dev python-dev wget 3 | $ cd /tmp 4 | $ cat >> checksums << EOF 5 | > ce99d58dce74458f7656a68935d7a0c048fa7b4626566a71b7f4e545920ceb10 glog-0.3.4.tar.gz 6 | > 7d7a14ae825e66aabeb156c1c3fae9f9a76d640ef6b40ede74cc73da937e5202 leveldb-1.19.tar.gz 7 | > EOF 8 | $ wget --no-check-certificate https://github.com/google/glog/archive/v0.3.4.tar.gz -O glog-0.3.4.tar.gz 9 | $ wget --no-check-certificate https://github.com/google/leveldb/archive/v1.19.tar.gz -O leveldb-1.19.tar.gz 10 | $ sha256sum -c checksums 11 | $ tar xvf glog-0.3.4.tar.gz 12 | $ tar xvf leveldb-1.19.tar.gz 13 | $ cd /tmp/glog-0.3.4 14 | $ ./configure 15 | $ make 16 | $ sudo make install 17 | $ cd /tmp/leveldb-1.19 18 | $ make 19 | $ sudo cp --preserve=links out-shared/libleveldb.* /usr/local/lib 20 | $ sudo cp -r include/leveldb /usr/local/include/ 21 | $ sudo ldconfig 22 | -------------------------------------------------------------------------------- /doc/install/ubuntu14.04-git-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config autoconf autoconf-archive automake libtool cython pandoc help2man valgrind libpopt-dev libgoogle-glog-dev libsparsehash-dev libleveldb-dev python-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu14.04-python-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config python python-setuptools libpython2.7-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu14.04-src-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config libpopt-dev libgoogle-glog-dev libsparsehash-dev libleveldb-dev python-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu16.04-git-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config autoconf autoconf-archive automake libtool cython pandoc help2man valgrind libpopt-dev libgoogle-glog-dev libsparsehash-dev libleveldb-dev python-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu16.04-python-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config python python-setuptools libpython2.7-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu16.04-src-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config libpopt-dev libgoogle-glog-dev libsparsehash-dev libleveldb-dev python-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu16.10-git-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config autoconf autoconf-archive automake libtool cython pandoc help2man valgrind libpopt-dev libgoogle-glog-dev libsparsehash-dev libleveldb-dev python-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu16.10-python-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config python python-setuptools libpython2.7-dev 3 | -------------------------------------------------------------------------------- /doc/install/ubuntu16.10-src-prereqs: -------------------------------------------------------------------------------- 1 | $ apt-get update 2 | $ apt-get install -y build-essential pkg-config libpopt-dev libgoogle-glog-dev libsparsehash-dev libleveldb-dev python-dev 3 | -------------------------------------------------------------------------------- /include/consus-admin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of Consus nor the names of its contributors may be 13 | * used to endorse or promote products derived from this software without 14 | * specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef consus_admin_h_ 30 | #define consus_admin_h_ 31 | 32 | /* consus */ 33 | #include 34 | 35 | #ifdef __cplusplus 36 | extern "C" 37 | { 38 | #endif /* __cplusplus */ 39 | 40 | int consus_admin_create_data_center(struct consus_client* client, const char* name, 41 | enum consus_returncode* status); 42 | int consus_admin_set_default_data_center(struct consus_client* client, const char* name, 43 | enum consus_returncode* status); 44 | 45 | struct consus_availability_requirements 46 | { 47 | unsigned txmans; 48 | unsigned txman_groups; 49 | unsigned kvss; 50 | int stable; 51 | }; 52 | 53 | int consus_admin_availability_check(struct consus_client* client, 54 | struct consus_availability_requirements* reqs, 55 | int timeout, 56 | enum consus_returncode* status); 57 | 58 | #ifdef __cplusplus 59 | } /* extern "C" */ 60 | #endif /* __cplusplus */ 61 | #endif /* consus_admin_h_ */ 62 | -------------------------------------------------------------------------------- /kvs/controller.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "kvs/controller.h" 30 | #include "kvs/daemon.h" 31 | 32 | using consus::controller; 33 | 34 | controller :: controller(daemon* d) 35 | : m_d(d) 36 | { 37 | } 38 | 39 | controller :: ~controller() throw () 40 | { 41 | } 42 | 43 | po6::net::location 44 | controller :: lookup(uint64_t server_id) 45 | { 46 | configuration* c = m_d->get_config(); 47 | 48 | if (c && c->exists(comm_id(server_id))) 49 | { 50 | return c->get_address(comm_id(server_id)); 51 | } 52 | 53 | return po6::net::location(); 54 | } 55 | -------------------------------------------------------------------------------- /kvs/controller.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_kvs_controller_h_ 29 | #define consus_kvs_controller_h_ 30 | 31 | // BusyBee 32 | #include 33 | 34 | // consus 35 | #include "namespace.h" 36 | 37 | BEGIN_CONSUS_NAMESPACE 38 | class daemon; 39 | 40 | class controller : public busybee_controller 41 | { 42 | public: 43 | controller(daemon* d); 44 | ~controller() throw (); 45 | 46 | public: 47 | virtual po6::net::location lookup(uint64_t server_id); 48 | 49 | private: 50 | daemon* m_d; 51 | 52 | private: 53 | controller(const controller&); 54 | controller& operator = (const controller&); 55 | }; 56 | 57 | END_CONSUS_NAMESPACE 58 | 59 | #endif // consus_kvs_controller_h_ 60 | -------------------------------------------------------------------------------- /kvs/datalayer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "kvs/datalayer.h" 30 | 31 | using consus::datalayer; 32 | 33 | datalayer :: datalayer() 34 | { 35 | } 36 | 37 | datalayer :: ~datalayer() throw () 38 | { 39 | } 40 | 41 | datalayer :: reference :: reference() 42 | { 43 | } 44 | 45 | datalayer :: reference :: ~reference() throw () 46 | { 47 | } 48 | -------------------------------------------------------------------------------- /kvs/table_key_pair.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "kvs/table_key_pair.h" 30 | 31 | using consus::table_key_pair; 32 | 33 | table_key_pair :: table_key_pair() 34 | : table() 35 | , key() 36 | { 37 | } 38 | 39 | table_key_pair :: table_key_pair(const e::slice& t, const e::slice& k) 40 | : table(t.str()) 41 | , key(k.str()) 42 | { 43 | } 44 | 45 | table_key_pair :: ~table_key_pair() throw () 46 | { 47 | } 48 | 49 | bool 50 | consus :: operator == (const table_key_pair& lhs, const table_key_pair& rhs) 51 | { 52 | return lhs.table == rhs.table && lhs.key == rhs.key; 53 | } 54 | -------------------------------------------------------------------------------- /kvs/table_key_pair.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_kvs_table_key_pair_h_ 29 | #define consus_kvs_table_key_pair_h_ 30 | 31 | // e 32 | #include 33 | #include 34 | 35 | // consus 36 | #include "namespace.h" 37 | 38 | BEGIN_CONSUS_NAMESPACE 39 | 40 | struct table_key_pair 41 | { 42 | table_key_pair(); 43 | table_key_pair(const e::slice& table, const e::slice& key); 44 | ~table_key_pair() throw (); 45 | std::string table; 46 | std::string key; 47 | }; 48 | 49 | bool 50 | operator == (const table_key_pair& lhs, const table_key_pair& rhs); 51 | 52 | END_CONSUS_NAMESPACE 53 | 54 | BEGIN_E_COMPAT_NAMESPACE 55 | template <> 56 | struct hash 57 | { 58 | size_t operator()(const consus::table_key_pair& x) const 59 | { 60 | e::compat::hash h; 61 | return h(x.table) ^ h(x.key); 62 | } 63 | }; 64 | END_E_COMPAT_NAMESPACE 65 | 66 | #endif // consus_kvs_table_key_pair_h_ 67 | -------------------------------------------------------------------------------- /libconsus.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libconsus 7 | Description: Client library for Consus 8 | Version: @VERSION@ 9 | 10 | Libs: -L${libdir} -lconsus 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /maint/valgrind-gremlins: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) 2016, Robert Escriva, Cornell University 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, 10 | # this list of conditions and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # * Neither the name of Consus nor the names of its contributors may be 15 | # used to endorse or promote products derived from this software without 16 | # specific prior written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | # POSSIBILITY OF SUCH DAMAGE. 29 | 30 | import os 31 | import os.path 32 | import stat 33 | 34 | def lines(): 35 | for line in open('Makefile.am'): 36 | yield 'file', line 37 | x = line.split('+=') 38 | if len(x) != 2: continue 39 | g = x[1].strip() 40 | if not g.endswith('.gremlin'): continue 41 | if g.endswith('.valgrind.gremlin'): continue 42 | if not os.path.exists(g): continue 43 | v = g[:-len('.gremlin')] + '.valgrind.gremlin' 44 | f = open(v, 'w') 45 | f.write('#!/usr/bin/env gremlin\n') 46 | f.write("env GREMLIN_PREFIX 'libtool --mode=execute valgrind --tool=memcheck --trace-children=yes --error-exitcode=127 --leak-check=full --gen-suppressions=all --suppressions=\"${CONSUS_SRCDIR}/consus.supp\"'\n") 47 | f.write('include ' + os.path.basename(g) + '\n') 48 | f.flush() 49 | f.close() 50 | os.chmod(v, stat.S_IRWXU) 51 | yield 'auto', (x[0] + '+= ' + v + '\n') 52 | 53 | prev = None 54 | fout = open('Makefile.am.tmp', 'w') 55 | for line in lines(): 56 | if prev is None or prev[0] != 'auto' or prev[1] != line[1]: 57 | fout.write(line[1]) 58 | prev = line 59 | fout.flush() 60 | fout.close 61 | os.rename('Makefile.am.tmp', 'Makefile.am') 62 | -------------------------------------------------------------------------------- /man/consus-availability-check.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-coordinator.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-create-data-center.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-debug-client-configuration.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-debug-kvs-configuration.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-debug-txman-configuration.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-debug.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-key-value-store.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-set-default-data-center.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus-transaction-manager.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /man/consus.1.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | # SYNOPSIS 4 | 5 | # DESCRIPTION 6 | 7 | # OPTIONS 8 | 9 | # ENVIRONMENT 10 | 11 | # FILES 12 | 13 | # EXAMPLES 14 | 15 | # AUTHORS 16 | 17 | # REPORTING BUGS 18 | 19 | # COPYRIGHT 20 | 21 | # SEE ALSO 22 | -------------------------------------------------------------------------------- /namespace.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, Robert Escriva 2 | // All rights reserved. 3 | 4 | #ifndef consus_namespace_h_ 5 | #define consus_namespace_h_ 6 | 7 | #define BEGIN_CONSUS_NAMESPACE \ 8 | namespace consus __attribute__ ((visibility ("hidden"))) { 9 | 10 | #define END_CONSUS_NAMESPACE } 11 | 12 | #endif // consus_namespace_h_ 13 | -------------------------------------------------------------------------------- /test/1-node-1-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 \ 8 | 22751 \ 9 | 22761 10 | 11 | run mkdir coord1 12 | 13 | run mkdir txman1.dc1 14 | 15 | run mkdir kvs1.dc1 16 | 17 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 18 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 19 | 20 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 21 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 22 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 23 | 24 | run consus availability-check --stable --transaction-managers 1 --key-value-stores 1 --transaction-manager-groups 1 --timeout 300 25 | -------------------------------------------------------------------------------- /test/1-node-2-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 \ 8 | 22751 \ 9 | 22761 \ 10 | 23751 \ 11 | 23761 12 | 13 | run mkdir coord1 14 | 15 | run mkdir txman1.dc1 16 | run mkdir txman1.dc2 17 | 18 | run mkdir kvs1.dc1 19 | run mkdir kvs1.dc2 20 | 21 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 22 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 23 | 24 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 25 | run consus create-data-center --cluster 127.0.0.1:1982 dc2 26 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 27 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 28 | daemon consus transaction-manager --debug --foreground --data=txman1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23751 --data-center dc2 29 | daemon consus key-value-store --debug --foreground --data=kvs1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23761 --data-center dc2 30 | 31 | run consus availability-check --stable --transaction-managers 2 --key-value-stores 2 --transaction-manager-groups 2 --timeout 300 32 | -------------------------------------------------------------------------------- /test/1-node-3-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 \ 8 | 22751 \ 9 | 22761 \ 10 | 23751 \ 11 | 23761 \ 12 | 24751 \ 13 | 24761 14 | 15 | run mkdir coord1 16 | 17 | run mkdir txman1.dc1 18 | run mkdir txman1.dc2 19 | run mkdir txman1.dc3 20 | 21 | run mkdir kvs1.dc1 22 | run mkdir kvs1.dc2 23 | run mkdir kvs1.dc3 24 | 25 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 26 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 27 | 28 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 29 | run consus create-data-center --cluster 127.0.0.1:1982 dc2 30 | run consus create-data-center --cluster 127.0.0.1:1982 dc3 31 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 32 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 33 | daemon consus transaction-manager --debug --foreground --data=txman1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23751 --data-center dc2 34 | daemon consus key-value-store --debug --foreground --data=kvs1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23761 --data-center dc2 35 | daemon consus transaction-manager --debug --foreground --data=txman1.dc3 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 24751 --data-center dc3 36 | daemon consus key-value-store --debug --foreground --data=kvs1.dc3 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 24761 --data-center dc3 37 | 38 | run consus availability-check --stable --transaction-managers 3 --key-value-stores 3 --transaction-manager-groups 3 --timeout 300 39 | -------------------------------------------------------------------------------- /test/1-node-4-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 \ 8 | 22751 \ 9 | 22761 \ 10 | 23751 \ 11 | 23761 \ 12 | 24751 \ 13 | 24761 \ 14 | 25751 \ 15 | 25761 16 | 17 | run mkdir coord1 18 | 19 | run mkdir txman1.dc1 20 | run mkdir txman1.dc2 21 | run mkdir txman1.dc3 22 | run mkdir txman1.dc4 23 | 24 | run mkdir kvs1.dc1 25 | run mkdir kvs1.dc2 26 | run mkdir kvs1.dc3 27 | run mkdir kvs1.dc4 28 | 29 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 30 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 31 | 32 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 33 | run consus create-data-center --cluster 127.0.0.1:1982 dc2 34 | run consus create-data-center --cluster 127.0.0.1:1982 dc3 35 | run consus create-data-center --cluster 127.0.0.1:1982 dc4 36 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 37 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 38 | daemon consus transaction-manager --debug --foreground --data=txman1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23751 --data-center dc2 39 | daemon consus key-value-store --debug --foreground --data=kvs1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23761 --data-center dc2 40 | daemon consus transaction-manager --debug --foreground --data=txman1.dc3 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 24751 --data-center dc3 41 | daemon consus key-value-store --debug --foreground --data=kvs1.dc3 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 24761 --data-center dc3 42 | daemon consus transaction-manager --debug --foreground --data=txman1.dc4 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 25751 --data-center dc4 43 | daemon consus key-value-store --debug --foreground --data=kvs1.dc4 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 25761 --data-center dc4 44 | 45 | run consus availability-check --stable --transaction-managers 4 --key-value-stores 4 --transaction-manager-groups 4 --timeout 300 46 | -------------------------------------------------------------------------------- /test/1-node-5-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 \ 8 | 22751 \ 9 | 22761 \ 10 | 23751 \ 11 | 23761 \ 12 | 24751 \ 13 | 24761 \ 14 | 25751 \ 15 | 25761 \ 16 | 26751 \ 17 | 26761 18 | 19 | run mkdir coord1 20 | 21 | run mkdir txman1.dc1 22 | run mkdir txman1.dc2 23 | run mkdir txman1.dc3 24 | run mkdir txman1.dc4 25 | run mkdir txman1.dc5 26 | 27 | run mkdir kvs1.dc1 28 | run mkdir kvs1.dc2 29 | run mkdir kvs1.dc3 30 | run mkdir kvs1.dc4 31 | run mkdir kvs1.dc5 32 | 33 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 34 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 35 | 36 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 37 | run consus create-data-center --cluster 127.0.0.1:1982 dc2 38 | run consus create-data-center --cluster 127.0.0.1:1982 dc3 39 | run consus create-data-center --cluster 127.0.0.1:1982 dc4 40 | run consus create-data-center --cluster 127.0.0.1:1982 dc5 41 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 42 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 43 | daemon consus transaction-manager --debug --foreground --data=txman1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23751 --data-center dc2 44 | daemon consus key-value-store --debug --foreground --data=kvs1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23761 --data-center dc2 45 | daemon consus transaction-manager --debug --foreground --data=txman1.dc3 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 24751 --data-center dc3 46 | daemon consus key-value-store --debug --foreground --data=kvs1.dc3 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 24761 --data-center dc3 47 | daemon consus transaction-manager --debug --foreground --data=txman1.dc4 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 25751 --data-center dc4 48 | daemon consus key-value-store --debug --foreground --data=kvs1.dc4 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 25761 --data-center dc4 49 | daemon consus transaction-manager --debug --foreground --data=txman1.dc5 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 26751 --data-center dc5 50 | daemon consus key-value-store --debug --foreground --data=kvs1.dc5 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 26761 --data-center dc5 51 | 52 | run consus availability-check --stable --transaction-managers 5 --key-value-stores 5 --transaction-manager-groups 5 --timeout 300 53 | -------------------------------------------------------------------------------- /test/2-node-1-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 1983 \ 8 | 22751 22752 \ 9 | 22761 22762 10 | 11 | run mkdir coord1 coord2 12 | 13 | run mkdir txman1.dc1 txman2.dc1 14 | 15 | run mkdir kvs1.dc1 kvs2.dc1 16 | 17 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 18 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 19 | 20 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 21 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 22 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 23 | daemon consus transaction-manager --debug --foreground --data=txman2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22752 --data-center dc1 24 | daemon consus key-value-store --debug --foreground --data=kvs2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22762 --data-center dc1 25 | 26 | run consus availability-check --stable --transaction-managers 2 --key-value-stores 2 --transaction-manager-groups 1 --timeout 300 27 | -------------------------------------------------------------------------------- /test/3-node-1-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 1983 1984 \ 8 | 22751 22752 22753 \ 9 | 22761 22762 22763 10 | 11 | run mkdir coord1 coord2 coord3 12 | 13 | run mkdir txman1.dc1 txman2.dc1 txman3.dc1 14 | 15 | run mkdir kvs1.dc1 kvs2.dc1 kvs3.dc1 16 | 17 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 18 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 19 | 20 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 21 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 22 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 23 | daemon consus transaction-manager --debug --foreground --data=txman2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22752 --data-center dc1 24 | daemon consus key-value-store --debug --foreground --data=kvs2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22762 --data-center dc1 25 | daemon consus transaction-manager --debug --foreground --data=txman3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22753 --data-center dc1 26 | daemon consus key-value-store --debug --foreground --data=kvs3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22763 --data-center dc1 27 | 28 | run consus availability-check --stable --transaction-managers 3 --key-value-stores 3 --transaction-manager-groups 1 --timeout 300 29 | -------------------------------------------------------------------------------- /test/3-node-2-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 1983 1984 \ 8 | 22751 22752 22753 \ 9 | 22761 22762 22763 \ 10 | 23751 23752 23753 \ 11 | 23761 23762 23763 12 | 13 | run mkdir coord1 coord2 coord3 14 | 15 | run mkdir txman1.dc1 txman2.dc1 txman3.dc1 16 | run mkdir txman1.dc2 txman2.dc2 txman3.dc2 17 | 18 | run mkdir kvs1.dc1 kvs2.dc1 kvs3.dc1 19 | run mkdir kvs1.dc2 kvs2.dc2 kvs3.dc2 20 | 21 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 22 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 23 | 24 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 25 | run consus create-data-center --cluster 127.0.0.1:1982 dc2 26 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 27 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 28 | daemon consus transaction-manager --debug --foreground --data=txman2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22752 --data-center dc1 29 | daemon consus key-value-store --debug --foreground --data=kvs2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22762 --data-center dc1 30 | daemon consus transaction-manager --debug --foreground --data=txman3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22753 --data-center dc1 31 | daemon consus key-value-store --debug --foreground --data=kvs3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22763 --data-center dc1 32 | daemon consus transaction-manager --debug --foreground --data=txman1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23751 --data-center dc2 33 | daemon consus key-value-store --debug --foreground --data=kvs1.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23761 --data-center dc2 34 | daemon consus transaction-manager --debug --foreground --data=txman2.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23752 --data-center dc2 35 | daemon consus key-value-store --debug --foreground --data=kvs2.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23762 --data-center dc2 36 | daemon consus transaction-manager --debug --foreground --data=txman3.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23753 --data-center dc2 37 | daemon consus key-value-store --debug --foreground --data=kvs3.dc2 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 23763 --data-center dc2 38 | 39 | run consus availability-check --stable --transaction-managers 6 --key-value-stores 6 --transaction-manager-groups 2 --timeout 300 40 | -------------------------------------------------------------------------------- /test/4-node-1-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 1983 1984 1985 \ 8 | 22751 22752 22753 22754 \ 9 | 22761 22762 22763 22764 10 | 11 | run mkdir coord1 coord2 coord3 coord4 12 | 13 | run mkdir txman1.dc1 txman2.dc1 txman3.dc1 txman4.dc1 14 | 15 | run mkdir kvs1.dc1 kvs2.dc1 kvs3.dc1 kvs4.dc1 16 | 17 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 18 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 19 | 20 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 21 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 22 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 23 | daemon consus transaction-manager --debug --foreground --data=txman2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22752 --data-center dc1 24 | daemon consus key-value-store --debug --foreground --data=kvs2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22762 --data-center dc1 25 | daemon consus transaction-manager --debug --foreground --data=txman3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22753 --data-center dc1 26 | daemon consus key-value-store --debug --foreground --data=kvs3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22763 --data-center dc1 27 | daemon consus transaction-manager --debug --foreground --data=txman4.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22754 --data-center dc1 28 | daemon consus key-value-store --debug --foreground --data=kvs4.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22764 --data-center dc1 29 | 30 | run consus availability-check --stable --transaction-managers 4 --key-value-stores 4 --transaction-manager-groups 1 --timeout 300 31 | -------------------------------------------------------------------------------- /test/5-node-1-dc-cluster.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | 3 | env GLOG_logtostderr 4 | env GLOG_minloglevel 0 5 | env GLOG_logbufsecs 0 6 | 7 | tcp-port 1982 1983 1984 1985 1986 \ 8 | 22751 22752 22753 22754 22755 \ 9 | 22761 22762 22763 22764 22765 10 | 11 | run mkdir coord1 coord2 coord3 coord4 coord5 12 | 13 | run mkdir txman1.dc1 txman2.dc1 txman3.dc1 txman4.dc1 txman5.dc1 14 | 15 | run mkdir kvs1.dc1 kvs2.dc1 kvs3.dc1 kvs4.dc1 kvs5.dc1 16 | 17 | daemon consus coordinator --foreground --data=coord1 --listen 127.0.0.1 --listen-port 1982 18 | run replicant availability-check --servers 1 --timeout 30 --host 127.0.0.1 --port 1982 19 | 20 | run consus create-data-center --cluster 127.0.0.1:1982 dc1 21 | daemon consus transaction-manager --debug --foreground --data=txman1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22751 --data-center dc1 22 | daemon consus key-value-store --debug --foreground --data=kvs1.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22761 --data-center dc1 23 | daemon consus transaction-manager --debug --foreground --data=txman2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22752 --data-center dc1 24 | daemon consus key-value-store --debug --foreground --data=kvs2.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22762 --data-center dc1 25 | daemon consus transaction-manager --debug --foreground --data=txman3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22753 --data-center dc1 26 | daemon consus key-value-store --debug --foreground --data=kvs3.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22763 --data-center dc1 27 | daemon consus transaction-manager --debug --foreground --data=txman4.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22754 --data-center dc1 28 | daemon consus key-value-store --debug --foreground --data=kvs4.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22764 --data-center dc1 29 | daemon consus transaction-manager --debug --foreground --data=txman5.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22755 --data-center dc1 30 | daemon consus key-value-store --debug --foreground --data=kvs5.dc1 --connect-string 127.0.0.1:1982 --listen 127.0.0.1 --listen-port 22765 --data-center dc1 31 | 32 | run consus availability-check --stable --transaction-managers 5 --key-value-stores 5 --transaction-manager-groups 1 --timeout 300 33 | -------------------------------------------------------------------------------- /test/demo.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include 5-node-3-dc-cluster.gremlin 3 | pause 4 | -------------------------------------------------------------------------------- /test/env.sh: -------------------------------------------------------------------------------- 1 | export CONSUS_SRCDIR="$1" 2 | export CONSUS_BUILDDIR="$2" 3 | export CONSUS_VERSION="$3" 4 | 5 | export CONSUS_EXEC_PATH="${CONSUS_BUILDDIR}" 6 | export CONSUS_COORD_LIB="${CONSUS_BUILDDIR}"/.libs/libconsus-coordinator 7 | 8 | export PATH=${CONSUS_BUILDDIR}:${CONSUS_SRCDIR}:${PATH} 9 | 10 | export PYTHONPATH="${CONSUS_BUILDDIR}"/bindings/python:"${CONSUS_BUILDDIR}"/bindings/python/.libs:${PYTHONPATH} 11 | -------------------------------------------------------------------------------- /test/th_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011, Robert Escriva 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of po6 nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // C 29 | #include 30 | 31 | // th 32 | #include "th.h" 33 | 34 | int 35 | main(int argc, char* argv[]) 36 | { 37 | bool quiet = false; 38 | 39 | for (int i = 1; i < argc; ++i) 40 | { 41 | quiet = quiet || strcmp(argv[i], "--quiet") == 0; 42 | } 43 | 44 | return th::run_tests(quiet); 45 | } 46 | -------------------------------------------------------------------------------- /test/unit/00.client.1n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.1n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.1n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.1n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.1n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.1n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.1n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.2n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../2-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.3n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.3n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.3n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.3n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.3n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.3n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.3n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.4n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../4-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.5n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.5n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.5n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.5n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.5n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.5n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.5n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.client.py 5 | -------------------------------------------------------------------------------- /test/unit/00.client.py: -------------------------------------------------------------------------------- 1 | import consus 2 | 3 | c1 = consus.Client() 4 | c2 = consus.Client(b'127.0.0.1') 5 | c3 = consus.Client('127.0.0.1') 6 | c4 = consus.Client(b'127.0.0.1', 1982) 7 | c5 = consus.Client('127.0.0.1', 1982) 8 | c6 = consus.Client(b'127.0.0.1:1982') 9 | c7 = consus.Client('127.0.0.1:1982') 10 | c8 = consus.Client(b'[::]:1982,127.0.0.1:1982') 11 | c9 = consus.Client('[::]:1982,127.0.0.1:1982') 12 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.1n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.1n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.1n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.1n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.1n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.1n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.1n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.2n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../2-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.3n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.3n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.3n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.3n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.3n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.3n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.3n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.4n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../4-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.5n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.5n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.5n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.5n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.5n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.5n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.5n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-abort.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-abort.py: -------------------------------------------------------------------------------- 1 | import consus 2 | 3 | c1 = consus.Client() 4 | t1 = c1.begin_transaction() 5 | t1.abort() 6 | 7 | c2 = consus.Client(b'127.0.0.1') 8 | t2 = c1.begin_transaction() 9 | t2.abort() 10 | 11 | c3 = consus.Client('127.0.0.1') 12 | t3 = c1.begin_transaction() 13 | t3.abort() 14 | 15 | c4 = consus.Client(b'127.0.0.1', 1982) 16 | t4 = c1.begin_transaction() 17 | t4.abort() 18 | 19 | c5 = consus.Client('127.0.0.1', 1982) 20 | t5 = c1.begin_transaction() 21 | t5.abort() 22 | 23 | c6 = consus.Client(b'127.0.0.1:1982') 24 | t6 = c1.begin_transaction() 25 | t6.abort() 26 | 27 | c7 = consus.Client('127.0.0.1:1982') 28 | t7 = c1.begin_transaction() 29 | t7.abort() 30 | 31 | c8 = consus.Client(b'[::]:1982,127.0.0.1:1982') 32 | t8 = c1.begin_transaction() 33 | t8.abort() 34 | 35 | c9 = consus.Client('[::]:1982,127.0.0.1:1982') 36 | t9 = c1.begin_transaction() 37 | t9.abort() 38 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.1n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.1n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.1n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.1n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.1n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.1n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.1n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.2n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../2-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.3n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.3n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.3n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.3n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.3n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.3n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.3n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.4n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../4-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.5n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.5n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.5n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.5n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.5n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.5n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.5n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/00.nop-commit.py 5 | -------------------------------------------------------------------------------- /test/unit/00.nop-commit.py: -------------------------------------------------------------------------------- 1 | import consus 2 | 3 | c1 = consus.Client() 4 | t1 = c1.begin_transaction() 5 | t1.commit() 6 | 7 | c2 = consus.Client(b'127.0.0.1') 8 | t2 = c1.begin_transaction() 9 | t2.commit() 10 | 11 | c3 = consus.Client('127.0.0.1') 12 | t3 = c1.begin_transaction() 13 | t3.commit() 14 | 15 | c4 = consus.Client(b'127.0.0.1', 1982) 16 | t4 = c1.begin_transaction() 17 | t4.commit() 18 | 19 | c5 = consus.Client('127.0.0.1', 1982) 20 | t5 = c1.begin_transaction() 21 | t5.commit() 22 | 23 | c6 = consus.Client(b'127.0.0.1:1982') 24 | t6 = c1.begin_transaction() 25 | t6.commit() 26 | 27 | c7 = consus.Client('127.0.0.1:1982') 28 | t7 = c1.begin_transaction() 29 | t7.commit() 30 | 31 | c8 = consus.Client(b'[::]:1982,127.0.0.1:1982') 32 | t8 = c1.begin_transaction() 33 | t8.commit() 34 | 35 | c9 = consus.Client('[::]:1982,127.0.0.1:1982') 36 | t9 = c1.begin_transaction() 37 | t9.commit() 38 | -------------------------------------------------------------------------------- /test/unit/10.single-get.1n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.1n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.1n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.1n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.1n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.1n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.1n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.2n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../2-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.3n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.3n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.3n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.3n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.3n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.3n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.3n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.4n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../4-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.5n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.5n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.5n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.5n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.5n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.5n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.5n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-get.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-get.py: -------------------------------------------------------------------------------- 1 | import consus 2 | 3 | c = consus.Client() 4 | t = c.begin_transaction() 5 | assert t.get('the table', 'the key') is None 6 | t.commit() 7 | -------------------------------------------------------------------------------- /test/unit/10.single-put.1n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.1n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.1n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.1n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.1n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.1n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.1n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.2n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../2-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.3n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.3n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.3n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.3n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.3n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.3n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.3n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.4n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../4-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.5n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.5n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.5n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.5n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.5n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.5n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.5n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/10.single-put.py 5 | -------------------------------------------------------------------------------- /test/unit/10.single-put.py: -------------------------------------------------------------------------------- 1 | import consus 2 | 3 | c = consus.Client() 4 | t = c.begin_transaction() 5 | assert t.put('the table', 'the key', 'the value') 6 | t.commit() 7 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.1n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.1n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.1n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.1n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.1n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.1n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.1n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.2n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../2-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.3n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.3n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.3n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.3n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.3n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.3n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.3n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.4n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../4-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.5n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.5n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.5n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.5n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.5n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.5n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.5n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/11.put-get-separate-commits.py 5 | -------------------------------------------------------------------------------- /test/unit/11.put-get-separate-commits.py: -------------------------------------------------------------------------------- 1 | import consus 2 | 3 | c = consus.Client() 4 | 5 | t = c.begin_transaction() 6 | assert t.get('the table', 'the key') is None 7 | t.commit() 8 | 9 | t = c.begin_transaction() 10 | assert t.put('the table', 'the key', 'the value') 11 | t.commit() 12 | 13 | t = c.begin_transaction() 14 | assert t.get('the table', 'the key') == 'the value' 15 | t.commit() 16 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.1n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.1n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.1n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.1n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.1n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.1n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.1n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../1-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.2n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../2-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.3n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.3n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.3n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.3n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.3n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.3n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.3n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../3-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.4n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../4-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.5n.1dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-1-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.5n.2dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-2-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.5n.3dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-3-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.5n.4dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-4-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.5n.5dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-5-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.5n.6dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-6-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.5n.7dc.gremlin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gremlin 2 | include ../5-node-7-dc-cluster.gremlin 3 | timeout 300 4 | run python ${CONSUS_SRCDIR}/test/unit/12.simple-deadlock.py 5 | -------------------------------------------------------------------------------- /test/unit/12.simple-deadlock.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | import consus 4 | 5 | c = consus.Client() 6 | 7 | t1 = c.begin_transaction() 8 | time.sleep(1) 9 | t2 = c.begin_transaction() 10 | time.sleep(1) 11 | assert t2.put('table', 'key', 'v1') 12 | time.sleep(1) 13 | assert t1.put('table', 'key', 'v2') 14 | time.sleep(1) 15 | 16 | aborted = None 17 | try: 18 | t2.commit() 19 | aborted = False 20 | except consus.ConsusAbortedException: 21 | aborted = True 22 | t1.commit() 23 | assert aborted 24 | -------------------------------------------------------------------------------- /tools/common.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // replicant 29 | #include 30 | 31 | // consus 32 | #include "tools/common.h" 33 | 34 | bool 35 | consus :: finish(consus_client* cl, const char* prog, int64_t id, consus_returncode* status) 36 | { 37 | if (id < 0) 38 | { 39 | std::cerr << prog << ": " << consus_error_message(cl) << std::endl; 40 | return false; 41 | } 42 | 43 | consus_returncode lrc; 44 | int64_t lid = consus_wait(cl, id, -1, &lrc); 45 | 46 | if (lid < 0) 47 | { 48 | std::cerr << prog << ": " << consus_error_message(cl) << std::endl; 49 | return false; 50 | } 51 | 52 | assert(id == lid); 53 | 54 | if (*status != CONSUS_SUCCESS) 55 | { 56 | std::cerr << prog << ": " << consus_error_message(cl) << std::endl; 57 | return false; 58 | } 59 | 60 | return true; 61 | } 62 | -------------------------------------------------------------------------------- /tools/common.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_tools_common_h_ 29 | #define consus_tools_common_h_ 30 | 31 | // STL 32 | #include 33 | 34 | // e 35 | #include 36 | 37 | // consus 38 | #include 39 | #include "namespace.h" 40 | #include "tools/connect_opts.h" 41 | 42 | BEGIN_CONSUS_NAMESPACE 43 | 44 | bool finish(consus_client* cl, const char* prog, int64_t id, consus_returncode* status); 45 | 46 | END_CONSUS_NAMESPACE 47 | 48 | #endif // consus_tools_common_h_ 49 | -------------------------------------------------------------------------------- /tools/locate-coordinator-lib.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_tools_common_h_ 29 | #define consus_tools_common_h_ 30 | 31 | // STL 32 | #include 33 | 34 | // e 35 | #include 36 | 37 | // consus 38 | #include 39 | #include "namespace.h" 40 | 41 | BEGIN_CONSUS_NAMESPACE 42 | 43 | class connect_opts 44 | { 45 | public: 46 | connect_opts(); 47 | ~connect_opts() throw (); 48 | 49 | public: 50 | const e::argparser& parser() { return m_ap; } 51 | bool validate(); 52 | consus_client* create(); 53 | 54 | private: 55 | e::argparser m_ap; 56 | 57 | private: 58 | connect_opts(const connect_opts&); 59 | connect_opts& operator = (const connect_opts&); 60 | }; 61 | 62 | bool finish(consus_client* cl, const char* prog, int64_t id, consus_returncode* status); 63 | bool locate_coordinator_lib(const char* argv0, std::string* path); 64 | 65 | END_CONSUS_NAMESPACE 66 | 67 | #endif // consus_tools_common_h_ 68 | -------------------------------------------------------------------------------- /txman/controller.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // consus 29 | #include "txman/controller.h" 30 | #include "txman/daemon.h" 31 | 32 | using consus::controller; 33 | 34 | controller :: controller(daemon* d) 35 | : m_d(d) 36 | { 37 | } 38 | 39 | controller :: ~controller() throw () 40 | { 41 | } 42 | 43 | po6::net::location 44 | controller :: lookup(uint64_t server_id) 45 | { 46 | configuration* c = m_d->get_config(); 47 | 48 | if (c && c->exists(comm_id(server_id))) 49 | { 50 | return c->get_address(comm_id(server_id)); 51 | } 52 | 53 | return po6::net::location(); 54 | } 55 | -------------------------------------------------------------------------------- /txman/controller.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above copyright 10 | // notice, this list of conditions and the following disclaimer in the 11 | // documentation and/or other materials provided with the distribution. 12 | // * Neither the name of Consus nor the names of its contributors may be 13 | // used to endorse or promote products derived from this software without 14 | // specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef consus_txman_controller_h_ 29 | #define consus_txman_controller_h_ 30 | 31 | // BusyBee 32 | #include 33 | 34 | // consus 35 | #include "namespace.h" 36 | 37 | BEGIN_CONSUS_NAMESPACE 38 | class daemon; 39 | 40 | class controller : public busybee_controller 41 | { 42 | public: 43 | controller(daemon* d); 44 | ~controller() throw (); 45 | 46 | public: 47 | virtual po6::net::location lookup(uint64_t server_id); 48 | 49 | private: 50 | daemon* m_d; 51 | 52 | private: 53 | controller(const controller&); 54 | controller& operator = (const controller&); 55 | }; 56 | 57 | END_CONSUS_NAMESPACE 58 | 59 | #endif // consus_txman_controller_h_ 60 | -------------------------------------------------------------------------------- /visibility.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-2016, Robert Escriva, Cornell University 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of Consus nor the names of its contributors may be 13 | * used to endorse or promote products derived from this software without 14 | * specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef consus_visibility_h_ 30 | #define consus_visibility_h_ 31 | 32 | #define CONSUS_API __attribute__ ((visibility ("default"))) 33 | 34 | #endif /* consus_visibility_h_ */ 35 | --------------------------------------------------------------------------------