Documentation
¶
Overview ¶
Package runtime contains code suitable for deployer implementers but not MX application developers.
Index ¶
- Constants
- func CheckMXNArgs(w *protos.MXNArgs) error
- func DataDir() (string, error)
- func LogsDir() string
- func NewTempDir() (string, error)
- func OnExitSignal(fn func())
- func ParseConfig(file string, input string, sectionValidator func(string, string) error) (*protos.AppConfig, error)
- func ParseConfigSection(key, shortKey string, sections map[string]string, dst any) error
- type Bootstrap
Constants ¶
const ( // MXNArgsKey is the environment variable that holds the base64 encoded // protos.MXNArgs message for a mxn started by an envelope. For internal // use by MX infrastructure. MXNArgsKey = "MXN_ARGS" )
const Main = "github.com/sh3lk/mx/Main"
Main is the name of the main component.
Variables ¶
This section is empty.
Functions ¶
func CheckMXNArgs ¶
CheckMXNArgs checks that MXNArgs is well-formed.
func DataDir ¶
DataDir returns the default directory for MX deployer data. The returned directory is $XDG_DATA_HOME/mx, or ~/.local/share/mx if XDG_DATA_HOME is not set.
We recommend that deployers store their data in a directory within this default directory. For example, the "mx multi" deployer stores its data in "DataDir()/multi".
func LogsDir ¶
func LogsDir() string
LogsDir returns the default directory for MX logs, $DIR/tmp/mx/logs where $DIR is the default directory used for temporary files (see os.TempDir for details). We recommend that deployers store their logs in a directory within this default directory. For example, on Unix systems, the "mx multi" deployer stores its data in /tmp/mx/logs/multi.
func NewTempDir ¶
NewTempDir returns a new directory, e.g., to hold Unix domain sockets for internal communication. The new directory is not accessible by other users. Caller is responsible for cleaning up the directory when not needed.
func OnExitSignal ¶
func OnExitSignal(fn func())
OnExitSignal arranges to run fn() when a signal that might cause the process to exit is delivered.
func ParseConfig ¶
func ParseConfig(file string, input string, sectionValidator func(string, string) error) (*protos.AppConfig, error)
ParseConfig parses the specified configuration input, which should hold a set of sections in TOML format from the specified file. The section corresponding to the common MX application configuration is parsed and returned as a *AppConfig.
sectionValidator(key, val) is used to validate every section config entry.
func ParseConfigSection ¶
ParseConfigSection parses the config section for key into dst. If shortKey is not empty, either key or shortKey is accepted. If the named section is not found, returns nil without changing dst.
Types ¶
type Bootstrap ¶
Bootstrap holds configuration information used to start a process execution.
func GetBootstrap ¶
GetBootstrap returns information needed to configure process execution. For normal execution, this comes from the environment. For mxtest, it comes from a context value.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bin contains code to extract data from a MX binary.
|
Package bin contains code to extract data from a MX binary. |
|
testprogram
command
testprogram is used by bin tests.
|
testprogram is used by bin tests. |
|
Package codegen contains functions and types used by the mx_gen.go files generated by "mx generate".
|
Package codegen contains functions and types used by the mx_gen.go files generated by "mx generate". |
|
Package colors contains color-related utilities.
|
Package colors contains color-related utilities. |
|
Deployers provides useful utilities for implementing MX deployers.
|
Deployers provides useful utilities for implementing MX deployers. |
|
Package envelope implements a sidecar-like process that connects a mxn to its environment.
|
Package envelope implements a sidecar-like process that connects a mxn to its environment. |
|
Package logging contains logging related utilities.
|
Package logging contains logging related utilities. |
|
Package metrics implements MX metrics.
|
Package metrics implements MX metrics. |
|
Package perfetto provides utilities for encoding trace spans in a format that can be read by the Perfetto UI.
|
Package perfetto provides utilities for encoding trace spans in a format that can be read by the Perfetto UI. |
|
Package protomsg contains protobuf-related utilities.
|
Package protomsg contains protobuf-related utilities. |
|
Package retry contains code to perform retries with exponential backoff.
|
Package retry contains code to perform retries with exponential backoff. |
|
Package tool contains utilities for creating MX tools similar to mx-multi, mx-gke, and mx-gke-local.
|
Package tool contains utilities for creating MX tools similar to mx-multi, mx-gke, and mx-gke-local. |
|
Package perfetto contains libraries for displaying trace information in the Perfetto UI.
|
Package perfetto contains libraries for displaying trace information in the Perfetto UI. |
|
Package version contains the version of the mx module and its constituent APIs (e.g., the pipe API, the codegen API).
|
Package version contains the version of the mx module and its constituent APIs (e.g., the pipe API, the codegen API). |