servermode

package
v0.0.0-...-dff1495 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

package servermode implements a local server that the web ui can connect to for running simulation on a local compute instead of using wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ShareKey      string
	Timeout       time.Duration
	WorkerCount   int
	FlushInterval int
	Log           *slog.Logger
}

type ConfigOpt

type ConfigOpt func(cfg *Config) error

func WithDefaults

func WithDefaults() ConfigOpt

func WithShareKey

func WithShareKey(key string) ConfigOpt

func WithTimeout

func WithTimeout(dur time.Duration) ConfigOpt

type Server

type Server struct {
	Router *chi.Mux
	Config

	// track work
	sync.Mutex // lock for when we need to update results i.e. at flush or final
	// contains filtered or unexported fields
}

func New

func New(opts ...ConfigOpt) (*Server, error)

Jump to

Keyboard shortcuts

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