Help us shape the future of Go! Take the 2026 Go Developer Survey

driver

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package driver is the co-hosted Background Driver: it runs INSIDE the Local Runtime process (holding the same single store-writer lock — never a second opener) and periodically drives the governed Tick, drains projection invalidations, and re-projects the host's managed definition files. It is the only place re-projection lives, so the runtime never imports hostsurface (the locked boundary).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver drives one runtime's background duties. reproject is invoked only when a Tick actually drained an invalidation (it is nil for a runtime with no host projection).

func ForHost

func ForHost(rt *runtime.Runtime, pc hostsurface.ProjectContext, interval time.Duration) *Driver

ForHost builds a Driver whose re-projection refreshes the host's managed definition files via hostsurface.ReProject (the no-clobber path). Re-projection lives here, in the driver, so the runtime never imports hostsurface.

func New

func New(rt *runtime.Runtime, reproject func(refs []contract.ResourceRef) error, interval time.Duration) *Driver

New builds a Driver over rt with an injected re-projection callback (the host-free seam used by tests). interval <= 0 defaults to one second.

func (*Driver) Run

func (d *Driver) Run(ctx context.Context) error

Run loops Tick on the interval until ctx is cancelled (clean shutdown). It returns ctx.Err() on cancellation, or the first Tick error.

func (*Driver) Tick

func (d *Driver) Tick(ctx context.Context) error

Tick runs one background cycle: advance the governed Tick, drain any projection invalidations, and — only if something was invalidated — re-project. It uses the runtime's own store (no second opener).

Jump to

Keyboard shortcuts

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