baseapp

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppBuilder

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

AppBuilder is a builder for an app.

func NewAppBuilder

func NewAppBuilder(appName string, logger log.Logger) *AppBuilder

NewAppBuilder creates a new app builder.

func (*AppBuilder) AppName

func (ab *AppBuilder) AppName() string

AppName returns the name of the app.

func (*AppBuilder) BuildApp

func (ab *AppBuilder) BuildApp() *BaseApp

BuildApp builds the app.

func (*AppBuilder) RegisterDB

func (ab *AppBuilder) RegisterDB(db ethdb.KeyValueStore)

RegisterDB registers the db.

func (*AppBuilder) RegisterEthClient

func (ab *AppBuilder) RegisterEthClient(ethClient eth.Client)

RegisterEthClient registers the eth client. TODO: update this to connection pool on baseapp and context gets one for running

func (*AppBuilder) RegisterHTTPHandler

func (ab *AppBuilder) RegisterHTTPHandler(handler *server.Handler) error

RegisterHTTPHandler registers a HTTP handler.

func (*AppBuilder) RegisterHTTPServer

func (ab *AppBuilder) RegisterHTTPServer(svr *server.Server)

RegisterHTTPServer registers the http server.

func (*AppBuilder) RegisterJob

func (ab *AppBuilder) RegisterJob(job job.Basic)

AppName sets the name of the app.

func (*AppBuilder) RegisterMetrics

func (ab *AppBuilder) RegisterMetrics(cfg *telemetry.Config) error

RegisterMetrics registers the metrics.

func (*AppBuilder) RegisterMiddleware

func (ab *AppBuilder) RegisterMiddleware(m server.Middleware) error

RegisterMiddleware registers a middleware to the HTTP server.

type BaseApp

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

BaseApp is the base application.

func New

func New(
	name string,
	logger log.Logger,
	ethClient eth.Client,
	jobs []job.Basic,
	db ethdb.KeyValueStore,
	svr *server.Server,
	metrics telemetry.Metrics,
) *BaseApp

New creates a new baseapp.

func (*BaseApp) Chain added in v2.0.1

func (b *BaseApp) Chain() eth.Client

Chain returns the eth client for the baseapp.

func (*BaseApp) Logger

func (b *BaseApp) Logger() log.Logger

Logger returns the logger for the baseapp.

func (*BaseApp) Start

func (b *BaseApp) Start(ctx context.Context) error

Start starts the baseapp.

func (*BaseApp) Stop

func (b *BaseApp) Stop()

Stop stops the baseapp.

type JobManager

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

JobManager handles the job and worker lifecycle.

func NewManager

func NewManager(
	jobs []job.Basic,
	ctxFactory *contextFactory,
) *JobManager

NewManager creates a new manager.

func (*JobManager) Logger

func (jm *JobManager) Logger(ctx context.Context) log.Logger

Logger returns the logger for the baseapp.

func (*JobManager) RunProducers

func (jm *JobManager) RunProducers(gctx context.Context)

RunProducers sets up each job and runs its producer.

func (*JobManager) Start

func (jm *JobManager) Start(ctx context.Context)

Start calls `Setup` on the jobs in the registry as well as spins up the worker pools.

func (*JobManager) Stop

func (jm *JobManager) Stop()

Stop calls `Teardown` on the jobs in the registry as well as shut's down all the worker pools.

Jump to

Keyboard shortcuts

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