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

New strategy parameter values (ADR-0013): up to kMaxFields (field index, raw value) pairs, built and validated off the engine thread (strategies/param_publisher.hpp). More...

#include <fastmm/core/messages.hpp>

Public Types

enum class  Origin : std::uint8_t { Strategy = 0 , Control = 1 , Experiment = 2 , Config = 3 }
 

Public Member Functions

bool all_instruments () const noexcept
 
bool resets () const noexcept
 The update drops the instruments' own values of the parameters it names (kReset).
 
std::string_view source_view () const noexcept
 
void set_source (std::string_view s) noexcept
 Copies s into source, cut to kSourceLen - 1 bytes.
 

Public Attributes

EventHeader hdr
 
std::uint32_t count
 pairs used
 
Origin origin
 
std::uint8_t arm
 kArmKeep, kArmNone or arm + 1
 
std::uint8_t flags
 kReset
 
std::uint8_t pad0_ [1]
 
std::uint64_t publish_seq
 the publisher's sequence number, from 1
 
std::uint16_t field [kMaxFields]
 schema index of each pair
 
char source [kSourceLen]
 who asked for it, e.g. "manual", "scheduled:drain"
 
std::uint8_t pad1_ [8]
 
std::int64_t value [kMaxFields]
 raw value of each pair
 

Static Public Attributes

static constexpr std::size_t kMaxFields = 32
 
static constexpr std::size_t kSourceLen = 40
 source, NUL-terminated
 
static constexpr std::uint8_t kArmKeep = 0
 
static constexpr std::uint8_t kArmNone = 0xFF
 
static constexpr InstrumentId kAllInstruments {}
 hdr.instrument of an update for every instrument: the invalid id.
 
static constexpr std::uint8_t kReset = 1U << 0
 flags.
 

Detailed Description

New strategy parameter values (ADR-0013): up to kMaxFields (field index, raw value) pairs, built and validated off the engine thread (strategies/param_publisher.hpp).

The engine applies them together at one event, journals the message and calls on_params. A field index is the position of the parameter in the strategy's schema; the journal header records the schema, so a replay resolves indices by name. A raw value is the field's int64 form (ParamDesc::get_raw): the value of an integer or bool, the raw fixed-point value of Price, Qty, Notional and Ratio, the nanoseconds of a Duration and the IEEE-754 bits of a double. origin names the publisher (the control socket's sequence is the one fastmm-ctl waits on) and source who asked for the change (fastmm-ctl param --source), both zero in journals written before they existed. arm moves the update's instruments into an arm of the [ab] test (strategies/ab_test.hpp): kArmKeep leaves them where they are, kArmNone takes them out of the test, k + 1 puts them in arm k.

Member Enumeration Documentation

◆ Origin

enum class fastmm::ParamUpdateMsg::Origin : std::uint8_t
strong
Enumerator
Strategy 

the strategy's own publisher (a slow tier, a model), or not recorded

Control 

the control socket (fastmm-ctl param)

Experiment 

the [ab] test: an arm's parameters at a block boundary, a stop, a promote

Config 

[strategy.overrides], at the start of the session

Member Function Documentation

◆ all_instruments()

bool fastmm::ParamUpdateMsg::all_instruments ( ) const
inlinenoexcept

◆ resets()

bool fastmm::ParamUpdateMsg::resets ( ) const
inlinenoexcept

The update drops the instruments' own values of the parameters it names (kReset).

◆ source_view()

std::string_view fastmm::ParamUpdateMsg::source_view ( ) const
inlinenoexcept

◆ set_source()

void fastmm::ParamUpdateMsg::set_source ( std::string_view  s)
inlinenoexcept

Copies s into source, cut to kSourceLen - 1 bytes.

Member Data Documentation

◆ kMaxFields

constexpr std::size_t fastmm::ParamUpdateMsg::kMaxFields = 32
staticconstexpr

◆ kSourceLen

constexpr std::size_t fastmm::ParamUpdateMsg::kSourceLen = 40
staticconstexpr

source, NUL-terminated

◆ kArmKeep

constexpr std::uint8_t fastmm::ParamUpdateMsg::kArmKeep = 0
staticconstexpr

◆ kArmNone

constexpr std::uint8_t fastmm::ParamUpdateMsg::kArmNone = 0xFF
staticconstexpr

◆ kAllInstruments

constexpr InstrumentId fastmm::ParamUpdateMsg::kAllInstruments {}
staticconstexpr

hdr.instrument of an update for every instrument: the invalid id.

◆ kReset

constexpr std::uint8_t fastmm::ParamUpdateMsg::kReset = 1U << 0
staticconstexpr

flags.

kReset: the named parameters stop being the instrument's own and take the shared value again, which value carries; for every instrument, each instrument's own value of them is dropped. An update for every instrument with an arm is a reset as well.

◆ hdr

EventHeader fastmm::ParamUpdateMsg::hdr

◆ count

std::uint32_t fastmm::ParamUpdateMsg::count

pairs used

◆ origin

Origin fastmm::ParamUpdateMsg::origin

◆ arm

std::uint8_t fastmm::ParamUpdateMsg::arm

kArmKeep, kArmNone or arm + 1

◆ flags

std::uint8_t fastmm::ParamUpdateMsg::flags

kReset

◆ pad0_

std::uint8_t fastmm::ParamUpdateMsg::pad0_[1]

◆ publish_seq

std::uint64_t fastmm::ParamUpdateMsg::publish_seq

the publisher's sequence number, from 1

◆ field

std::uint16_t fastmm::ParamUpdateMsg::field[kMaxFields]

schema index of each pair

◆ source

char fastmm::ParamUpdateMsg::source[kSourceLen]

who asked for it, e.g. "manual", "scheduled:drain"

◆ pad1_

std::uint8_t fastmm::ParamUpdateMsg::pad1_[8]

◆ value

std::int64_t fastmm::ParamUpdateMsg::value[kMaxFields]

raw value of each pair