Documentation
¶
Index ¶
- func WithBuiltinFunc(name string, b runner.BuiltinFunction) func(*Container)
- func WithOperatorLogger(l *slog.Logger) func(*Container)
- func WithStepFunc(name string, spec *proto.Spec, function runner.StepFunc) func(*Container)deprecated
- type Container
- func (c *Container) CacheDir() (string, error)
- func (c *Container) CachedImageStore(store oci.ImageStore) *oci.CachedImageStore
- func (c *Container) GitFetcher() (*git.GitFetcher, error)
- func (c *Container) OCIClient() *oci.Client
- func (c *Container) RemoteImageStore() *oci.RemoteImageStore
- func (c *Container) ResourceParser() (*resource.Parser, error)
- func (c *Container) StepFuncFinder() (runner.StepFuncFinder, error)
- func (c *Container) StepParser() (*function.Parser, error)
- func (c *Container) StepRunnerService() (*service.StepRunnerService, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBuiltinFunc ¶ added in v0.39.0
func WithBuiltinFunc(name string, b runner.BuiltinFunction) func(*Container)
WithBuiltinFunc registers a builtin step function under the given name.
func WithOperatorLogger ¶ added in v0.39.0
WithOperatorLogger sets the operator-facing logger, threaded through to the service and its jobs. Defaults to slog.Default(). Embedders can redirect or silence it so it does not leak into job output.
func WithStepFunc
deprecated
added in
v0.17.0
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container provides Dependency Injection (DI) for the step-runner.
DI is where an object's dependencies are passed to it, rather than being created internally. Promotes loose coupling, testability, and maintainability. Ideally, constructors are called only in two places: DI, and test builders. This makes it easy to change the constructor function signature.
For example, creating dependencies within an object:
- OCIFetcher depends on `internal.NewClient` and `cache.New` - Changing `internal.NewClient` or `cache.New` function signatures forces a change in OCIFetcher
func NewOCIFetcher() *OCIFetcher {
return &OCIFetcher{
client: internal.NewClient(cache.New()),
}
}
Creating dependencies using DI:
- OCIFetcher only depends on internal.Client (even better, an interface of Client) - Changing NewClient or cache.New requires no change in OCIFetcher - Requires DI Container.OCIFetcher()
func NewOCIFetcher(client *internal.Client) *OCIFetcher {
return &OCIFetcher{ client: client }
}
func NewContainer ¶
func (*Container) CachedImageStore ¶ added in v0.26.0
func (c *Container) CachedImageStore(store oci.ImageStore) *oci.CachedImageStore
func (*Container) GitFetcher ¶
func (c *Container) GitFetcher() (*git.GitFetcher, error)
func (*Container) RemoteImageStore ¶ added in v0.26.0
func (c *Container) RemoteImageStore() *oci.RemoteImageStore
func (*Container) ResourceParser ¶ added in v0.35.0
func (*Container) StepFuncFinder ¶ added in v0.17.0
func (c *Container) StepFuncFinder() (runner.StepFuncFinder, error)
func (*Container) StepRunnerService ¶
func (c *Container) StepRunnerService() (*service.StepRunnerService, error)