Module configuration

Source
Expand description

Shadow’s configuration and cli parsing code using serde and clap. This contains all of Shadow’s configuration options, some of which are also exposed as CLI options.

Shadow uses schemars to get the option description (its doc comment) and default value so that it can be shown in the CLI help text.

This code should be careful about validating or interpreting values. It should be focused on parsing and checking that the format is correct, and not validating the values. For example for options that take paths, this code should not verify that the path actually exists or perform any path canonicalization. That should be left to other code outside of this module. This is so that the configuration parsing does not become environment-dependent. If a configuration file parses on one system, it should parse successfully on other systems as well.

Structs§

CliOptions
ConfigFileOptions
Options contained in a configuration file.
ConfigOptions
Shadow configuration options after processing command-line and configuration file options.
EnvName
ExperimentalOptions
FileSource
GeneralOptions
HostDefaultOptions
HostName
HostOptions
NetworkOptions
ProcessOptions
Signal

Enums§

Compression
GraphOptions
GraphSource
LogLevel
NullableOption
This wrapper type allows cli options to specify “null” to overwrite a config file option with None, and is intended to be used for options where “null” is a valid option value.
ProcessArgs
ProcessFinalState
The enum variants here have an extra level of indirection to get the serde serialization that we want.
QDiscMode
RunningVal
Scheduler
StraceLoggingMode

Constants§

ONE_GBIT_SWITCH_GRAPH

Traits§

Flatten
A trait for Option-like types that can be flattened into a single Option.

Functions§

parse_string_as_args
Parses a string as a list of arguments following the shell’s parsing rules. This uses g_shell_parse_argv() for parsing.