engine

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

The Engine keeps everything running.

All spawned processes are monitored by the WaitGroup. We also increment the WaitGroup counter when creating the Engine itself, so it won't terminate before receiving CreateGroup requests. The call to Stop() then decrements the initial WaitGroup counter, allowing us to wait for all the processing threads to stop cleanly.

func NewEngine

func NewEngine(registry vmine.ImageRegistry, memoryLimit int) *Engine

NewEngine creates a new Engine.

func (*Engine) CreateGroup

func (e *Engine) CreateGroup(req *vmine.CreateGroupRequest) (*vmine.Group, error)

CreateGroup creates and starts a new vm group.

func (*Engine) Stop

func (e *Engine) Stop()

Stop the Engine and all associated resources.

func (*Engine) StopGroup

func (e *Engine) StopGroup(req *vmine.StopGroupRequest) error

StopGroup terminates a running vm group. The method waits for resource teardown.

func (*Engine) Wait

func (e *Engine) Wait()

Wait until the Engine terminates.

type HTTPEngine

type HTTPEngine struct {
	*Engine
}

HTTPEngine wraps an Engine with an HTTP API. It implements the http.Handler interface.

func NewHTTPEngine

func NewHTTPEngine(e *Engine) *HTTPEngine

func (*HTTPEngine) ServeHTTP

func (h *HTTPEngine) ServeHTTP(w http.ResponseWriter, r *http.Request)

type NetworkProvider

type NetworkProvider interface {
	Build(Transaction, *vmine.Network) error
}

type RunnableTask

type RunnableTask interface {
	Run(context.Context) error
}

RunnableTask is an interface to a task that can be run, waiting until its termination.

type SetupTask

type SetupTask interface {
	Start(context.Context) error
	Stop() error
}

SetupTask interface, with separate setup / teardown steps.

type Transaction

type Transaction interface {
	Setup(SetupTask)
	Run(RunnableTask)

	// There's no rollback, as nothing happens until you call
	// Execute() anyway, and it takes care of undoing all the
	// steps that were performed up to the failure.
	Execute(context.Context) error
}

The Transaction is the abstraction we use to collect and execute setup / teardown tasks and running processes. Calls to Setup() and Run() just gather information, which is only applied on Execute().

type VMProvider

type VMProvider interface {
	Build(Transaction, *vmine.VM, *vmine.Network) error
}

Source Files

  • engine.go
  • group.go
  • http.go
  • instrumentation.go
  • metric_allocator.go
  • qemu.go
  • tx.go
  • util.go

Jump to

Keyboard shortcuts

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