Runtime configuration settings framework.

Types

Name

Description

CommandLineParser

Parses command line arguments into folly::settings.

FrozenSettingProjects

An immutable snapshot of the set of frozen setting projects.

ISettingsAccessorProxy

Interface for applying string‐based setting changes to a snapshot.

SettingMetadata

Static information about the setting definition

SettingValueAndMetadata

Type containing the string representation of a setting as well as the static metadata associated with it. Used as the "source" in setting conversion.

SettingsAccessorProxy

This class is a proxy for working with folly::settings represented as strings. It can apply changes to these folly::settings via snapshot provided by user. Changes are not going to be published by this class, it is callers resposibility to commit/publish cahnges from snapshot into global state.

Snapshot

Captures the current state of all setting values and allows updating multiple settings at once, with verification and rollback.

Type Aliases

Name

Description

SetResult

Result of a setting update operation: Unit on success or a SetErrorCode.

Enums

Name

Description

ArgParsingResult

Outcome of parsing command line arguments.

CommandLine

Indicates whether a setting accepts overrides from the command line.

Mutability

Indicates whether a setting can change after initialization.

SetErrorCode

Error codes for a failed setting update.

Functions

Name

Description

convertTo

Like parseTo in folly/Conv.h, but the "source" is SettingValueAndMetadata instead of a StringPiece. Defaults to folly::tryTo<T>(StringPiece) but can be overridden using ADL for user defined types.

freezeImmutables

Freezes immutable settings ‐ preventing subsequent mutation attempts. It's up to the caller to call this function after settings have been initialized.

frozenSettingProjects

Returns a snapshot of the current set of frozen setting projects.

getAllSettingsMeta

Returns the metadata for all registered settings in the process.

getDefaultValue

Returns the default value of a setting by name, if it exists and has type T.

getObserver

Gets a folly::observer::Observer<T> for a given setting. For example: folly::settings::getObserver(FOLLY_SETTING(project, retention))

getSettingsMeta

Returns the metadata for a setting by name, if it exists.

immutablesFrozen

Reports whether immutable settings for a project have been frozen.

parseCommandLineArguments

Main function to parse arguments folly::settings. This function parses command line arguments into folly::settings. It moves all positional, ‐‐help, not recognized flags and their values to the end of the argv array. It stops parsing arguments after '‐‐' is encoutered.

printHelpIfNeeded

Outputs help message into stderr. May terminate program if error was encoutered during arguments parsing or exit is requested by caller.

to

Converts a setting value and metadata to type T, throwing on error.

toString

Returns the string representation of a set error code.

tryTo

Conversion functions for converting a SettingValueAndMetadata to a setting type T. Implementation is similar to folly/Conv and allows for customization using the convertTo function above.

Variables

Name

Description

kHelpFlag

Name of the command line flag that requests the help message.

Created with MrDocs