pax_global_header 0000666 0000000 0000000 00000000064 14156145273 0014522 g ustar 00root root 0000000 0000000 52 comment=456fd203c98f6edca91e9b272cd01e6a5569fdb9
raft-0.11.3/ 0000775 0000000 0000000 00000000000 14156145273 0012540 5 ustar 00root root 0000000 0000000 raft-0.11.3/.clang-format 0000664 0000000 0000000 00000000217 14156145273 0015113 0 ustar 00root root 0000000 0000000 BasedOnStyle: Chromium
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
AfterStruct: true
IndentWidth: 4
PointerAlignment: Right
raft-0.11.3/.dir-locals.el 0000664 0000000 0000000 00000000423 14156145273 0015170 0 ustar 00root root 0000000 0000000 ((nil . ((fill-column . 80)))
(c-mode . ((flycheck-clang-definitions . ("HAVE_LINUX_AIO_ABI_H" "HAVE_LINUX_IO_URING_H" "_GNU_SOURCE"))
(flycheck-clang-args . ("-Wpedantic" "-Wall" "-Wextra"))
(flycheck-gcc-definitions . ("HAVE_LINUX_IO_URING_H" "_GNU_SOURCE")))))
raft-0.11.3/.github/ 0000775 0000000 0000000 00000000000 14156145273 0014100 5 ustar 00root root 0000000 0000000 raft-0.11.3/.github/workflows/ 0000775 0000000 0000000 00000000000 14156145273 0016135 5 ustar 00root root 0000000 0000000 raft-0.11.3/.github/workflows/build-and-test.yml 0000664 0000000 0000000 00000006624 14156145273 0021504 0 ustar 00root root 0000000 0000000 name: CI Tests
on:
- push
- pull_request
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
- ubuntu-20.04
compiler:
- gcc
- clang
tracing:
- LIBRAFT_TRACE=1
- NOLIBRAFT_TRACE=1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq lcov linux-libc-dev liblz4-dev libuv1-dev btrfs-progs xfsprogs zfsutils-linux
- name: Build
env:
CC: ${{ matrix.compiler }}
run: |
git clone --depth 1 https://github.com/edlund/amalgamate.git
export PATH=$PATH:$PWD/amalgamate
autoreconf -i
./configure --enable-example --enable-debug --enable-code-coverage --enable-sanitize
amalgamate.py --config=amalgamation.json --source=$(pwd)
$CC raft.c -c -D_GNU_SOURCE -DHAVE_LINUX_AIO_ABI_H -Wall -Wextra -Wpedantic -fpic
- name: Test
env:
CC: ${{ matrix.compiler }}
run: |
export ${{ matrix.tracing }}
./test/lib/fs.sh setup
make check $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false)
./test/lib/fs.sh teardown
- name: Coverage
env:
CC: ${{ matrix.compiler }}
run: if [ "${CC}" = "gcc" ]; then make code-coverage-capture; fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
verbose: true
build-and-test-nolz4:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
- ubuntu-20.04
compiler:
- gcc
- clang
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq lcov linux-libc-dev libuv1-dev btrfs-progs xfsprogs zfsutils-linux
- name: Build
env:
CC: ${{ matrix.compiler }}
run: |
git clone --depth 1 https://github.com/edlund/amalgamate.git
export PATH=$PATH:$PWD/amalgamate
autoreconf -i
./configure --enable-example --enable-debug --enable-code-coverage --enable-sanitize --disable-lz4
amalgamate.py --config=amalgamation.json --source=$(pwd)
$CC raft.c -c -D_GNU_SOURCE -DHAVE_LINUX_AIO_ABI_H -Wall -Wextra -Wpedantic -fpic
- name: Test
env:
CC: ${{ matrix.compiler }}
run: |
./test/lib/fs.sh setup
make check CFLAGS=-O0 $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false)
./test/lib/fs.sh teardown
- name: Coverage
env:
CC: ${{ matrix.compiler }}
run: if [ "${CC}" = "gcc" ]; then make code-coverage-capture; fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
verbose: true
build-nolz4-fail:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq lcov linux-libc-dev libuv1-dev btrfs-progs xfsprogs zfsutils-linux
# Expect the configure step to fail
- name: Build
env:
CC: gcc
run: |
autoreconf -i
! ./configure --enable-example --enable-debug --enable-code-coverage --enable-sanitize
raft-0.11.3/.github/workflows/cla-check.yml 0000664 0000000 0000000 00000000271 14156145273 0020472 0 ustar 00root root 0000000 0000000 name: Canonical CLA
on:
- pull_request
jobs:
cla-check:
runs-on: ubuntu-20.04
steps:
- name: Check if CLA signed
uses: canonical/has-signed-canonical-cla@v1
raft-0.11.3/.github/workflows/coverity.yml 0000664 0000000 0000000 00000002751 14156145273 0020531 0 ustar 00root root 0000000 0000000 name: Coverity
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download Coverity Build Tool
run: |
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=canonical/raft" -O cov-analysis-linux64.tar.gz
mkdir cov-analysis-linux64
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq lcov linux-libc-dev liblz4-dev libuv1-dev btrfs-progs xfsprogs zfsutils-linux
- name: Run coverity
run: |
export PATH="$(pwd)/cov-analysis-linux64/bin:${PATH}"
# Configure
autoreconf -i
mkdir build
cd build
../configure
# Build
cov-build --dir cov-int make -j4
tar czvf raft.tgz cov-int
# Submit the results
curl \
--form project=canonical/raft \
--form token=${TOKEN} \
--form email=mathieu.bordere@canonical.com \
--form file=@raft.tgz \
--form version=master \
--form description="${GITHUB_SHA}" \
https://scan.coverity.com/builds?project=canonical/raft
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
raft-0.11.3/.github/workflows/packages.yml 0000664 0000000 0000000 00000002447 14156145273 0020445 0 ustar 00root root 0000000 0000000 name: Build PPA source packages
on:
- push
jobs:
build:
strategy:
fail-fast: false
matrix:
target:
- bionic
- focal
- impish
runs-on: ubuntu-20.04
steps:
- name: Clone the repositories
run: |
git clone https://github.com/canonical/raft
git clone https://github.com/canonical/dqlite-ppa -b raft --depth 1
- name: Setup dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq debhelper devscripts
- name: Build source package
env:
DEBFULLNAME: "Github Actions"
DEBEMAIL: "noreply@linuxcontainers.org"
TARGET: ${{ matrix.target }}
run: |
cp -R dqlite-ppa/debian raft/
cd raft/
VERSION="$(git describe --tags | sed -e "s/^v//" -e "s/-/+git/")"
dch --create \
--distribution ${TARGET} \
--package raft \
--newversion ${VERSION}~${TARGET}1 \
"Automatic build from Github"
debuild -S -sa -us -uc -d
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: debian-${{ matrix.target }}
if-no-files-found: error
path: |
*.buildinfo
*.changes
*.dsc
*.tar.*
raft-0.11.3/.gitignore 0000664 0000000 0000000 00000000677 14156145273 0014542 0 ustar 00root root 0000000 0000000 *.o
*.gcno
*.gcda
*~
Makefile.in
aclocal.m4
aminclude_static.am
autom4te.cache/
config.h.in
configure
Makefile
config.h
config.log
config.status
libtool
raft.pc
stamp-h1
*.lo
*.la
.dirstamp
.deps/
.libs/
test/unit/core
test/unit/uv
test/integration/core
test/integration/uv
test/fuzzy/core
test/*/*.log
test/*/*.trs
os-test*
test-suite.log
coverage/
coverage.info
TAGS
example/server
example/cluster
benchmark/os-disk-write
tmp
conftest*
doc/build raft-0.11.3/.travis.yml 0000664 0000000 0000000 00000002056 14156145273 0014654 0 ustar 00root root 0000000 0000000 language: c
addons:
apt:
packages:
- lcov
- linux-libc-dev
- libuv1-dev
- liblz4-dev
- btrfs-progs
- xfsprogs
- zfsutils-linux
jobs:
include:
- if: type != pull_request
compiler: gcc
dist: bionic
arch: s390x
- if: type == pull_request
compiler: gcc
dist: bionic
arch: arm64
- if: type != pull_request
compiler: clang
dist: bionic
arch: ppc64le
before_script:
- git clone --depth 1 https://github.com/edlund/amalgamate.git
- export PATH=$PATH:$PWD/amalgamate
script:
- autoreconf -i
- |
if [ $TRAVIS_CPU_ARCH = "s390x" ] || [ $TRAVIS_CPU_ARCH = "arm64" ]; then
./configure --enable-example --enable-debug
else
./configure --enable-example --enable-debug --enable-sanitize
fi
- amalgamate.py --config=amalgamation.json --source=$(pwd)
- $CC raft.c -c -D_GNU_SOURCE -DHAVE_LINUX_AIO_ABI_H -Wall -Wextra -Wpedantic -fpic
- ./test/lib/fs.sh setup
- make check $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false)
- ./test/lib/fs.sh teardown
raft-0.11.3/AUTHORS 0000664 0000000 0000000 00000000360 14156145273 0013607 0 ustar 00root root 0000000 0000000 Unless mentioned otherwise in a specific file's header, all code in this
project is released under the LGPL v3 license.
The list of authors and contributors can be retrieved from the git
commit history and in some cases, the file headers.
raft-0.11.3/LICENSE 0000664 0000000 0000000 00000021611 14156145273 0013546 0 ustar 00root root 0000000 0000000 All files in this repository are licensed as follows. If you contribute
to this repository, it is assumed that you license your contribution
under the same license unless you state otherwise.
All files Copyright (C) 2019 Canonical Ltd. unless otherwise specified in the file.
This software is licensed under the LGPLv3, included below.
As a special exception to the GNU Lesser General Public License version 3
("LGPL3"), the copyright holders of this Library give you permission to
convey to a third party a Combined Work that links statically or dynamically
to this Library without providing any Minimal Corresponding Source or
Minimal Application Code as set out in 4d or providing the installation
information set out in section 4e, provided that you comply with the other
provisions of LGPL3 and provided that you meet, for the Application the
terms and conditions of the license(s) which apply to the Application.
Except as stated in this special exception, the provisions of LGPL3 will
continue to comply in full to this Library. If you modify this Library, you
may apply this exception to your version of this Library, but you are not
obliged to do so. If you do not wish to do so, delete this exception
statement from your version. This exception does not (and cannot) modify any
license terms which apply to the Application, with which you must still
comply.
SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
raft-0.11.3/Makefile.am 0000664 0000000 0000000 00000014605 14156145273 0014602 0 ustar 00root root 0000000 0000000 ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS)
include_HEADERS = include/raft.h
raftincludedir = $(includedir)/raft
raftinclude_HEADERS =
lib_LTLIBRARIES = libraft.la
libraft_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
libraft_la_LDFLAGS = -version-info 0:7:0
libraft_la_SOURCES = \
src/byte.c \
src/client.c \
src/compress.c \
src/configuration.c \
src/convert.c \
src/election.c \
src/entry.c \
src/err.c \
src/heap.c \
src/log.c \
src/membership.c \
src/progress.c \
src/raft.c \
src/recv.c \
src/recv_append_entries.c \
src/recv_append_entries_result.c \
src/recv_request_vote.c \
src/recv_request_vote_result.c \
src/recv_install_snapshot.c \
src/recv_timeout_now.c \
src/replication.c \
src/snapshot.c \
src/start.c \
src/state.c \
src/syscall.c \
src/tick.c \
src/tracing.c
bin_PROGRAMS =
check_PROGRAMS = \
test/unit/core
TESTS = $(check_PROGRAMS)
check_LTLIBRARIES = libtest.la
libtest_la_CFLAGS = $(AM_CFLAGS) -DMUNIT_TEST_NAME_LEN=60 -Wno-unused-result -Wno-conversion
libtest_la_SOURCES = \
test/lib/fault.c \
test/lib/fsm.c \
test/lib/heap.c \
test/lib/munit.c \
test/lib/tracer.c \
test/lib/tcp.c
test_unit_core_SOURCES = \
src/byte.c \
src/compress.c \
src/configuration.c \
src/err.c \
src/heap.c \
src/log.c \
test/unit/main_core.c \
test/unit/test_byte.c \
test/unit/test_compress.c \
test/unit/test_configuration.c \
test/unit/test_err.c \
test/unit/test_log.c \
test/unit/test_queue.c
test_unit_core_CFLAGS = $(AM_CFLAGS) -Wno-conversion
test_unit_core_LDADD = libtest.la
if LZ4_AVAILABLE
test_unit_core_CFLAGS += -DLZ4_AVAILABLE
test_unit_core_LDFLAGS = $(LZ4_LIBS)
libraft_la_CFLAGS += -DLZ4_AVAILABLE
libraft_la_LDFLAGS += $(LZ4_LIBS)
endif # LZ4_AVAILABLE
if LZ4_ENABLED
test_unit_core_CFLAGS += -DLZ4_ENABLED
libraft_la_CFLAGS += -DLZ4_ENABLED
endif # LZ4_ENABLED
if FIXTURE_ENABLED
libraft_la_SOURCES += src/fixture.c
raftinclude_HEADERS += include/raft/fixture.h
check_PROGRAMS += \
test/integration/core \
test/fuzzy/core
libtest_la_SOURCES += \
test/lib/cluster.c
test_integration_core_SOURCES = \
test/integration/main_core.c \
test/integration/test_apply.c \
test/integration/test_assign.c \
test/integration/test_barrier.c \
test/integration/test_bootstrap.c \
test/integration/test_digest.c \
test/integration/test_election.c \
test/integration/test_fixture.c \
test/integration/test_heap.c \
test/integration/test_membership.c \
test/integration/test_recover.c \
test/integration/test_replication.c \
test/integration/test_snapshot.c \
test/integration/test_strerror.c \
test/integration/test_tick.c \
test/integration/test_transfer.c \
test/integration/test_start.c
test_integration_core_CFLAGS = $(AM_CFLAGS) -Wno-conversion
test_integration_core_LDFLAGS = -no-install
test_integration_core_LDADD = libtest.la libraft.la
test_fuzzy_core_SOURCES = \
test/fuzzy/main_core.c \
test/fuzzy/test_election.c \
test/fuzzy/test_liveness.c \
test/fuzzy/test_membership.c \
test/fuzzy/test_replication.c
test_fuzzy_core_CFLAGS = $(AM_CFLAGS) -Wno-conversion
test_fuzzy_core_LDFLAGS = -no-install
test_fuzzy_core_LDADD = libtest.la libraft.la
endif # FIXTURE_ENABLED
if UV_ENABLED
libraft_la_SOURCES += \
src/uv.c \
src/uv_append.c \
src/uv_encoding.c \
src/uv_finalize.c \
src/uv_fs.c \
src/uv_ip.c \
src/uv_list.c \
src/uv_metadata.c \
src/uv_os.c \
src/uv_prepare.c \
src/uv_recv.c \
src/uv_segment.c \
src/uv_send.c \
src/uv_snapshot.c \
src/uv_tcp.c \
src/uv_tcp_listen.c \
src/uv_tcp_connect.c \
src/uv_truncate.c \
src/uv_writer.c
libraft_la_LDFLAGS += $(UV_LIBS)
raftinclude_HEADERS += include/raft/uv.h
check_PROGRAMS += \
test/unit/uv \
test/integration/uv
libtest_la_SOURCES += \
test/lib/aio.c \
test/lib/dir.c \
test/lib/tcp.c \
test/lib/loop.c
test_unit_uv_SOURCES = \
src/err.c \
src/heap.c \
src/syscall.c \
src/tracing.c \
src/uv_fs.c \
src/uv_os.c \
src/uv_writer.c \
test/unit/main_uv.c \
test/unit/test_uv_fs.c \
test/unit/test_uv_writer.c
test_unit_uv_LDFLAGS = $(UV_LIBS)
test_unit_uv_CFLAGS = $(AM_CFLAGS) -Wno-conversion
test_unit_uv_LDADD = libtest.la
# The integration/uv test is not linked to libraft, but built
# directly against the libraft sources in order to test some
# non-visible, non-API functions.
test_integration_uv_SOURCES = \
${libraft_la_SOURCES} \
test/integration/main_uv.c \
test/integration/test_uv_init.c \
test/integration/test_uv_append.c \
test/integration/test_uv_bootstrap.c \
test/integration/test_uv_load.c \
test/integration/test_uv_recover.c \
test/integration/test_uv_recv.c \
test/integration/test_uv_send.c \
test/integration/test_uv_set_term.c \
test/integration/test_uv_tcp_connect.c \
test/integration/test_uv_tcp_listen.c \
test/integration/test_uv_snapshot_put.c \
test/integration/test_uv_truncate.c
test_integration_uv_CFLAGS = $(AM_CFLAGS) -Wno-type-limits -Wno-conversion
test_integration_uv_LDFLAGS = -no-install $(UV_LIBS)
test_integration_uv_LDADD = libtest.la
AM_CFLAGS += $(UV_CFLAGS)
if LZ4_AVAILABLE
test_integration_uv_CFLAGS += -DLZ4_AVAILABLE
test_integration_uv_LDFLAGS += $(LZ4_LIBS)
endif # LZ4_AVAILABLE
if LZ4_ENABLED
test_integration_uv_CFLAGS += -DLZ4_ENABLED
endif # LZ4_ENABLED
endif # UV_ENABLED
if EXAMPLE_ENABLED
bin_PROGRAMS += \
example/server \
example/cluster
example_server_SOURCES = example/server.c
example_server_LDFLAGS = -no-install $(UV_LIBS)
example_server_LDADD = libraft.la
example_cluster_SOURCES = example/cluster.c
endif # EXAMPLE_ENABLED
if BENCHMARK_ENABLED
bin_PROGRAMS += \
benchmark/os-disk-write
benchmark_os_disk_write_SOURCES = benchmark/os_disk_write.c
benchmark_os_disk_write_LDFLAGS = -luring
endif # BENCHMARK_ENABLED
if DEBUG_ENABLED
AM_CFLAGS += -Werror -Wall
else
AM_CFLAGS += -DNDEBUG
endif
if SANITIZE_ENABLED
AM_CFLAGS += -fsanitize=address
endif
if CODE_COVERAGE_ENABLED
include $(top_srcdir)/aminclude_static.am
CODE_COVERAGE_DIRECTORY=./src
CODE_COVERAGE_OUTPUT_DIRECTORY=coverage
CODE_COVERAGE_OUTPUT_FILE=coverage.info
CODE_COVERAGE_IGNORE_PATTERN="/usr/include/*"
CODE_COVERAGE_BRANCH_COVERAGE=1
CODE_COVERAGE_LCOV_OPTIONS=$(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) --rc lcov_excl_br_line="assert\("
clean-local: code-coverage-clean
distclean-local: code-coverage-dist-clean
endif # CODE_COVERAGE_ENABLED
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = @PACKAGE_NAME@.pc
raft-0.11.3/README.md 0000664 0000000 0000000 00000014536 14156145273 0014030 0 ustar 00root root 0000000 0000000 [](https://travis-ci.org/canonical/raft) [](https://codecov.io/gh/canonical/raft) [](https://raft.readthedocs.io/en/latest/?badge=latest)
Fully asynchronous C implementation of the Raft consensus protocol.
The library has modular design: its core part implements only the core Raft
algorithm logic, in a fully platform independent way. On top of that, a
pluggable interface defines the I/O implementation for networking (send/receive
RPC messages) and disk persistence (store log entries and snapshots).
A stock implementation of the I/O interface is provided when building the
library with default options. It is based on [libuv](http://libuv.org) and
should fit the vast majority of use cases. The only catch is that it currently
requires Linux, since it uses the Linux
[AIO](http://man7.org/linux/man-pages/man2/io_submit.2.html) API for disk
I/O. Patches are welcome to add support for more platforms.
See [raft.h](https://github.com/canonical/raft/blob/master/include/raft.h) for full documentation.
License
-------
This raft C library is released under a slightly modified version of LGPLv3,
that includes a copyright exception letting users to statically link the library
code in their project and release the final work under their own terms. See the
full [license](https://github.com/canonical/raft/blob/LICENSE) text.
Features
--------
This implementation includes all the basic features described in the Raft
dissertation:
- Leader election
- Log replication
- Log compaction
- Membership changes
It also includes a few optional enhancements:
- Optimistic pipelining to reduce log replication latency
- Writing to leader's disk in parallel
- Automatic stepping down when the leader loses quorum
- Leadership transfer extension
- Pre-vote protocol
Install
-------
If you are on a Debian-based system, you can get the latest development release from
dqlite's [dev PPA](https://launchpad.net/~dqlite/+archive/ubuntu/dev):
```
sudo add-apt-repository ppa:dqlite/dev
sudo apt-get update
sudo apt-get install libraft-dev
```
Building
--------
To build ``libraft`` from source you'll need:
* A reasonably recent version of [libuv](https://libuv.org/) (v1.18.0 or beyond).
* Optionally, but recommended, a reasonably recent version of [liblz4](https://lz4.github.io/lz4/) (v1.7.1 or beyond).
```bash
sudo apt-get install libuv1-dev liblz4-dev
autoreconf -i
./configure --enable-example
make
```
Example
-------
The best way to understand how to use the library is probably reading the code
of the [example server](https://github.com/canonical/raft/blob/master/example/server.c)
included in the source code.
You can also see the example server in action by running:
```bash
./example/cluster
```
which spawns a little cluster of 3 servers, runs a sample workload, and randomly
stops and restarts a server from time to time.
Quick guide
-----------
It is recommended that you read
[raft.h](https://github.com/canonical/raft/blob/master/include/raft.h) for
documentation details, but here's a quick high-level guide of what you'll need
to do (error handling is omitted for brevity).
Create an instance of the stock ```raft_io``` interface implementation (or
implement your own one if the one that comes with the library really does not
fit):
```C
const char *dir = "/your/raft/data";
struct uv_loop_s loop;
struct raft_uv_transport transport;
struct raft_io io;
uv_loop_init(&loop);
raft_uv_tcp_init(&transport, &loop);
raft_uv_init(&io, &loop, dir, &transport);
```
Define your application Raft FSM, implementing the ```raft_fsm``` interface:
```C
struct raft_fsm
{
void *data;
int (*apply)(struct raft_fsm *fsm, const struct raft_buffer *buf, void **result);
int (*snapshot)(struct raft_fsm *fsm, struct raft_buffer *bufs[], unsigned *n_bufs);
int (*restore)(struct raft_fsm *fsm, struct raft_buffer *buf);
}
```
Pick a unique ID and address for each server and initialize the raft object:
```C
unsigned id = 1;
const char *address = "192.168.1.1:9999";
struct raft raft;
raft_init(&raft, &io, &fsm, id, address);
```
If it's the first time you start the cluster, create a configuration object
containing each server that should be present in the cluster (typically just
one, since you can grow your cluster at a later point using ```raft_add``` and
```raft_promote```) and bootstrap:
```C
struct raft_configuration configuration;
raft_configuration_init(&configuration);
raft_configuration_add(&configuration, 1, "192.168.1.1:9999", true);
raft_bootstrap(&raft, &configuration);
```
Start the raft server:
```C
raft_start(&raft);
uv_run(&loop, UV_RUN_DEFAULT);
```
Asynchronously submit requests to apply new commands to your application FSM:
```C
static void apply_callback(struct raft_apply *req, int status, void *result) {
/* ... */
}
struct raft_apply req;
struct raft_buffer buf;
buf.len = ...; /* The length of your FSM entry data */
buf.base = ...; /* Your FSM entry data */
raft_apply(&raft, &req, &buf, 1, apply_callback);
```
To add more servers to the cluster use the ```raft_add()``` and
```raft_promote``` APIs.
Usage Notes
-----------
The default [libuv](http://libuv.org) based ```raft_io``` implementation compresses the raft
snapshots using the ```liblz4``` library. Next to saving disk space, the lz4
compressed snapshots offer additional data integrity checks in the form of a
[Content Checksum](https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md), this allows raft
to detect corruptions that occurred during storage. It is therefore recommended to not disable
lz4 compression by means of the ```--disable-lz4``` configure flag.
Detailed tracing will be enabled when the environment variable `LIBRAFT_TRACE` is set upon startup.
Notable users
-------------
- [dqlite](https://github.com/canonical/dqlite)
Credits
-------
Of course the biggest thanks goes to Diego Ongaro :) (the original author of the
Raft dissertation)
A lot of ideas and inspiration was taken from other Raft implementations such
as:
- CoreOS' Go implementation for [etcd](https://github.com/etcd-io/etcd/tree/master/raft)
- Hashicorp's Go [raft](https://github.com/hashicorp/raft)
- Willem's [C implementation](https://github.com/willemt/raft)
- LogCabin's [C++ implementation](https://github.com/logcabin/logcabin)
raft-0.11.3/ac/ 0000775 0000000 0000000 00000000000 14156145273 0013123 5 ustar 00root root 0000000 0000000 raft-0.11.3/ac/.gitignore 0000664 0000000 0000000 00000000016 14156145273 0015110 0 ustar 00root root 0000000 0000000 *
!.gitignore
raft-0.11.3/amalgamation.json 0000664 0000000 0000000 00000001736 14156145273 0016074 0 ustar 00root root 0000000 0000000 {
"target": "raft.c",
"sources": [
"src/byte.c",
"src/client.c",
"src/configuration.c",
"src/convert.c",
"src/election.c",
"src/entry.c",
"src/err.c",
"src/fixture.c",
"src/heap.c",
"src/log.c",
"src/membership.c",
"src/progress.c",
"src/raft.c",
"src/recv.c",
"src/recv_append_entries.c",
"src/recv_append_entries_result.c",
"src/recv_install_snapshot.c",
"src/recv_request_vote.c",
"src/recv_request_vote_result.c",
"src/replication.c",
"src/snapshot.c",
"src/start.c",
"src/state.c",
"src/syscall.c",
"src/tick.c",
"src/tracing.c",
"src/uv.c",
"src/uv_append.c",
"src/uv_encoding.c",
"src/uv_finalize.c",
"src/uv_fs.c",
"src/uv_ip.c",
"src/uv_list.c",
"src/uv_metadata.c",
"src/uv_os.c",
"src/uv_prepare.c",
"src/uv_recv.c",
"src/uv_segment.c",
"src/uv_send.c",
"src/uv_snapshot.c",
"src/uv_tcp.c",
"src/uv_tcp_connect.c",
"src/uv_tcp_listen.c",
"src/uv_truncate.c",
"src/uv_writer.c"
],
"include_paths": [
"include"
]
}
raft-0.11.3/benchmark/ 0000775 0000000 0000000 00000000000 14156145273 0014472 5 ustar 00root root 0000000 0000000 raft-0.11.3/benchmark/os_disk_write.c 0000664 0000000 0000000 00000025342 14156145273 0017511 0 ustar 00root root 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static char doc[] = "Benchmark operating system disk write performance";
/* Minimum buffer size to benchmark. */
#define MIN_BUF_SIZE 64
/* Maximum buffer size to benchmark. */
#define MAX_BUF_SIZE 4096
/* Minimum physical block size for direct I/O that we expect to detect. */
#define MIN_BLOCK_SIZE 512
/* Maximum physical block size for direct I/O that we expect to detect. */
#define MAX_BLOCK_SIZE 4096
/* Engines */
#define PWRITEV2 0
#define URING 1
/* Modes */
#define BUFFERED 0
#define DIRECT 1
static const char *engines[] =
{[PWRITEV2] = "pwritev2", [URING] = "uring", NULL};
static const char *modes[] =
{[BUFFERED] = "buffered", [DIRECT] = "direct", NULL};
/* Order of fields: {NAME, KEY, ARG, FLAGS, DOC, GROUP}.*/
static struct argp_option options[] = {
{"dir", 'd', "DIR", 0, "Directory to use for temp files (default /tmp)", 0},
{"buf", 'b', "BUF", 0, "Write buffer size (default st_blksize)", 0},
{"writes", 'n', "N", 0, "Number of writes to perform (default 1024)", 0},
{"engine", 'e', "ENGINE", 0, "I/O engine to use (default all)", 0},
{"mode", 'm', "MODE", 0, "Use 'buffered' or 'direct' I/O", 0},
{0}};
struct arguments
{
char *dir;
int buf;
int n;
int engine;
int mode;
};
static int engineCode(const char *engine)
{
int i = 0;
while (engines[i] != NULL) {
if (strcmp(engines[i], engine) == 0) {
return i;
}
i++;
}
return -1;
}
static int modeCode(const char *mode)
{
int i = 0;
while (modes[i] != NULL) {
if (strcmp(modes[i], mode) == 0) {
return i;
}
i++;
}
return -1;
}
static error_t argumentsParse(int key, char *arg, struct argp_state *state)
{
struct arguments *arguments = state->input;
switch (key) {
case 'd':
arguments->dir = arg;
break;
case 'b':
arguments->buf = atoi(arg);
break;
case 'n':
arguments->n = atoi(arg);
break;
case 'e':
arguments->engine = engineCode(arg);
if (arguments->engine == -1) {
return ARGP_ERR_UNKNOWN;
}
break;
case 'm':
arguments->mode = modeCode(arg);
if (arguments->mode == -1) {
return ARGP_ERR_UNKNOWN;
}
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}
static char *makeTempFileTemplate(const char *dir)
{
char *path;
path = malloc(strlen(dir) + strlen("/bench-XXXXXX") + 1);
assert(path != NULL);
sprintf(path, "%s/bench-XXXXXX", dir);
return path;
}
static int createTempFile(const char *dir, int size, char **path, int *fd)
{
int dirfd;
int rv;
*path = makeTempFileTemplate(dir);
*fd = mkstemp(*path);
if (*fd == -1) {
printf("mstemp '%s': %s\n", *path, strerror(errno));
return -1;
}
rv = posix_fallocate(*fd, 0, size);
if (rv != 0) {
errno = rv;
printf("posix_fallocate: %s\n", strerror(errno));
return -1;
}
/* Sync the file and its directory. */
rv = fsync(*fd);
assert(rv == 0);
dirfd = open(dir, O_RDONLY | O_DIRECTORY);
assert(dirfd != -1);
rv = fsync(dirfd);
assert(rv == 0);
close(dirfd);
return 0;
}
/* Allocate a buffer of the given size. */
static void allocBuffer(struct iovec *iov, int size)
{
iov->iov_len = size;
iov->iov_base = aligned_alloc(iov->iov_len, iov->iov_len);
assert(iov->iov_base != NULL);
}
static void setDirectIO(int fd)
{
int flags; /* Current fcntl flags */
int rv;
flags = fcntl(fd, F_GETFL);
rv = fcntl(fd, F_SETFL, flags | O_DIRECT);
assert(rv == 0);
}
/* Detect all suitable block size we can use to write to the underlying device
* using direct I/O. */
static int detectSuitableBlockSizesForDirectIO(const char *dir,
int **block_size,
int *n_block_size)
{
char *path;
int fd;
int size;
int rv;
rv = createTempFile(dir, MAX_BLOCK_SIZE, &path, &fd);
if (rv != 0) {
unlink(path);
return -1;
}
setDirectIO(fd);
*block_size = NULL;
*n_block_size = 0;
for (size = MIN_BLOCK_SIZE; size <= MAX_BLOCK_SIZE; size *= 2) {
struct iovec iov;
allocBuffer(&iov, size);
rv = pwritev2(fd, &iov, 1, 0, RWF_DSYNC | RWF_HIPRI);
free(iov.iov_base);
if (rv == -1) {
assert(errno == EINVAL);
continue; /* Try with a bigger buffer size */
}
assert(rv == size);
*n_block_size += 1;
*block_size = realloc(*block_size, *n_block_size * sizeof **block_size);
assert(*block_size != NULL);
(*block_size)[*n_block_size - 1] = size;
}
close(fd);
unlink(path);
return 0;
}
/* Save current time in 'time'. */
static void timeNow(struct timespec *time)
{
int rv;
rv = clock_gettime(CLOCK_MONOTONIC, time);
assert(rv == 0);
}
/* Calculate how much time has elapsed since 'start', in microseconds. */
static int timeSince(struct timespec *start)
{
struct timespec now;
long nsecs;
timeNow(&now);
if (start->tv_sec == now.tv_sec) {
nsecs = now.tv_nsec - start->tv_nsec;
} else {
nsecs = (now.tv_sec - start->tv_sec) * 1000 * 1000 * 1000 -
start->tv_nsec + now.tv_nsec;
}
return nsecs / 1000;
}
static int writeWithPwriteV2(int fd, struct iovec *iov, int i)
{
int rv;
rv = pwritev2(fd, iov, 1, i * iov->iov_len, RWF_DSYNC | RWF_HIPRI);
if (rv == -1) {
perror("pwritev2");
return -1;
}
assert(rv == (int)iov->iov_len);
return 0;
}
static struct io_uring uring;
static void initUring(int fd, struct iovec *iov)
{
int rv;
rv = io_uring_queue_init(4, &uring, 0);
assert(rv == 0);
rv = io_uring_register_files(&uring, &fd, 1);
assert(rv == 0);
rv = io_uring_register_buffers(&uring, iov, 1);
assert(rv == 0);
}
static int writeWithUring(int fd, struct iovec *iov, int i)
{
struct io_uring_sqe *sqe;
struct io_uring_cqe *cqe;
int rv;
if (i == 0) {
initUring(fd, iov);
}
sqe = io_uring_get_sqe(&uring);
io_uring_prep_write_fixed(sqe, 0, iov->iov_base, iov->iov_len,
i * iov->iov_len, 0);
io_uring_sqe_set_flags(sqe, IOSQE_FIXED_FILE);
sqe->rw_flags = RWF_DSYNC;
rv = io_uring_submit(&uring);
assert(rv == 1);
io_uring_wait_cqe(&uring, &cqe);
if (cqe->res < 0) {
printf("sqe failed: %s\n", strerror(-cqe->res));
return -1;
}
assert(cqe->res == (int)iov->iov_len);
io_uring_cqe_seen(&uring, cqe);
return 0;
}
/* Benchmark the performance of a single disk write. */
int benchmarkWritePerformance(const char *dir,
int buf,
int n,
int engine,
int mode)
{
char *path;
int fd;
struct iovec iov;
struct timespec start;
int i;
int rv;
rv = createTempFile(dir, n * buf, &path, &fd);
if (rv != 0) {
unlink(path);
return -1;
}
allocBuffer(&iov, buf);
if (mode == DIRECT) {
setDirectIO(fd);
}
timeNow(&start);
for (i = 0; i < n; i++) {
switch (engine) {
case PWRITEV2:
rv = writeWithPwriteV2(fd, &iov, i);
break;
case URING:
rv = writeWithUring(fd, &iov, i);
break;
default:
assert(0);
}
}
if (rv != 0) {
return -1;
}
printf("%-8s: %8s writes of %4d bytes take %4d microsecs on average\n",
engines[engine], modes[mode], buf, timeSince(&start) / n);
if (engine == URING) {
io_uring_queue_exit(&uring);
}
close(fd);
unlink(path);
free(path);
return 0;
}
static bool isSuitableBufSizeForDirectIO(int *block_size,
int n_block_size,
int buf)
{
int i;
for (i = 0; i < n_block_size; i++) {
if (block_size[i] == buf) {
return true;
}
}
return false;
}
int main(int argc, char *argv[])
{
struct argp argp = {options, argumentsParse, NULL, doc, 0, 0, 0};
struct arguments arguments;
struct stat st;
int engine;
int mode;
int buf;
int *block_size;
int n_block_size;
int i;
int rv;
arguments.dir = "/tmp";
arguments.buf = -1;
arguments.n = 1024;
arguments.engine = -1;
arguments.mode = -1;
argp_parse(&argp, argc, argv, 0, 0, &arguments);
rv = stat(arguments.dir, &st);
if (rv != 0) {
printf("stat '%s': %s\n", arguments.dir, strerror(errno));
return -1;
}
rv = detectSuitableBlockSizesForDirectIO(arguments.dir, &block_size,
&n_block_size);
if (rv != 0) {
return rv;
}
if (arguments.buf != -1) {
if (arguments.mode == -1 || arguments.mode == DIRECT) {
if (!isSuitableBufSizeForDirectIO(block_size, n_block_size,
arguments.buf)) {
printf("suitable buffer sizes for direct I/O:");
for (i = 0; i < n_block_size; i++) {
printf(" %4d", block_size[i]);
}
printf("\n");
return -1;
}
}
}
for (engine = PWRITEV2; engine <= URING; engine++) {
if (arguments.engine != engine && arguments.engine != -1) {
continue;
}
for (mode = BUFFERED; mode <= DIRECT; mode++) {
if (arguments.mode != mode && arguments.mode != -1) {
continue;
}
for (buf = MIN_BUF_SIZE; buf <= MAX_BUF_SIZE; buf *= 2) {
if (arguments.buf != buf && arguments.buf != -1) {
continue;
}
if (mode == DIRECT) {
if (!isSuitableBufSizeForDirectIO(block_size, n_block_size,
buf)) {
continue;
}
}
rv = benchmarkWritePerformance(arguments.dir, buf, arguments.n,
engine, mode);
if (rv != 0) {
return -1;
}
}
}
}
return 0;
}
raft-0.11.3/configure.ac 0000664 0000000 0000000 00000013441 14156145273 0015031 0 ustar 00root root 0000000 0000000 AC_PREREQ(2.60)
AC_INIT([raft], [0.11.2])
AC_LANG([C])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([ac])
AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability foreign])
AM_SILENT_RULES([yes])
AC_USE_SYSTEM_EXTENSIONS # Defines _GNU_SOURCE and similar
LT_INIT
# The libuv raft_io implementation is built by default if libuv is found, unless
# explicitly disabled.
AC_ARG_ENABLE(uv, AS_HELP_STRING([--disable-uv], [do not build the libuv-based raft_io implementation]))
AS_IF([test "x$enable_uv" != "xno"],
[PKG_CHECK_MODULES(UV, [libuv >= 1.18.0], [have_uv=yes], [have_uv=no])],
[have_uv=no])
AS_IF([test "x$enable_uv" = "xyes" -a "x$have_uv" = "xno"], [AC_MSG_ERROR([libuv required but not found])], [])
AM_CONDITIONAL(UV_ENABLED, test "x$have_uv" = "xyes")
# The libuv raft_io implementation is built by default to compress snapshots if liblz4 is found, unless
# explicitly disabled.
AC_ARG_ENABLE(lz4, AS_HELP_STRING([--disable-lz4], [do not use lz4 compression]))
# Thanks to the OpenVPN configure.ac file for this part.
# If this fails, we will do another test next.
# We also add set LZ4_LIBS otherwise linker will not know about the lz4 library
PKG_CHECK_MODULES(LZ4, [liblz4 >= 1.7.1], [have_lz4="yes"], [LZ4_LIBS="-llz4"])
if test "${have_lz4}" != "yes" ; then
AC_CHECK_HEADERS([lz4.h],
[have_lz4h="yes"],
[])
if test "${have_lz4h}" = "yes" ; then
AC_MSG_CHECKING([additionally if system LZ4 version >= 1.7.1])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include
]],
[[
/* Version encoding: MMNNPP (Major miNor Patch) - see lz4.h for details */
#if LZ4_VERSION_NUMBER < 10701L
#error LZ4 is too old
#endif
]]
)],
[
AC_MSG_RESULT([ok])
have_lz4="yes"
],
[
AC_MSG_RESULT([system LZ4 library is too old])
have_lz4="no"
]
)
fi
fi
AS_IF([test "x$enable_lz4" != "xno" -a "x$have_lz4" != "xyes"],
[AC_MSG_ERROR([liblz4 required but not found])], [])
# LZ4 Can be available without being enabled, this allows a user to activate
# it at a later stage through an API call.
AM_CONDITIONAL(LZ4_AVAILABLE, test "x$have_lz4" = "xyes")
# `LZ4_ENABLED` will cause the libuv snapshot implementation to use lz4
# compression by default.
AM_CONDITIONAL(LZ4_ENABLED, test "x$enable_lz4" != "xno" -a "x$have_lz4" = "xyes")
# The fake I/O implementation and associated fixture is built by default, unless
# explicitly disabled.
AC_ARG_ENABLE(fixture, AS_HELP_STRING([--disable-fixture], [do not build the raft_fixture test helper]))
AM_CONDITIONAL(FIXTURE_ENABLED, test "x$enable_fixture" != "xno")
# The example program is optional.
AC_ARG_ENABLE(example, AS_HELP_STRING([--enable-example[=ARG]], [build the example program [default=no]]))
AS_IF([test "x$enable_example" = "xyes" -a "x$have_uv" = "xno"], [AC_MSG_ERROR([example program requires libuv])], [])
AM_CONDITIONAL(EXAMPLE_ENABLED, test "x$enable_example" = "xyes")
# The benchmark programs are optional.
AC_ARG_ENABLE(benchmark, AS_HELP_STRING([--enable-benchmark[=ARG]], [build the benchmark programs [default=no]]))
AM_CONDITIONAL(BENCHMARK_ENABLED, test "x$enable_benchmark" = "xyes")
# Whether to enable debugging code.
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug[=ARG]], [enable debugging [default=no]]))
AM_CONDITIONAL(DEBUG_ENABLED, test "x$enable_debug" = "xyes")
# Whether to enable memory sanitizer.
AC_ARG_ENABLE(sanitize, AS_HELP_STRING([--enable-sanitize[=ARG]], [enable code sanitizers [default=no]]))
AM_CONDITIONAL(SANITIZE_ENABLED, test x"$enable_sanitize" = x"yes")
# Whether to enable code coverage.
AX_CODE_COVERAGE
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h stdio.h assert.h unistd.h linux/io_uring.h linux/aio_abi.h])
# Check if zfs >= 0.8.0 is available (for direct I/O support).
AC_CHECK_PROG(have_zfs, zfs, yes)
AS_IF([test x"$have_zfs" = x"yes"],
[AX_COMPARE_VERSION($(cat /sys/module/zfs/version | cut -f 1 -d -), [ge], [0.8.0],
[AC_DEFINE(RAFT_HAVE_ZFS_WITH_DIRECT_IO)], [])
],
[])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
# Checks for library functions and definitions.
AC_CHECK_DECLS([UV_FS_O_CREAT], [], [], [[#include ]])
# Enable large file support. This is mandatory in order to interoperate with
# libuv, which enables large file support by default, making the size of 'off_t'
# on 32-bit architecture be 8 bytes instead of the normal 4.
AC_SYS_LARGEFILE
CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
-std=c11 \
-g \
--mcet \
-fcf-protection \
--param=ssp-buffer-size=4 \
-pipe \
-fno-strict-aliasing \
-fdiagnostics-color \
-fexceptions \
-fstack-clash-protection \
-fstack-protector-strong \
-fasynchronous-unwind-tables \
-fdiagnostics-show-option \
-Wall \
-Wextra \
-Wpedantic \
-Wimplicit-fallthrough=5 \
-Wcast-align \
-Wstrict-prototypes \
-Wlogical-op \
-Wmissing-include-dirs \
-Wold-style-definition \
-Winit-self \
-Wfloat-equal \
-Wsuggest-attribute=noreturn \
-Wformat=2 \
-Wendif-labels \
-Wdate-time \
-Wnested-externs \
-Wconversion \
-Werror=implicit-function-declaration \
-Wunused-but-set-variable \
-Werror=return-type \
-Werror=incompatible-pointer-types \
-Wshadow \
-Werror=overflow \
-Werror=shift-count-overflow \
-Werror=shift-overflow=2 \
-Warray-bounds \
-Wrestrict \
-Wreturn-local-addr \
-Wstringop-overflow \
])
AC_SUBST(AM_CFLAGS)
CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[ \
-z relro \
-z now \
-fstack-protector-strong \
--param=ssp-buffer-size=4 \
])
AC_SUBST(AM_LDLAGS)
AC_CONFIG_FILES([raft.pc Makefile])
AC_OUTPUT
raft-0.11.3/docs/ 0000775 0000000 0000000 00000000000 14156145273 0013470 5 ustar 00root root 0000000 0000000 raft-0.11.3/docs/_themes/ 0000775 0000000 0000000 00000000000 14156145273 0015114 5 ustar 00root root 0000000 0000000 raft-0.11.3/docs/_themes/material/ 0000775 0000000 0000000 00000000000 14156145273 0016712 5 ustar 00root root 0000000 0000000 raft-0.11.3/docs/_themes/material/genindex.html 0000664 0000000 0000000 00000000321 14156145273 0021375 0 ustar 00root root 0000000 0000000 {#
basic/genindex.html
~~~~~~~~~~~~~~~~~~~
Template for an "all-in-one" index.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
raft-0.11.3/docs/_themes/material/layout.html 0000664 0000000 0000000 00000011540 14156145273 0021116 0 ustar 00root root 0000000 0000000
{%- macro css() %}
{%- for css in css_files %}
{%- if css|attr("filename") %}
{{ css_tag(css) }}
{%- else %}
{%- endif %}
{%- endfor %}
{%- endmacro %}
{%- macro header() %}
{%- endmacro %}
{%- macro navigation() %}