PtcRunner.Kernel.InspectionArtifact.Handle (PtcRunner v0.15.0)

Copy Markdown View Source

Pinned reader for one sealed evidence artifact.

The descriptor is a file-server IoDevice so admission and query workers can pread/3 the same opened inode. :raw descriptors are process-local and cannot be shared with bounded workers. Queries continue against this descriptor after the path is replaced. Size and footer accounting detect append or truncate. Same-size overwrites are detected when a queried range's digest disagrees with admission, or during admission seal confirmation.

Summary

Types

t()

@type t() :: %{
  io: :file.io_device(),
  size: non_neg_integer(),
  footer: PtcRunner.Kernel.InspectionArtifact.Format.footer(),
  digest: binary()
}

Functions

assert_stable(handle)

@spec assert_stable(t()) :: :ok | {:error, :source_changed}

close(arg1)

@spec close(t() | nil) :: :ok

confirm_seal(handle, streamed_evidence_sha, state, io_buffer_bytes)

@spec confirm_seal(t(), binary(), map(), pos_integer()) ::
  :ok | {:error, :malformed_source | :source_changed}

current_size(map)

@spec current_size(t()) :: {:ok, non_neg_integer()} | {:error, :source_changed}

open(path)

@spec open(Path.t()) ::
  {:ok, t()}
  | {:error, :malformed_source | :source_changed | :source_unavailable}

pread(arg1, offset, length)

@spec pread(t(), non_neg_integer(), non_neg_integer()) ::
  {:ok, binary()} | {:error, :source_changed}

usable?(arg1)

@spec usable?(t()) :: boolean()

verify_range(handle, offset, length, digest)

@spec verify_range(t(), non_neg_integer(), non_neg_integer(), binary()) ::
  {:ok, binary()} | {:error, :source_changed}