package lang
import "github.com/purpleidea/mgmt/lang"
Package lang is the mcl language frontend that implements the reactive DSL that lets users model their desired state over time.
Index ¶
Constants ¶
const ( // EngineStartupStatsTimeout is the amount of time in seconds to wait // between engine startup, and loaded event before printing some // debugging stats. This is useful for finding bugs in the function // engine. Set to zero to disable. EngineStartupStatsTimeout = 60 )
Types ¶
type Data ¶
type Data struct { // UnificationStrategy is a hack to tune unification performance until // we have an overall cleaner unification algorithm in place. UnificationStrategy map[string]string }
Data is some data that is passed into the Lang struct. It is presented here as a single struct with room for multiple fields so that it can be changed or extended in the future without having to re-plumb through all the fields it contains
type Lang ¶
type Lang struct { Fs engine.Fs // connected fs where input dir or metadata exists FsURI string // Input is a string which specifies what the lang should run. It can // accept values in several different forms. If is passed a single dash // (-), then it will use `os.Stdin`. If it is passed a single .mcl file, // then it will attempt to run that. If it is passed a directory path, // then it will attempt to run from there. Instead, if it is passed the // path to a metadata file, then it will attempt to parse that and run // from that specification. If none of those match, it will attempt to // run the raw string as mcl code. Input string // Data is some additional data for the lang struct. Data *Data Hostname string Local *local.API World engine.World Prefix string Debug bool Logf func(format string, v ...interface{}) // contains filtered or unexported fields }
Lang is the main language lexer/parser object.
func (*Lang) Cleanup ¶
Cleanup cleans up and frees memory and resources after everything is done.
func (*Lang) Init ¶
Init initializes the lang struct, and starts up the initial input parsing. NOTE: The trick is that we need to get the list of funcs to watch AND start watching them, *before* we pull their values, that way we'll know if they changed from the values we wanted.
func (*Lang) Interpret ¶
Interpret runs the interpreter and returns a graph and corresponding error.
func (*Lang) Run ¶
Run kicks off the function engine. Use the context to shut it down.
func (*Lang) Stream ¶
Stream returns a channel of graph change requests or errors. These are usually sent when a func output changes.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
lang/ast | Package ast contains the structs implementing and some utility functions for interacting with the abstract syntax tree for the mcl language. |
lang/core | Package core contains core functions and other related facilities which are used in programs. |
lang/core/convert | |
lang/core/datetime | |
lang/core/deploy | |
lang/core/embedded | |
lang/core/embedded/provisioner | |
lang/core/example | |
lang/core/example/nested | |
lang/core/fmt | |
lang/core/golang | |
lang/core/iter | |
lang/core/list | |
lang/core/local | |
lang/core/map | |
lang/core/math | |
lang/core/net | |
lang/core/os | |
lang/core/regexp | |
lang/core/strings | |
lang/core/sys | |
lang/core/test | |
lang/core/util | |
lang/core/value | |
lang/core/world | |
lang/download | Package download is used for downloading language modules from git. |
lang/embedded | Package embedded embeds mcl modules into the system import namespace. |
lang/funcs | Package funcs provides a framework for functions that change over time. |
lang/funcs/dage | Package dage implements a DAG function engine. |
lang/funcs/facts | Package facts provides a framework for language values that change over time. |
lang/funcs/funcgen | |
lang/funcs/funcgen/util | Package util provides some functions to be imported by the generated file. |
lang/funcs/multi | |
lang/funcs/operators | Package operators provides a helper library to load all of the built-in operators, which are actually just functions. |
lang/funcs/ref | Package ref implements reference counting for the graph API and function engine. |
lang/funcs/simple | |
lang/funcs/structs | |
lang/funcs/txn | Package txn contains the implementation of the graph transaction system. |
lang/funcs/vars | Package vars provides a framework for language vars. |
lang/funcs/wrapped | |
lang/fuzz | |
lang/gapi | Package gapi is the Graph API implementation for the mcl language frontend. |
lang/inputs | Package inputs contains the input parsing logic for how mcl module entrypoints are handled for the language. |
lang/interfaces | Package interfaces contains the common interfaces used in the mcl language. |
lang/interpolate | Package interpolate contains the string interpolation parser and associated structs and code. |
lang/interpret | Package interpret contains the implementation of the actual interpret function that takes an AST and returns a resource graph. |
lang/parser | Package parser contains the lexer and parser for the mcl language. |
lang/types | Package types provides a framework for our mcl language values and types. |
lang/types/full | |
lang/unification | Package unification contains the code related to type unification for the mcl language. |
lang/unification/fastsolver | Package fastsolver implements very fast type unification. |
lang/unification/solvers | Package solvers is used to have a central place to import all solvers from. |
lang/unification/util | Package util contains some utility functions and algorithms which are useful for type unification. |
lang/util | Package util contains utility functions that are specific to the mcl language. |
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 22 packages
- Last checked
- 5 days ago –
Tools for package owners.