dumpsops

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dumpsops contains the shared business logic for toggling the lerd dump bridge. Implementation is restart-free: the bridge PHP file and its conf.d ini are always volume-mounted into every FPM container, and the active/inactive state is signalled by a sentinel file inside the same mount. Toggling is a single filesystem touch and applies on the next PHP request without any container or worker disruption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PassthroughResult

type PassthroughResult struct {
	Passthrough bool
	NoChange    bool
	Restarted   []string
	RestartErr  error
}

PassthroughResult describes the outcome of SetPassthrough so callers can render which FPM units were restarted to apply the change.

func SetPassthrough

func SetPassthrough(enabled bool) (PassthroughResult, error)

SetPassthrough flips the passthrough flag and rewrites the conf.d ini with the new value. PHP reads ini directives at FPM startup, so every installed FPM unit is restarted to apply the change. This is the only dumps op that ever restarts an FPM container; the Enable/Disable path stays restart-free.

type Result

type Result struct {
	Enabled  bool // post-apply state
	NoChange bool // requested state already matched; no FS changes
}

Result describes the outcome of Apply so callers can render their own user-facing message without inspecting state again.

func Apply

func Apply(enabled bool) (Result, error)

Apply flips Dumps.Enabled to the requested state. Persists the config flag, ensures the bridge assets exist on disk, and touches/removes the runtime sentinel that controls bridge behaviour. No FPM containers are restarted because the assets are always volume-mounted; the bridge reads the sentinel on each request.

Idempotent: a second call with the same value returns NoChange=true without touching the filesystem.

Ordering: the sentinel is written before the config is persisted on enable, and removed after the config is persisted on disable. That way the two state surfaces (config.yaml + sentinel) only ever disagree in the safe direction — the bridge no-ops when the config says enabled, rather than capturing when the config says disabled.

Jump to

Keyboard shortcuts

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