platform

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package platform (piece ⑮) holds process-level concerns: data directory, logging and supervision of long-running services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir returns the per-OS default data directory.

func NewLogger

func NewLogger(w io.Writer, level, format string) *slog.Logger

NewLogger returns a logger: coloured text on a terminal, JSON when format is "json". Secrets are redacted in one place.

func Run

func Run(ctx context.Context, log *slog.Logger, services ...Service) error

Run supervises services until ctx is cancelled. A failing service is restarted with backoff without stopping the others (ADR 0009).

Types

type Func

type Func struct {
	Name string
	Fn   func(ctx context.Context) error
}

Func adapts a function to a Service.

func (Func) Serve

func (f Func) Serve(ctx context.Context) error

func (Func) String

func (f Func) String() string

type Service

type Service interface {
	Serve(ctx context.Context) error
	String() string
}

Service is a long-running piece supervised with restarts.

Jump to

Keyboard shortcuts

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