StripeKit 0.1.1
Stripe integration toolkit for C++
Loading...
Searching...
No Matches
stripekit::drogon::EventLoopOptions Struct Reference

Chooses which event loop outbound Stripe requests run on. More...

#include <Drogon.h>

Public Types

enum class  Mode { Own , DrogonFramework , External }
 Which loop to use. More...

Static Public Member Functions

static EventLoopOptions own ()
 Runs requests on a loop StripeKit starts and owns.
static EventLoopOptions drogon_framework ()
 Runs requests on the loop of the running Drogon application.
static EventLoopOptions external (trantor::EventLoop &loop)
 Runs requests on a loop the application already owns.

Public Attributes

Mode mode = Mode::Own
 Which loop to use.
trantor::EventLoop * loop = nullptr
 The loop to use when mode is Mode::External.

Detailed Description

Chooses which event loop outbound Stripe requests run on.

Use drogon_framework() inside a Drogon server so StripeKit shares the loop the application is already running, rather than starting a second one that competes with it. The default, own(), suits command-line tools and tests where there is no Drogon server.

Definition at line 44 of file Drogon.h.

Member Enumeration Documentation

◆ Mode

Which loop to use.

Enumerator
Own 

StripeKit starts and owns a loop thread.

DrogonFramework 

Use the loop of the running Drogon application.

External 

Use a loop the application already owns.

Definition at line 46 of file Drogon.h.

Member Function Documentation

◆ own()

EventLoopOptions stripekit::drogon::EventLoopOptions::own ( )
static

Runs requests on a loop StripeKit starts and owns.

Returns
Options selecting Mode::Own.

◆ drogon_framework()

EventLoopOptions stripekit::drogon::EventLoopOptions::drogon_framework ( )
static

Runs requests on the loop of the running Drogon application.

Requires Drogon to be running; use this from inside a Drogon server.

Returns
Options selecting Mode::DrogonFramework.

◆ external()

EventLoopOptions stripekit::drogon::EventLoopOptions::external ( trantor::EventLoop & loop)
static

Runs requests on a loop the application already owns.

Parameters
loopThe loop to use. It must outlive the HTTP client.
Returns
Options selecting Mode::External.

Member Data Documentation

◆ mode

Mode stripekit::drogon::EventLoopOptions::mode = Mode::Own

Which loop to use.

Definition at line 77 of file Drogon.h.

◆ loop

trantor::EventLoop* stripekit::drogon::EventLoopOptions::loop = nullptr

The loop to use when mode is Mode::External.

Ignored otherwise.

Definition at line 80 of file Drogon.h.


The documentation for this struct was generated from the following file:
  • src/adapters/drogon/include/StripeKit/Adapters/Drogon.h