application

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package application coordinates the authoritative M1 transactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationUntil

func DurationUntil(deadline string, now time.Time) time.Duration

DurationUntil is for embedding supervisors; it never grants execution rights.

Types

type Config

type Config = config.Config

type HTTPObservation

type HTTPObservation struct {
	Method    string
	Status    int
	ErrorKind string
	Duration  time.Duration
}

Readiness probes are excluded from HTTP observations and counters. HTTPObservation contains only bounded labels, never request or response data. Method is a known RPC method or "unknown" (also used for non-RPC requests). ErrorKind is empty on success; Status is the HTTP response status, so a JSON-RPC failure can have Status 200 and a nonempty ErrorKind. Duration measures handling time, excluding the observer itself.

type HookEvent

type HookEvent = ports.HookEvent

type MaintenanceObservation

type MaintenanceObservation struct {
	ErrorKind string
	Duration  time.Duration
}

MaintenanceObservation describes one complete Maintain call, including the startup call. ErrorKind is empty on success and never contains error text.

type Options

type Options struct {
	Key                []byte
	Clock              func() time.Time
	Hook               func(HookEvent) error
	DisableMaintenance bool
	// Observers run synchronously after transactions release their locks. They must
	// be concurrency-safe and return promptly. Observer panics are isolated.
	ObserveHTTP        func(HTTPObservation)
	ObserveMaintenance func(MaintenanceObservation)
}

type Service

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

func Open

func Open(path string, cfg *Config, opts Options) (*Service, error)

func (*Service) AuthorityID

func (s *Service) AuthorityID() string

func (*Service) Close

func (s *Service) Close() error

func (*Service) Handler

func (s *Service) Handler() http.Handler

func (*Service) ImportConfig

func (s *Service) ImportConfig(ctx context.Context, cfg Config) error

func (*Service) Maintain

func (s *Service) Maintain(ctx context.Context) (err error)

func (*Service) Stats

func (s *Service) Stats() Stats

type Stats

type Stats struct {
	TotalRequests       uint64
	Errors              uint64
	MaintenanceRuns     uint64
	MaintenanceFailures uint64
}

Stats is a process-local cumulative snapshot. Fields are individually atomic; concurrent activity may advance between field reads. Readiness is excluded.

Jump to

Keyboard shortcuts

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