FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::AbController Class Reference

#include <fastmm/strategies/ab_test.hpp>

Public Types

enum class  State : std::uint8_t { Waiting , Running , Ended }
 
using ParamValue = ParamPublisher::ParamValue
 

Public Member Functions

 AbController (AbPlan plan, ParamPublisher &publisher)
 publisher's values now are the configured parameters each arm starts from; it must outlive the controller.
 
const AbPlan & plan () const noexcept
 
bool poll (Timestamp now)
 Publishes the parameters of each instrument whose arm differs at now from the one it was last put in, one update for every instrument when they all move to the same arm.
 
Timestamp next_change (Timestamp now) const noexcept
 The next time poll() has something to do after now; Timestamp::max() once ended.
 
void stop (int promote=AbPlan::kNoArm) noexcept
 Ends the test at the next poll(): every instrument leaves its arm and gets the configured parameters, or with promote the parameters of that arm.
 
State state (Timestamp now) const noexcept
 
int promoted () const noexcept
 
int arm (std::string_view name) const noexcept
 The arm's index by name, kNoArm when none has it.
 
bool owns (std::string_view param) const noexcept
 A parameter some arm names: the test sets it while it runs.
 
const std::vector< ParamValue > & values (int arm) const
 The values an arm's update carries (kNoArm: the configured ones), in name order.
 
int current (std::size_t inst) const noexcept
 The arm the instrument was last put in, kNoArm when none.
 
std::uint64_t refused () const noexcept
 Updates the publisher refused when they were published (a validate() that no longer holds for an instrument's parameters), and the last reason.
 
const std::string & last_error () const noexcept
 
std::string status (Timestamp now) const
 fastmm-ctl ab: the test on the first line, then one line per topic: its arms, the block and end, and each instrument's arm.
 

Member Typedef Documentation

◆ ParamValue

Member Enumeration Documentation

◆ State

enum class fastmm::AbController::State : std::uint8_t
strong
Enumerator
Waiting 
Running 
Ended 

Constructor & Destructor Documentation

◆ AbController()

fastmm::AbController::AbController ( AbPlan  plan,
ParamPublisher &  publisher 
)

publisher's values now are the configured parameters each arm starts from; it must outlive the controller.

Throws std::invalid_argument when an arm names a parameter the strategy does not have or a value its schema or validate() refuses, or when the plan splits the instruments and the strategy keeps one parameter set (ParamScope::Shared).

Member Function Documentation

◆ plan()

const AbPlan & fastmm::AbController::plan ( ) const
inlinenoexcept

◆ poll()

bool fastmm::AbController::poll ( Timestamp  now)

Publishes the parameters of each instrument whose arm differs at now from the one it was last put in, one update for every instrument when they all move to the same arm.

False when the sink refused one: the instruments not yet moved are moved by the next call.

◆ next_change()

Timestamp fastmm::AbController::next_change ( Timestamp  now) const
noexcept

The next time poll() has something to do after now; Timestamp::max() once ended.

◆ stop()

void fastmm::AbController::stop ( int  promote = AbPlan::kNoArm)
noexcept

Ends the test at the next poll(): every instrument leaves its arm and gets the configured parameters, or with promote the parameters of that arm.

Later polls do nothing.

◆ state()

State fastmm::AbController::state ( Timestamp  now) const
noexcept

◆ promoted()

int fastmm::AbController::promoted ( ) const
inlinenoexcept

◆ arm()

int fastmm::AbController::arm ( std::string_view  name) const
noexcept

The arm's index by name, kNoArm when none has it.

◆ owns()

bool fastmm::AbController::owns ( std::string_view  param) const
noexcept

A parameter some arm names: the test sets it while it runs.

◆ values()

const std::vector< ParamValue > & fastmm::AbController::values ( int  arm) const

The values an arm's update carries (kNoArm: the configured ones), in name order.

◆ current()

int fastmm::AbController::current ( std::size_t  inst) const
inlinenoexcept

The arm the instrument was last put in, kNoArm when none.

◆ refused()

std::uint64_t fastmm::AbController::refused ( ) const
inlinenoexcept

Updates the publisher refused when they were published (a validate() that no longer holds for an instrument's parameters), and the last reason.

◆ last_error()

const std::string & fastmm::AbController::last_error ( ) const
inlinenoexcept

◆ status()

std::string fastmm::AbController::status ( Timestamp  now) const

fastmm-ctl ab: the test on the first line, then one line per topic: its arms, the block and end, and each instrument's arm.