app

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package app owns the production application composition and lifecycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilecoinServices

type FilecoinServices struct {
	Storage       synapse.StorageClient
	WalletQuery   synapse.WalletQuerier
	Wallet        synapse.WalletOperator
	Receipts      worker.WalletReceiptChecker
	Readiness     ReadinessProbe
	Observability observability.RefreshChecker
	// Terminator ends a replaced storage service. Epochs observes the chain so
	// the gateway can tell an accepted termination from a completed one.
	Terminator synapse.ServiceTerminator
	Epochs     synapse.ChainEpochReader
}

FilecoinServices contains the externally owned Filecoin integrations used by the application runtime.

type ReadinessProbe

type ReadinessProbe interface {
	CheckRuntime(context.Context) synapse.ReadinessResult
	CheckDraft(context.Context, synapse.ReadinessConfig) synapse.ReadinessResult
}

ReadinessProbe provides runtime and draft Filecoin readiness checks.

type Runtime

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

Runtime owns all resources assembled by NewRuntime.

func NewRuntime

func NewRuntime(ctx context.Context, opts RuntimeOptions) (_ *Runtime, err error)

NewRuntime validates dependencies and assembles the complete application.

func (*Runtime) AdminAddr

func (r *Runtime) AdminAddr() string

AdminAddr returns the actual bound admin address, including an allocated dynamic port when configured with port zero.

func (*Runtime) Close

func (r *Runtime) Close() error

Close releases a runtime that was constructed but never started. A running runtime must be stopped by cancelling the context passed to Run.

func (*Runtime) Run

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

Run serves all components and blocks until ctx is cancelled or a component fails. It may be called once.

type RuntimeOptions

type RuntimeOptions struct {
	Config           *config.Config
	Database         *bun.DB
	Settings         *admin.SettingsService
	Filecoin         FilecoinServices
	ProviderIdentity *admin.ProviderIdentityResolver
	S3Addresses      []string
	Logger           *slog.Logger
	ShutdownTimeout  time.Duration
}

RuntimeOptions configures the application composition root. Database, settings, and Filecoin services remain owned by the caller.

Jump to

Keyboard shortcuts

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