app

package
v0.0.0-...-251e415 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Overview

Package app provides self-contained application business logic and signal handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args ...string) error

Run starts the application and listens for OS signals to gracefully shutdown.

Types

type CachedStore

type CachedStore interface {
	CachedStats(model.StatsRange) model.CombinedStats
}

type CombinedStore

type CombinedStore struct {
	Store
	CachedStore
}

type Config

type Config struct {
	ServerListenAddr string        `envconfig:"SERVER_LISTEN_ADDR" default:"127.0.0.1:8383"`
	DSN              string        `envconfig:"DSN" default:"postgres://gevulot:gevulot@localhost:5432/gevulot"`
	MockStore        bool          `envconfig:"MOCK_STORE" default:"false"`
	StatsTTL         time.Duration `envconfig:"STATS_TTL" default:"5s"`
	SseRetryTimeout  time.Duration `envconfig:"SSE_RETRY_TIMEOUT" default:"10ms"`
	LogLevel         slog.Level    `envconfig:"LOG_LEVEL" default:"info"`
}

func ParseConfig

func ParseConfig(args ...string) (Config, error)

type Runnable

type Runnable interface {
	Run() error
	Stop() error
}

type Runner

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

func NewRunner

func NewRunner(runnables ...Runnable) *Runner

func (*Runner) Run

func (r *Runner) Run() error

func (*Runner) Stop

func (r *Runner) Stop()

Stop stops all runnables. Usually this method is called only in tests.

type Store

type Store interface {
	Search(filter string) ([]model.Event, error)
	Stats(model.StatsRange) (model.CombinedStats, error)
	Events() <-chan model.Event
	TxInfo(id string) (model.TxInfo, error)
	LatestDailyStats() (model.Stats, error)
	AggregateStats(time.Time) error
	Runnable
}

Jump to

Keyboard shortcuts

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