Elle - The Elle coroutine-based asynchronous C++ development framework.

Overview

Elle, the coroutine-based asynchronous C++ development framework

Logo - Elle

Elle is a collection of libraries, written in modern C++ (C++14). It contains a rich set of highly reusable concepts, algorithms, API wrappers, ...

Elle is split into different specialized sub-libraries to provide elegant ways to approach asynchronism (using coroutines), networking, formatting, serialization, logging, RPCs, etc.

Notes:

  • Elle is under development, used and maintained by Infinit as a core library. APIs, structures and concepts may change over time. You can use it as is but we don't guarantee any API backward compatibility.
  • Elle has a sub-library also called elle, which might change name in a near future.

Example

Here is an example showing an asynchronous HTTP operation in a natural form (no callbacks) and basic JSON serialization.

// Initialize the HTTP Request.
elle::reactor::http::Request r("https://en.wikipedia.org/w/api.php",
                               elle::reactor::http::Method::GET);
r.query_string({
  {"format", "json"},
  {"action", "query"},
  {"prop", "extracts"},
  {"explaintext", ""},
  {"exintro", ""},
  {"titles", "JSON"}
});
// Perform the HTTP request and yield until response is available.
r.finalize();
// Deserialize the json response.
std::cout << elle::json::pretty_print(elle::json::read(r)) << std::endl;

Getting Elle

To download the source code and build Elle by yourself, get it from GitHub.

git clone https://github.com/infinit/elle --recursive # Clone elle and its submodules.

Note: If you cloned it using the GitHub "clone" button, do not forget to run git submodule update --init --recursive!

Note: If you forked Elle, you'll also need to fork the following repositories too: drake, dokan, libutp, miniupnp. The reason why is detailed on following GitHub issue.

Structure

As mentioned earlier, Elle is composed of a set of sub-libraries, designed to ease C++ development through robust and flexible implementations, including:

  • elle: Utilities including serialization, logs, buffer, formatting, ...
  • reactor: An asynchronous framework using a coroutines scheduler
  • cryptography: Object-oriented cryptography wrapper around OpenSSL
  • protocol: Network communication designed to support RPCs
  • das: Symbol-based introspection
  • athena: Byzantine environment algorithms (Paxos)
  • service/aws: reactorified AWS API wrapper
  • service/dropbox: reactorified Dropbox API wrapper
  • nbd: A Network Block Device implementation.

How to build Elle (or parts of Elle)

Requirements

Build system

Elle uses Drake and has it as a submodule.

How to compile

For a detailed procedure, visit our wiki: How to build.

First you need to install drakes requirements.

sudo pip3 install -r elle/drake/requirements.txt # Install Drake dependencies.

Note: If you don't want Drake dependencies to be installed system-wide, you should consider using virtualenv.

Change directory to elle/_build/<architecture> where you can find a generic Drake configuration script.

GNU/Linux

cd elle/_build/linux64
./drake //build -j 2 # Build all libraries using 2 jobs.

macOS

cd elle/_build/osx
./drake //build -j 2 # Build all libraries using 2 jobs.

Because Elle was designed to be modular, you can build specific parts of Elle by running ./drake //<module>/build:

./drake //src/elle/cryptography/build -j 2 # To build libcryptography and its dependencies.
./drake //src/elle/reactor/build -j 2 # To build the libreactor and its dependencies.
./drake //src/elle/protocol/build -j 2 # To build the libprotocol and its dependencies.
./drake //...

It will result on <module>/lib/libelle_<module>.so and its dependencies on GNU/Linux, <module>/lib/lib<module>.dylib on macOS, ...

Dependencies

Elle depends on a few libraries which are automatically downloaded and built for your system by Drake if needed.

List of projects using Elle

Wiki

Consult Elle's wiki for more information about Elle.

Maintainers

