| Safe Haskell | None |
|---|
Puppet.Interpreter.Types
- type PuppetTypeName = String
- type PuppetTypeValidate = RResource -> Either String RResource
- data PuppetTypeMethods = PuppetTypeMethods {}
- type Catalog = [CResource]
- type Facts = Map String ResolvedValue
- data LinkType
- = RNotify
- | RRequire
- | RBefore
- | RSubscribe
- type LinkInfo = (LinkType, RelUpdateType, SourcePos)
- data ResolvedValue
- = ResolvedString !String
- | ResolvedRegexp !String
- | ResolvedInt !Integer
- | ResolvedDouble !Double
- | ResolvedBool !Bool
- | ResolvedRReference !String !ResolvedValue
- | ResolvedArray ![ResolvedValue]
- | ResolvedHash ![(String, ResolvedValue)]
- | ResolvedUndefined
- type GeneralValue = Either Expression ResolvedValue
- type GeneralString = Either Expression String
- data CResource = CResource {
- crid :: !Int
- crname :: !GeneralString
- crtype :: !String
- crparams :: !(Map GeneralString GeneralValue)
- crvirtuality :: !Virtuality
- pos :: !SourcePos
- type ResIdentifier = (String, String)
- type Relation = (LinkType, ResIdentifier)
- data RResource = RResource {}
- type FinalCatalog = Map ResIdentifier RResource
- type ScopeName = String
- data RelUpdateType
- data ResDefaults
- data ScopeState = ScopeState {
- curScope :: ![[ScopeName]]
- curVariables :: !(Map String (GeneralValue, SourcePos))
- curClasses :: !(Map String SourcePos)
- curDefaults :: !(Map [ScopeName] [ResDefaults])
- curResId :: !Int
- curPos :: !SourcePos
- nestedtoplevels :: !(Map (TopLevelType, String) Statement)
- getStatementsFunction :: TopLevelType -> String -> IO (Either String Statement)
- getWarnings :: ![String]
- curCollect :: ![(CResource -> CatalogMonad Bool, Map GeneralString GeneralValue, Maybe Query)]
- unresolvedRels :: ![([(LinkType, GeneralValue, GeneralValue)], (String, GeneralString), RelUpdateType, SourcePos)]
- computeTemplateFunction :: String -> String -> Map String GeneralValue -> IO (Either String String)
- puppetDBFunction :: Maybe (String -> Query -> IO (Either String [CResource]))
- luaState :: Maybe LuaState
- userFunctions :: !(Set String)
- nativeTypes :: !(Map PuppetTypeName PuppetTypeMethods)
- definedResources :: !(Map ResIdentifier SourcePos)
- currentDependencyStack :: [ResIdentifier]
- type CatalogMonad = ErrorT String (StateT ScopeState IO)
- type EdgeMap = Map (ResIdentifier, ResIdentifier) LinkInfo
- generalizeValueE :: Expression -> GeneralValue
- generalizeValueR :: ResolvedValue -> GeneralValue
- generalizeStringE :: Expression -> GeneralString
- generalizeStringS :: String -> GeneralString
- metaparameters :: Set [Char]
- getPos :: ErrorT [Char] (StateT ScopeState IO) SourcePos
- modifyScope :: ([[ScopeName]] -> [[ScopeName]]) -> ScopeState -> ScopeState
- modifyDeps :: ([ResIdentifier] -> [ResIdentifier]) -> ScopeState -> ScopeState
- modifyVariables :: (Map String (GeneralValue, SourcePos) -> Map String (GeneralValue, SourcePos)) -> ScopeState -> ScopeState
- modifyClasses :: (Map String SourcePos -> Map String SourcePos) -> ScopeState -> ScopeState
- incrementResId :: ScopeState -> ScopeState
- setStatePos :: SourcePos -> ScopeState -> ScopeState
- pushWarning :: String -> ScopeState -> ScopeState
- pushCollect :: (CResource -> CatalogMonad Bool, Map GeneralString GeneralValue, Maybe Query) -> ScopeState -> ScopeState
- pushUnresRel :: ([(LinkType, GeneralValue, GeneralValue)], (String, GeneralString), RelUpdateType, SourcePos) -> ScopeState -> ScopeState
- addDefinedResource :: MonadState ScopeState m => ResIdentifier -> SourcePos -> m ()
- saveVariables :: MonadState ScopeState m => Map String (GeneralValue, SourcePos) -> m ()
- throwPosError :: String -> CatalogMonad a
Documentation
type PuppetTypeName = String
Types for the native type system.
type PuppetTypeValidate = RResource -> Either String RResource
This is a function type than can be bound. It is the type of all subsequent validators.
data PuppetTypeMethods
Constructors
| PuppetTypeMethods | |
Fields | |
type Facts = Map String ResolvedValue
type LinkInfo = (LinkType, RelUpdateType, SourcePos)
data ResolvedValue
The list of resolved values that are used to define everything in a
FinalCatalog and in the resolved parts of a Catalog. They are to be
compared with the Values.
type GeneralValue = Either Expression ResolvedValue
This type holds a value that is either from the ASL or fully resolved.
type GeneralString = Either Expression String
This type holds a value that is either from the ASL or a fully resolved String.
data CResource
This describes the resources before the final resolution. This is required
as they must somehow be collected while the Statements are interpreted, but
the necessary Expressions are not yet available. This is because in Puppet the
Statement order should not alter the catalog's content.
The relations are not stored here, as they are pushed into a separate internal data structure by the interpreter.
Constructors
| CResource | |
Fields
| |
type ResIdentifier = (String, String)
Resource identifier, made of a type, name pair.
type Relation = (LinkType, ResIdentifier)
Resource relation, made of a LinkType, ResIdentifier pair.
data RResource
This is a fully resolved resource that will be used in the FinalCatalog.
Constructors
| RResource | |
type FinalCatalog = Map ResIdentifier RResource
data RelUpdateType
Type of update/override, so they can be applied in the correct order. This part is probably not behaving like vanilla puppet, as it turns out this are many fairly acceptable behaviours and the correct one is not documented.
Instances
data ResDefaults
A data type to hold defaults values
Constructors
| RDefaults String (Map GeneralString GeneralValue) SourcePos | |
| ROverride String GeneralString (Map GeneralString GeneralValue) SourcePos |
Instances
data ScopeState
The most important data structure for the interpreter. It stores its internal state.
Constructors
| ScopeState | |
Fields
| |
type CatalogMonad = ErrorT String (StateT ScopeState IO)
The monad all the interpreter lives in. It is ErrorT with a state.
type EdgeMap = Map (ResIdentifier, ResIdentifier) LinkInfo
This is the map of all edges associated with the FinalCatalog.
The key is (source, target).
metaparameters :: Set [Char]
This is the set of meta parameters
modifyScope :: ([[ScopeName]] -> [[ScopeName]]) -> ScopeState -> ScopeState
modifyDeps :: ([ResIdentifier] -> [ResIdentifier]) -> ScopeState -> ScopeState
modifyVariables :: (Map String (GeneralValue, SourcePos) -> Map String (GeneralValue, SourcePos)) -> ScopeState -> ScopeState
modifyClasses :: (Map String SourcePos -> Map String SourcePos) -> ScopeState -> ScopeState
setStatePos :: SourcePos -> ScopeState -> ScopeState
pushWarning :: String -> ScopeState -> ScopeState
pushCollect :: (CResource -> CatalogMonad Bool, Map GeneralString GeneralValue, Maybe Query) -> ScopeState -> ScopeState
pushUnresRel :: ([(LinkType, GeneralValue, GeneralValue)], (String, GeneralString), RelUpdateType, SourcePos) -> ScopeState -> ScopeState
addDefinedResource :: MonadState ScopeState m => ResIdentifier -> SourcePos -> m ()
saveVariables :: MonadState ScopeState m => Map String (GeneralValue, SourcePos) -> m ()
throwPosError :: String -> CatalogMonad a