Documentation
¶
Overview ¶
Package shims is the single owner of the client-tool host shims that lerd services expose (mysqldump, pg_dump, psql…): the tri-state install decisions, host-conflict detection, script generation, and the reconcile that brings the shim dir in line with the installed services.
Scope is deliberately just these service client tools. The php/composer/node shims are a different category (always-on or a single global toggle, exec on the host or into the FPM container) and stay owned by the installer's addShellShims and the shim_sync mirror; they are intentionally not managed here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Reconcile ¶
Reconcile brings the host shim dir in line with the tools the installed services expose and the recorded decisions. prompt resolves a host-conflict on first sight; pass nil on non-interactive paths (a removal, an update reconcile) to leave conflicts undecided. Shims for tools no longer exposed by any installed service are pruned.
func Set ¶
Set is the single entry point for an explicit shim decision, shared by the CLI (`lerd shims add/remove`) and the web UI toggle. It validates that an installed service actually exposes the tool, records the decision, and reconciles so the change takes effect at once. It never prompts.
Types ¶
type Info ¶
type Info struct {
Tool string `json:"tool"`
Service string `json:"service,omitempty"`
Owner string `json:"owner,omitempty"`
HostHas bool `json:"host_has"`
Enabled bool `json:"enabled"`
Decided bool `json:"decided"`
}
Info is the per-tool shim state the CLI and web UI render: which service backs it, whether the host already has the tool (so callers can warn before shadowing it), whether a decision has been recorded, and whether it's on. Owner is the service that actually backs the shim when several same-family services expose the same tool; a service whose name differs from Owner does not manage the shim and its toggle is shown disabled.
func List ¶
func List() []Info
List returns every exposed client tool with its state, sorted by tool name, for the `lerd shims` listing.
func ServiceShims ¶
ServiceShims returns the client-tool shim state for one installed service, one entry per tool it declares. Owner is filled from the global targets so a service that only shares a same-family tool (not its owner) is marked. Empty when the service exposes none.
type Prompter ¶
Prompter resolves a host-conflict when the host already has a tool. It returns whether to enable the shim and whether a decision was actually made. A nil Prompter leaves the conflict undecided so a later interactive run or the web UI can resolve it.
type Target ¶
Target records which service container a tool shim execs into and the candidate binaries to resolve there (mariadb images ship mariadb-dump in place of mysqldump, so the shim tries each in order).
func ResolveTarget ¶
ResolveTarget picks the container and binaries to run a tool in. When prefer names an installed service that exposes the tool, it wins (site-aware routing: a dump run from a project targets that project's own database service). Otherwise it falls back to the global owner. The bool is false only when no installed service exposes the tool at all.