Skip to content

v.diagserver #

v.workers links the shared syscall helpers.

fn quick_sum_digest #

fn quick_sum_digest(sum u64, size int) string

quick_sum_digest writes a token.quick_sum of a source of size bytes as a digest of the inputs a child keeps (see keep_inputs), where it stands for a SHA-256.

fn serve #

fn serve() Request

serve is a diagnostics server only on Linux, where the child answering a request can restart the compiler's worker pools. Elsewhere every run stays a one-shot compilation, with no question to answer.

struct Request #

Available on all platforms except Linux.

struct Request {
pub:
	question    string
	from_server bool
}

Request is what a child of the diagnostics server was made for; elsewhere than on Linux there is no server, and so no request.

Available on Linux only.

struct Request {
pub:
	question string
	// from_server tells a child of the server from a one-shot compilation.
	from_server bool
mut:
	questions LineReader // the next questions from the server, and its `go`
	status_fd int = -1 // where the child tells the server what it does
	inputs    Inputs // the files the check read
	buffer    []u8   // where the child reads them again
	current   bool   // they held what the check read when the child looked
	// digests are what the check read in each file, which the child reads
	// again once its first answer is out (see keep_inputs).
	digests  map[string]string
	base_kb  i64    // the child's resident memory after its first answer
	work_dir string // the input directory, which the child enters by name
	// shares_children is set in a server whose checks and questions share their
	// children.
	shares_children bool
	diagnostics     Diagnostics
	// token is the one of the check the child answers, which ends its partial
	// answer (see print_diagnostics), when the client takes partial answers
	// (V_DIAGNOSTICS_PARTIAL).
	token    string
	partials bool
	// partial prints what the check found before the grandchild went on, and
	// returns the exit code it gives.
	partial         fn (voidptr) int = unsafe { nil }
	partial_context voidptr
	// record_fd holds what the last check that recorded one left for the next
	// check of the program (see keep_incremental_record).
	record_fd int = -1
	// idle does part of the work the child can do while it waits for a question,
	// and reports whether some remains (see keep_busy_with).
	idle         fn (voidptr) bool = unsafe { nil }
	idle_context voidptr
}

Request is what a child of the diagnostics server was made for: answering question, the questions of a query line, or checking the program when it is empty. A child that answered can answer the next questions too, while the files it read hold what they held (see next_question). In a server that shares its children, it answers the next checks too.

fn (Request) answers_again #

fn (r &Request) answers_again() bool

answers_again reports whether this process can answer more questions after its first ones: never, without a server.

fn (Request) keep_inputs #

fn (mut r Request) keep_inputs(digests map[string]string, imports_hold fn (voidptr) bool, context voidptr)

keep_inputs does nothing without a server.

fn (Request) next_question #

fn (mut r Request) next_question(code int) ?string

next_question returns none: without a server, no question comes.

fn (Request) shares_checks #

fn (r &Request) shares_checks() bool

shares_checks reports false: without a server, no child answers checks.

fn (Request) asks_for_diagnostics #

fn (r &Request) asks_for_diagnostics(question string) bool

asks_for_diagnostics reports false: without a server, no question comes.

fn (Request) diagnose_in_grandchild #

fn (mut r Request) diagnose_in_grandchild() bool

diagnose_in_grandchild returns true: the check goes on in this process.

fn (Request) print_diagnostics #

fn (mut r Request) print_diagnostics() int

print_diagnostics prints nothing: without a server, the check prints them.

fn (Request) print_partial_with #

fn (mut r Request) print_partial_with(print fn (voidptr) int, context voidptr)

print_partial_with does nothing: without a server, the check prints all its diagnostics at once.

fn (Request) incremental_record #

fn (r &Request) incremental_record() string

incremental_record returns '': without a server, no check left one.

fn (Request) keep_incremental_record #

fn (r &Request) keep_incremental_record(text string)

keep_incremental_record does nothing without a server.

fn (Request) keep_busy_with #

fn (mut r Request) keep_busy_with(step fn (voidptr) bool, context voidptr)

keep_busy_with does nothing without a server: no question comes.