app

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log passLogger
View Source
var Prefix = "slrp"

Prefix is the env var prefix

Functions

func MockCtx

func MockCtx() *mockCtx

func MockStart

func MockStart(s Service) func()

func MountSpaUI

func MountSpaUI(fs fs.FS) func(*mainServer) spaFS

func ParseDuration

func ParseDuration(dur string) (result time.Duration, err error)

maybe not the most performant duration parser, but at least it supports days and weeks

func Run

func Run(ctx context.Context, f Factories)

func Shrink

func Shrink(body string) string

Types

type Config

type Config map[string]string

func (Config) BoolOr

func (c Config) BoolOr(key string, def bool) bool

func (Config) DurOr

func (c Config) DurOr(key string, def time.Duration) time.Duration

func (Config) IntOr

func (c Config) IntOr(key string, def int) int

func (Config) StrOr

func (c Config) StrOr(key, def string) string

type Context

type Context interface {
	Ctx() context.Context

	// Propagates Done channel from parent context.
	Done() <-chan struct{}

	// Heartbeat used as signal to Fabric that marks related service for the next storage
	// flush event, in case BinaryMarshaller/BinaryUnmarshaller interfaces are implemented.
	// Second major use is as unit testing blocking hook.
	Heartbeat()
}

type Err

type Err struct {
	Err error
	// contains filtered or unexported fields
}

func ShErr

func ShErr(err error) Err

func (Err) Error

func (err Err) Error() string

type Fabric

type Fabric struct {
	State     string
	Factories Factories
	// contains filtered or unexported fields
}

func (*Fabric) Start

func (f *Fabric) Start(ctx context.Context)

func (*Fabric) Url added in v0.0.8

func (f *Fabric) Url() string

type Factories

type Factories map[string]interface{}

func (Factories) Init

func (c Factories) Init() (Singletons, []string, error)

type InternalError added in v0.0.8

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

func (InternalError) Unwrap added in v0.0.8

func (i InternalError) Unwrap() error

type MockRuntime

type MockRuntime map[string]*mockCtx

func MockStartSpin added in v0.0.4

func MockStartSpin[T any](this *T, other ...any) (*T, MockRuntime)

func (MockRuntime) Context added in v0.0.4

func (r MockRuntime) Context(main ...string) context.Context

func (MockRuntime) Stop

func (r MockRuntime) Stop()

type NotFound added in v0.0.4

type NotFound string

func (NotFound) Error added in v0.0.4

func (nf NotFound) Error() string

type Service

type Service interface {
	// TODO: Start(Context) error
	Start(Context)
}

type Singletons

type Singletons map[string]interface{}

func (Singletons) MockStart

func (s Singletons) MockStart() MockRuntime

func (Singletons) Monitor added in v0.0.4

func (s Singletons) Monitor() *monitorServers

Jump to

Keyboard shortcuts

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