<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Engine Functionality on Porch Documentation</title><link>/docs/5_architecture_and_components/engine/functionality/</link><description>Recent content in Engine Functionality on Porch Documentation</description><generator>Hugo</generator><language>en-us</language><atom:link href="/docs/5_architecture_and_components/engine/functionality/index.xml" rel="self" type="application/rss+xml"/><item><title>Validation &amp; Business Rules</title><link>/docs/5_architecture_and_components/engine/functionality/validation-business-rules/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/engine/functionality/validation-business-rules/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine enforces validation and business rules to ensure package revisions are created and modified correctly. These rules prevent invalid operations, enforce naming constraints, and maintain referential integrity across packages and revisions.&lt;/p&gt;
&lt;h3 id="high-level-architecture"&gt;High-Level Architecture&lt;a class="td-heading-self-link" href="#high-level-architecture" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;┌─────────────────────────────────────────────────────────┐
│ Validation &amp;amp; Business Rules │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Pre-Operation │ │ Constraint │ │
│ │ Validation │ ───&amp;gt; │ Enforcement │ │
│ │ │ │ │ │
│ │ • Lifecycle │ │ • Uniqueness │ │
│ │ • Tasks │ │ • Path Overlap │ │
│ │ • Resources │ │ • Clone Rules │ │
│ └──────────────────┘ └──────────────────┘ │
│ │ │ │
│ └────────┬────────────────┘ │
│ ↓ │
│ ┌──────────────────┐ │
│ │ Optimistic │ │
│ │ Locking │ │
│ │ │ │
│ │ • Resource Ver │ │
│ │ • Conflict Det │ │
│ └──────────────────┘ │
└─────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="lifecycle-validation"&gt;Lifecycle Validation&lt;a class="td-heading-self-link" href="#lifecycle-validation" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine validates lifecycle values during package revision creation and updates:&lt;/p&gt;</description></item><item><title>Draft-Commit Workflow Orchestration</title><link>/docs/5_architecture_and_components/engine/functionality/draft-commit-orchestration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/engine/functionality/draft-commit-orchestration/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine orchestrates a draft-commit workflow for all package revision modifications. This pattern ensures atomicity - either all changes succeed and are persisted, or none are. The workflow uses mutable drafts for changes and immutable package revisions for storage.&lt;/p&gt;
&lt;h3 id="high-level-architecture"&gt;High-Level Architecture&lt;a class="td-heading-self-link" href="#high-level-architecture" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;┌─────────────────────────────────────────────────────────┐
│ Draft-Commit Workflow Orchestration │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Draft Phase │ │ Commit Phase │ │
│ │ │ ───&amp;gt; │ │ │
│ │ • Open Draft │ │ • Close Draft │ │
│ │ • Apply Changes │ │ • Persist │ │
│ │ • Validate │ │ • Immutable │ │
│ └──────────────────┘ └──────────────────┘ │
│ │ │ │
│ └────────┬────────────────┘ │
│ ↓ │
│ ┌──────────────────┐ │
│ │ Rollback │ │
│ │ Mechanism │ │
│ │ │ │
│ │• Trigger On Error│ │
│ │• Does Cleanup │ │
│ └──────────────────┘ │
└─────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="draft-commit-pattern"&gt;Draft-Commit Pattern&lt;a class="td-heading-self-link" href="#draft-commit-pattern" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine uses a two-phase workflow for all package revision modifications:&lt;/p&gt;</description></item><item><title>Lifecycle Management</title><link>/docs/5_architecture_and_components/engine/functionality/lifecycle-management/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/engine/functionality/lifecycle-management/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine enforces a strict lifecycle state machine for package revisions that governs their mutability, visibility, and progression from draft to published state. The lifecycle system ensures that package revisions follow a controlled workflow from creation through approval to deployment, with appropriate constraints at each stage.&lt;/p&gt;
&lt;h3 id="high-level-architecture"&gt;High-Level Architecture&lt;a class="td-heading-self-link" href="#high-level-architecture" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;┌─────────────────────────────────────────────────────────┐
│ Lifecycle Management System │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ State Machine │ │ Validation │ │
│ │ │ ───&amp;gt; │ &amp;amp; Enforcement │ │
│ │ • Draft │ │ │ │
│ │ • Proposed │ │ • Creation │ │
│ │ • Published │ │ • Transition │ │
│ │ • Deletion │ │ • Mutation │ │
│ └──────────────────┘ └──────────────────┘ │
│ │ │ │
│ └────────┬────────────────┘ │
│ ↓ │
│ ┌──────────────────┐ │
│ │ State-Based │ │
│ │ Constraints │ │
│ │ │ │
│ │ • Mutability │ │
│ │ • Operations │ │
│ │ • Audit Trail │ │
│ └──────────────────┘ │
└─────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="lifecycle-state-machine"&gt;Lifecycle State Machine&lt;a class="td-heading-self-link" href="#lifecycle-state-machine" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The lifecycle state machine defines four states that a package revision can be in:&lt;/p&gt;</description></item><item><title>Task Coordination</title><link>/docs/5_architecture_and_components/engine/functionality/task-coordination/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/engine/functionality/task-coordination/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine coordinates task execution by delegating to the Task Handler. Tasks represent operations that transform package content (init, clone, edit, upgrade, render). The Engine orchestrates when and how tasks are executed, while the Task Handler implements the actual transformations.&lt;/p&gt;
&lt;h3 id="high-level-architecture"&gt;High-Level Architecture&lt;a class="td-heading-self-link" href="#high-level-architecture" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;┌─────────────────────────────────────────────────────────┐
│ Task Coordination System │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Engine │ │ Task Handler │ │
│ │ Orchestration │ ───&amp;gt; │ Execution │ │
│ │ │ │ │ │
│ │ • When to Run │ │ • Init │ │
│ │ • Draft Mgmt │ │ • Clone │ │
│ │ • Error Handle │ │ • Edit │ │
│ └──────────────────┘ │ • Upgrade │ │
│ │ │ • Render │ │
│ │ └──────────────────┘ │
│ ↓ │ │
│ ┌──────────────────┐ ↓ │
│ │ Function │ ┌──────────────────┐ │
│ │ Runtime │ &amp;lt;─── │ Builtin Funcs │ │
│ │ │ │ │ │
│ │ • gRPC │ │ • set-namespace │ │
│ │ • Builtin │ │ • ensure-context│ │
│ └──────────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="task-handler-integration"&gt;Task Handler Integration&lt;a class="td-heading-self-link" href="#task-handler-integration" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine integrates with the Task Handler through three main operations:&lt;/p&gt;</description></item><item><title>Function Evaluation</title><link>/docs/5_architecture_and_components/engine/functionality/function-evaluation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/engine/functionality/function-evaluation/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Function evaluation is hosted by the Engine. porch-server runs the in-process pod evaluator and exposes it over FunctionEvaluator gRPC so the PackageRevision controller can use the same instance. The Engine chains builtin Go functions, the Function Runner executable evaluator (via gRPC &lt;code&gt;exec_path&lt;/code&gt;), and the pod evaluator. The system uses a strategy pattern where different evaluators handle function execution in different ways (pod-based, executable, or chained), all conforming to a common interface.&lt;/p&gt;</description></item><item><title>Pod Lifecycle Management</title><link>/docs/5_architecture_and_components/engine/functionality/pod-lifecycle-management/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/engine/functionality/pod-lifecycle-management/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Pod lifecycle management orchestrates the complete lifecycle of function execution pods from creation through caching, reuse, and eventual garbage collection. The system maintains a pool of ready-to-use pods for frequently executed functions while automatically cleaning up unused pods based on time-to-live policies.&lt;/p&gt;
&lt;p&gt;The architecture consists of two primary components:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pod Cache Manager&lt;/strong&gt; - Central coordinator running in a single goroutine that manages the pod cache, handles evaluation requests, processes pod readiness notifications, and performs periodic garbage collection. Uses channels for all communication to eliminate mutex synchronization.&lt;/p&gt;</description></item><item><title>Image and Registry Management</title><link>/docs/5_architecture_and_components/engine/functionality/image-registry-management/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/5_architecture_and_components/engine/functionality/image-registry-management/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="td-heading-self-link" href="#overview" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Engine pod evaluator manages container image metadata and registry authentication to optimize pod creation and support private registries. The system caches image metadata (digest and entrypoint) to avoid repeated registry calls, handles authentication for private registries using Docker config format, and supports TLS configuration for secure registry connections.&lt;/p&gt;
&lt;h3 id="high-level-architecture"&gt;High-Level Architecture&lt;a class="td-heading-self-link" href="#high-level-architecture" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;┌──────────────────────────────────────────────────────────┐
│ Image and Registry Management │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Image │ │ Registry │ │
│ │ Metadata │ ───&amp;gt; │ Authentication │ │
│ │ Caching │ │ │ │
│ │ │ │ • Default │ │
│ │ • Digest │ │ • Custom Auth │ │
│ │ • Entrypoint │ │ • TLS Config │ │
│ │ • In-Memory │ │ │ │
│ └──────────────────┘ └──────────────────┘ │
│ │ │ │
│ └────────┬────────────────┘ │
│ ↓ │
│ ┌───────────────────┐ │
│ │ Secret │ │
│ │ Management │ │
│ │ │ │
│ │ • Creation │ │
│ │ • Synchronization│ │
│ │ • Pod Injection │ │
│ └───────────────────┘ │
└──────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="image-metadata-caching"&gt;Image Metadata Caching&lt;a class="td-heading-self-link" href="#image-metadata-caching" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The pod manager caches image metadata to avoid repeated registry API calls during pod creation.&lt;/p&gt;</description></item></channel></rss>