s3-orchestrator

runtime

import "github.com/afreidah/s3-orchestrator/internal/runtime"

Package runtime is the daemon composition root. It assembles every long-lived subsystem - observability, DI, the HTTP listener, background workers, the reload coordinator - and owns the shutdown order so the CLI entry point does not.

Index

type Observability

Observability bundles the state produced by daemon-startup logging and tracing initialization. The in-memory LogBuffer is exposed so the UI log pane can subscribe to it; ShutdownTracer is called during ordered teardown.

type Observability struct {
    LogBuffer      *telemetry.LogBuffer
    ShutdownTracer func(ctx context.Context) error
}

type Options

Options carries the inputs the CLI Run passes through to runtime.

type Options struct {
    ConfigPath string
    Mode       string
    Stdout     io.Writer
}

type Runtime

Runtime is the composed daemon. Construct with New, then call Run to block until ctx is cancelled. Shutdown ordering is owned here.

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

func New

func New(opts Options, cfg *config.Config) (*Runtime, error)

New assembles the runtime. Order matters: config -> observability -> DI -> required services -> HTTP -> reload coordinator -> lifecycle manager. Each step’s failure returns immediately so the caller can surface a precise startup error.

func (*Runtime) Run

func (r *Runtime) Run(ctx context.Context) error

Run starts background services, the SIGHUP watcher, and the HTTP listener; blocks until ctx is cancelled or the HTTP listener errors; then performs ordered shutdown. The returned error is the listener’s error if it surfaced one before ctx was cancelled, otherwise nil.

Generated by gomarkdoc