compile

package
v0.3.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0 modules, 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

Overview

Package compile orchestrates ephemeral microVM compile jobs. The V0.1 backend SIMULATES a compile (returns a canned PDF when language=latex, an empty binary otherwise) so the rest of the stack is testable end-to-end without a running weft-agent. V0.2 wires the gRPC client to weft-agent that spawns a real microVM from a per-language OCI image (weft-loom-texlive, weft-loom-golang, …) with the project files mounted RO + a writable scratch overlay for build artefacts.

JobSpec → Service.Start → background goroutine → Event channel → SSE stream to the frontend → final "result" event with the artifact path or compile error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Kind string `json:"kind"` // "log" | "result" | "error"
	Line string `json:"line,omitempty"`
	// For Kind=="result" :
	Success      bool   `json:"success,omitempty"`
	Artifact     string `json:"artifact,omitempty"` // URL the SPA fetches to download
	ArtifactMIME string `json:"artifact_mime,omitempty"`
	DurationMs   int64  `json:"duration_ms,omitempty"`
}

Event is one streamed line during a compile job.

type JobSpec

type JobSpec struct {
	// Project is the project name (filled by the handler from the
	// path param ; clients don't need to populate).
	Project string `json:"-"`
	// Language picks the OCI image weft-agent pulls
	// (latex/go/cpp/python/...). When empty the service detects from
	// the project's language hint.
	Language string `json:"language"`
	// Entry is the main file (e.g. "main.tex", "main.go"). Optional ;
	// per-language defaults apply.
	Entry string `json:"entry,omitempty"`
	// ExtraArgs are appended to the language's default build command.
	ExtraArgs []string `json:"extra_args,omitempty"`
}

JobSpec is the request shape POSTed to /api/projects/<n>/compile.

type Service

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

Service starts jobs + serves their event streams.

func New

func New(store project.Store) *Service

New builds the service.

func (*Service) Start

func (s *Service) Start(_ context.Context, ident auth.Identity, spec JobSpec) (string, error)

Start schedules a compile and returns the job ID immediately. The actual compile runs on a background goroutine ; Stream(id) taps into its event channel.

func (*Service) Stream

func (s *Service) Stream(_ context.Context, id string) (<-chan Event, error)

Stream returns the event channel for an in-flight or just-finished job. The caller ranges over it ; the channel closes when the job emits its terminal event. After close the job's state is reaped.

Jump to

Keyboard shortcuts

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