Issues
  • May be There Exists a DoS Attack Opportunity

    May be There Exists a DoS Attack Opportunity

    I do not know anything about the internals of the elle library, but at echo_server.cc, line 61 there is the following code:

    while (true)
        {
        // Yield until reading "<...>\n".
        elle::Buffer line = socket->read_until("\n");
        // Write the line we just get (this yields too).
        socket->write(line);
        }
    

    Depending on the implementation and possible limits set somewhere in the implementation of the elle library, the line

        elle::Buffer line = socket->read_until("\n");
    

    might allow an attack, where the input stream contains about 1TB worth of characters without containing a single line break. That might exhaust the RAM of the computer or just crash the application, if the limits are met. If the read_until(...) is part of the infinit, then may be in some corner case it might also crash the infinit server.

    opened by martinvahi 4
  • Submodules

    Submodules

    In the .gitmodules file, the path for the drake dependency is ../drake. Shouldn't it be the path towards your drake's fork repository on github?

    Same for miniupnp, libutp and dokan.

    opened by Tauril 3
  • Readme: typo

    Readme: typo

    The command indicated to get the submodules dependencies is: git submodules update --init --recursive instead of git submodule update --init --recursive

    opened by Tauril 2
  • failed to build with gcc 7.3.0

    failed to build with gcc 7.3.0

    Unable to build with fresh version of g++ compiler:

    g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-11ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.3.0 (Ubuntu 7.3.0-11ubuntu1)

    errors look like: In file included from ../../src/elle/reactor/Channel.hh:163:0, from ../../src/elle/reactor/Generator.hh:5, from ../../src/elle/reactor/Generator.cc:1: ../../src/elle/reactor/Channel.hxx: In member function ‘const T& elle::reactor::Channel<T, Container>::peek() const’: ../../src/elle/reactor/Channel.hxx:193:42: error: no matching function for call to ‘wait(const elle::reactor::Barrier&)’ reactor::wait(this->_read_barrier); ^ In file included from ../../src/elle/reactor/Channel.hxx:3:0, from ../../src/elle/reactor/Channel.hh:163, from ../../src/elle/reactor/Generator.hh:5, from ../../src/elle/reactor/Generator.cc:1: ../../src/elle/reactor/scheduler.hh:332:5: note: candidate: bool elle::reactor::wait(elle::reactor::Waitable&, elle::DurationOpt) wait(Waitable& waitable, DurationOpt timeout = {}); ^~~~ ../../src/elle/reactor/scheduler.hh:332:5: note: conversion of argument 1 would be ill-formed: ../../src/elle/reactor/scheduler.hh:335:5: note: candidate: bool elle::reactor::wait(const Waitables&, elle::DurationOpt) wait(Waitables const& waitables, DurationOpt timeout = {}); ^~~~ ../../src/elle/reactor/scheduler.hh:335:5: note: no known conversion for argument 1 from ‘const elle::reactor::Barrier’ to ‘const Waitables& {aka const std::vectorelle::reactor::Waitable*&}’ ../../src/elle/reactor/scheduler.hh:338:5: note: candidate: bool elle::reactor::wait(const std::vector<std::reference_wrapperelle::reactor::Waitable >&, elle::DurationOpt) wait(std::vector<std::reference_wrapper> const& waitables, ^~~~ ../../src/elle/reactor/scheduler.hh:338:5: note: no known conversion for argument 1 from ‘const elle::reactor::Barrier’ to ‘const std::vector<std::reference_wrapperelle::reactor::Waitable >&’ ../../src/elle/reactor/scheduler.hh:342:5: note: candidate: void elle::reactor::wait(boost::signals2::signal<void()>&) wait(boost::signals2::signal<void ()>& signal); ^~~~ ../../src/elle/reactor/scheduler.hh:342:5: note: no known conversion for argument 1 from ‘const elle::reactor::Barrier’ to ‘boost::signals2::signal<void()>&’ In file included from ../../src/elle/reactor/scheduler.hh:379:0, from ../../src/elle/reactor/Channel.hxx:3, from ../../src/elle/reactor/Channel.hh:163, from ../../src/elle/reactor/Generator.hh:5, from ../../src/elle/reactor/Generator.cc:1: ../../src/elle/reactor/scheduler.hxx:122:5: note: candidate: template<class Prototype, class ... Args> void elle::reactor::wait(boost::signals2::signal&, Args&& ...) wait(boost::signals2::signal& signal, Args&& ... args) ^~~~ ../../src/elle/reactor/scheduler.hxx:122:5: note: template argument deduction/substitution failed: In file included from ../../src/elle/reactor/Channel.hh:163:0, from ../../src/elle/reactor/Generator.hh:5, from ../../src/elle/reactor/Generator.cc:1: ../../src/elle/reactor/Channel.hxx:193:42: note: types ‘boost::signals2::signal’ and ‘const elle::reactor::Barrier’ have incompatible cv-qualifiers reactor::wait(this->_read_barrier); ^ and lots of warnings like: In file included from ../../src/elle/serialization.hh:4:0, from ../../src/elle/Exception.hh:9, from ../../src/elle/Error.hh:3, from ../../src/elle/cryptography/Error.hh:3, from ../../src/elle/cryptography/dsa/PrivateKey.cc:9: ../../src/elle/Version.hh:75:13: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. ELLE_ATTRIBUTE_R(uint8_t, minor); ^~~~~~~~~~~~~~~~~~~~~~~~~

    opened by iozy 1
  • Bump mistune from 0.8.4 to 2.0.3 in /drake

    Bump mistune from 0.8.4 to 2.0.3 in /drake

    Bumps mistune from 0.8.4 to 2.0.3.

    Release notes

    Sourced from mistune's releases.

    Version 2.0.2

    Fix escape_url via lepture/mistune#295

    Version 2.0.1

    Fix XSS for image link syntax.

    Version 2.0.0

    First release of Mistune v2.

    Version 2.0.0 RC1

    In this release, we have a Security Fix for harmful links.

    Version 2.0.0 Alpha 1

    This is the first release of v2. An alpha version for users to have a preview of the new mistune.

    Changelog

    Sourced from mistune's changelog.

    Changelog

    Here is the full history of mistune v2.

    Version 2.0.4

    
    Released on Jul 15, 2022
    
    • Fix url plugin in &lt;a&gt; tag
    • Fix * formatting

    Version 2.0.3

    Released on Jun 27, 2022

    • Fix table plugin
    • Security fix for CVE-2022-34749

    Version 2.0.2

    
    Released on Jan 14, 2022
    

    Fix escape_url

    Version 2.0.1

    Released on Dec 30, 2021

    XSS fix for image link syntax.

    Version 2.0.0

    
    Released on Dec 5, 2021
    

    This is the first non-alpha release of mistune v2.

    Version 2.0.0rc1

    Released on Feb 16, 2021

    Version 2.0.0a6

    
    </tr></table> 
    

    ... (truncated)

    Commits
    • 3f422f1 Version bump 2.0.3
    • a6d4321 Fix asteris emphasis regex CVE-2022-34749
    • 5638e46 Merge pull request #307 from jieter/patch-1
    • 0eba471 Fix typo in guide.rst
    • 61e9337 Fix table plugin
    • 76dec68 Add documentation for renderer heading when TOC enabled
    • 799cd11 Version bump 2.0.2
    • babb0cf Merge pull request #295 from dairiki/bug.escape_url
    • fc2cd53 Make mistune.util.escape_url less aggressive
    • 3e8d352 Version bump 2.0.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Various misc fixes to enable building on Mac OS again

    Various misc fixes to enable building on Mac OS again

    Also adding a venv wrapper for Drake executable scripts, that only does anything if the env var ELLE_BUILD_USE_VENV is set, and otherwise doesn't change anything.

    Also revamped the Dockerfile

    opened by wk8 0
Owner
Infinit
Infinit
A C++20 coroutine library based off asyncio

kuro A C++20 coroutine library, somewhat modelled on Python's asyncio Requirements Kuro requires a C++20 compliant compiler and a Linux OS. Tested on

null 17 Jul 19, 2022
C++20 Coroutine-Based Synchronous Parser Combinator Library

This library contains a monadic parser type and associated combinators that can be composed to create parsers using C++20 Coroutines.

null 42 Jun 10, 2022
C++14 coroutine-based task library for games

SquidTasks Squid::Tasks is a header-only C++14 coroutine-based task library for games. Full project and source code available at https://github.com/we

Tim Ambrogi Saxon 58 Jul 25, 2022
Powerful multi-threaded coroutine dispatcher and parallel execution engine

Quantum Library : A scalable C++ coroutine framework Quantum is a full-featured and powerful C++ framework build on top of the Boost coroutine library

Bloomberg 447 Jul 25, 2022
:copyright: Concurrent Programming Library (Coroutine) for C11

libconcurrent tiny asymmetric-coroutine library. Description asymmetric-coroutine bidirectional communication by yield_value/resume_value native conte

sharow 350 Aug 4, 2022
Single header asymmetric stackful cross-platform coroutine library in pure C.

minicoro Minicoro is single-file library for using asymmetric coroutines in C. The API is inspired by Lua coroutines but with C use in mind. The proje

Eduardo Bart 309 Jul 24, 2022
A golang-style C++ coroutine library and more.

CO is an elegant and efficient C++ base library that supports Linux, Windows and Mac platforms. It pursues minimalism and efficiency, and does not rely on third-party library such as boost.

Alvin 2.7k Aug 7, 2022
Async GRPC with C++20 coroutine support

agrpc Build an elegant GRPC async interface with C++20 coroutine and libunifex (target for C++23 executor). Get started mkdir build && cd build conan

Yuchao Zhang 56 Aug 8, 2022
Cppcoro - A library of C++ coroutine abstractions for the coroutines TS

CppCoro - A coroutine library for C++ The 'cppcoro' library provides a large set of general-purpose primitives for making use of the coroutines TS pro

Lewis Baker 2.4k Aug 3, 2022
Mx - C++ coroutine await, yield, channels, i/o events (single header + link to boost)

mx C++11 coroutine await, yield, channels, i/o events (single header + link to boost). This was originally part of my c++ util library kit, but I'm se

Grady O'Connell 4 Sep 21, 2019
A go-style coroutine library in C++11 and more.

cocoyaxi English | 简体中文 A go-style coroutine library in C++11 and more. 0. Introduction cocoyaxi (co for short), is an elegant and efficient cross-pla

Alvin 2.7k Aug 5, 2022
C++14 asynchronous allocation aware futures (supporting then, exception handling, coroutines and connections)

Continuable is a C++14 library that provides full support for: lazy async continuation chaining based on callbacks (then) and expression templates, ca

Denis Blank 757 Aug 5, 2022
Open MPI main development repository

Open MPI The Open MPI Project is an open source Message Passing Interface (MPI) implementation that is developed and maintained by a consortium of aca

Open MPI 1.5k Aug 9, 2022
High Performance Linux C++ Network Programming Framework based on IO Multiplexing and Thread Pool

Kingpin is a C++ network programming framework based on TCP/IP + epoll + pthread, aims to implement a library for the high concurrent servers and clie

null 16 Jul 16, 2022
Termite-jobs - Fast, multiplatform fiber based job dispatcher based on Naughty Dogs' GDC2015 talk.

NOTE This library is obsolete and may contain bugs. For maintained version checkout sx library. until I rip it from there and make a proper single-hea

Sepehr Taghdisian 35 Jan 9, 2022
Async++ concurrency framework for C++11

Async++ Async++ is a lightweight concurrency framework for C++11. The concept was inspired by the Microsoft PPL library and the N3428 C++ standard pro

Amanieu d'Antras 1.1k Aug 5, 2022
A task scheduling framework designed for the needs of game developers.

Intel Games Task Scheduler (GTS) To the documentation. Introduction GTS is a C++ task scheduling framework for multi-processor platforms. It is design

null 418 Jul 25, 2022
An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.

What is SObjectizer? What distinguishes SObjectizer? SObjectizer is not like TBB, taskflow or HPX Show me the code! HelloWorld example Ping-Pong examp

Stiffstream 293 Jul 20, 2022
Laughably simple Actor concurrency framework for C++20

Light Actor Framework Concurrency is a breeze. Also a nightmare, if you ever used synchronization techniques. Mostly a nightmare, though. This tiny li

Josip Palavra 94 Jun 21, 2022