Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
data class CgroupReading(val throttled: Long?, val memoryMax: Long?, val oom: Long?, val oomKill: Long?)

The counters of the cgroup v2 that holds this process at one moment: nr_throttled of cpu.stat and max, oom and oom_kill of memory.events. A field is null when its file or counter is missing.

Link copied to clipboard
data class CommandResult(val exitCode: Int, val output: String, val usage: ResourceUsage? = null)
Link copied to clipboard
class FakeHost(val platform: String = "fake", val os: String = "linux", val arch: String = "x86_64", env: Map<String, String> = emptyMap(), files: Map<String, String> = emptyMap(), commands: Map<List<String>, CommandResult> = emptyMap(), canRun: Boolean = true, facts: List<Attribute> = emptyList(), val capabilities: Set<Capability> = Capability.entries.toSet(), sync: List<Long>? = null) : Host
Link copied to clipboard
class FakeSsh(remoteFiles: Map<String, String> = emptyMap(), remoteEnv: Map<String, String> = emptyMap(), remoteCommands: Map<List<String>, CommandResult> = emptyMap(), uname: String = "Linux x86_64", sshResult: CommandResult? = null, canRun: Boolean = true, val os: String = "macos", val capabilities: Set<Capability> = Capability.entries.toSet(), machines: Map<String, FakeSsh> = emptyMap()) : Host

A local host that answers ssh from a scripted remote, for tests that need a base host for SshHost. sshResult, when set, answers every ssh call (a connection failure, for example); machines answers the calls to a destination with another scripted remote.

Link copied to clipboard
interface Host
Link copied to clipboard
data class ResourceUsage(val userMs: Long?, val systemMs: Long?, val peakKb: Long?)

What the child cost, in whole milliseconds and KiB. A field is null when the platform cannot measure it, never zero: absent means unknown.

Link copied to clipboard
class SshException(val problem: SshProblem, message: String) : Exception

An ssh capture that stopped; message says what happened and what to do next.

Link copied to clipboard
class SshHost : Host

A host that runs the allowlisted read-only fact commands on a remote machine through the system ssh, started by base. It stores no credentials and never changes known_hosts. After a command fails because ssh did, problem holds why and every later command returns null at once.

Link copied to clipboard
Link copied to clipboard

A command outside the fixed allowlist; it never reaches ssh.

Link copied to clipboard
class SshTarget

A validated [user@]name (or [user@][ipv6]) that is safe to pass to ssh after --. Only letters, digits, dot, underscore and hyphen are allowed in a name, and none may start with a hyphen, so a host argument can never be read as an ssh option.

Properties

Link copied to clipboard
const val TIMED_OUT_EXIT_CODE: Int = 124

Exit code of a child killed at its deadline (the timeout(1) convention).

Functions

Link copied to clipboard

Null off Linux, without cgroup v2, or when none of the four counters can be read.

Link copied to clipboard
fun readAllBytes(chunk: Int, read: (ByteArray) -> Int): ByteArray

Joins what read fills into a chunk-sized buffer until it returns 0 or less.

Link copied to clipboard
expect fun systemHost(): Host
actual fun systemHost(): Host
actual fun systemHost(): Host
actual fun systemHost(): Host
actual fun systemHost(): Host