New creates an engine scaffold with optional configuration.
(opts ...Option)
| 25 | |
| 26 | // New creates an engine scaffold with optional configuration. |
| 27 | func New(opts ...Option) (*Engine, error) { |
| 28 | cfg, err := applyOptions(opts...) |
| 29 | if err != nil { |
| 30 | return nil, err |
| 31 | } |
| 32 | |
| 33 | runtimeStore := cfg.runtimeStore |
| 34 | if !cfg.runtimeStoreSet { |
| 35 | runtimeStore = metrix.NewRuntimeStore() |
| 36 | } |
| 37 | |
| 38 | return &Engine{ |
| 39 | state: engineState{ |
| 40 | cfg: cfg, |
| 41 | routeCache: newRouteCache(), |
| 42 | materialized: newMaterializedState(), |
| 43 | runtimeStore: runtimeStore, |
| 44 | runtimeStats: newRuntimeMetrics(runtimeStore), |
| 45 | log: cfg.log, |
| 46 | }, |
| 47 | }, nil |
| 48 | } |
| 49 | |
| 50 | // Load compiles and publishes a new immutable program revision. |
| 51 | func (e *Engine) Load(spec *charttpl.Spec, revision uint64) error { |