Sys.Arch (Hyper v0.1.0)

Copy Markdown View Source

CPU architecture detection for the current machine.

Summary

Types

t()

A CPU architecture Hyper supports.

Functions

Detect the CPU architecture of the current machine.

Map an architecture to the Go/OCI arch name (skopeo --override-arch, image manifests).

Classify a raw architecture string (a target triplet or a bare arch name) into a supported architecture. An unrecognised string is refused with {:error, {:unsupported_arch, raw}}, echoing the input.

Types

t()

@type t() :: :x86_64 | :aarch64

A CPU architecture Hyper supports.

Functions

current()

@spec current() :: {:ok, t()} | {:error, {:unsupported_arch, String.t()}}

Detect the CPU architecture of the current machine.

Returns the architecture as an atom, or {:error, {:unsupported_arch, raw}} where raw is the unrecognised :erlang.system_info(:system_architecture) string.

goarch(atom)

@spec goarch(t()) :: String.t()

Map an architecture to the Go/OCI arch name (skopeo --override-arch, image manifests).

parse(sys)

@spec parse(String.t()) :: {:ok, t()} | {:error, {:unsupported_arch, String.t()}}

Classify a raw architecture string (a target triplet or a bare arch name) into a supported architecture. An unrecognised string is refused with {:error, {:unsupported_arch, raw}}, echoing the input.