engine

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDataTarget = diagnostics.Diag{{
	Severity: hcl.DiagError,
	Summary:  "Invalid data target",
	Detail:   "Target must be in the format 'document.<doc-name>.data.<plugin-name>.<block-name>' or 'data.<plugin-name>.<block-name>'",
}}

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine is the main entry point for the fabric engine. It is responsible for loading and evaluating fabric files, installing plugins, and fetching data. It is also responsible for managing the plugin resolver and runner.

func New

func New(options ...Option) *Engine

New creates a new Engine instance with the provided options.

func (*Engine) Cleanup

func (e *Engine) Cleanup() diagnostics.Diag

func (*Engine) FetchData

func (e *Engine) FetchData(ctx context.Context, target string) (_ plugin.Data, diags diagnostics.Diag)

func (*Engine) FileMap

func (e *Engine) FileMap() map[string]*hcl.File

func (*Engine) Install

func (e *Engine) Install(ctx context.Context, upgrade bool) (diags diagnostics.Diag)

func (*Engine) Lint

func (e *Engine) Lint(ctx context.Context, fullLint bool) (diags diagnostics.Diag)

func (*Engine) LoadPluginResolver

func (e *Engine) LoadPluginResolver(ctx context.Context, includeRemote bool) (diags diagnostics.Diag)

func (*Engine) LoadPluginRunner

func (e *Engine) LoadPluginRunner(ctx context.Context) (diags diagnostics.Diag)

func (*Engine) LockFile

func (e *Engine) LockFile() *resolver.LockFile

func (*Engine) ParseDir

func (e *Engine) ParseDir(ctx context.Context, sourceDir fs.FS) (diags diagnostics.Diag)

func (*Engine) PluginResolver

func (e *Engine) PluginResolver() *resolver.Resolver

func (*Engine) PluginRunner

func (e *Engine) PluginRunner() *runner.Runner

func (*Engine) PrintDiagnostics

func (e *Engine) PrintDiagnostics(output io.Writer, diags diagnostics.Diag, colorize bool)

func (*Engine) RenderAndPublishContent

func (e *Engine) RenderAndPublishContent(ctx context.Context, target string) (content plugin.Content, diags diagnostics.Diag)

func (*Engine) RenderContent

func (e *Engine) RenderContent(ctx context.Context, target string) (doc *eval.Document, content plugin.Content, data plugin.Data, diags diagnostics.Diag)

type Option

type Option func(*Options)

func WithBuiltIn

func WithBuiltIn(builtin *plugin.Schema) Option

WithBuiltIn sets the built-in plugin.

func WithCacheDir

func WithCacheDir(dir string) Option

WithCacheDir sets the cache directory. Default is ".fabric".

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets the logger. Default is a logger that discards all logs.

func WithRegistryBaseURL

func WithRegistryBaseURL(url string) Option

WithRegistryBaseURL sets the registry base URL. Default is "https://registry.blackstork.io".

func WithTracer

func WithTracer(tracer trace.Tracer) Option

WithTracer sets the tracer. Default is noop tracer.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options is a set of options for the engine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL