On this page:
input-info
make-input-info
well-formed-input-info/  c
abstract-input-info/  c
concrete-input-info/  c
current-inputs
input-ref
find-input
release-input
resolve-input
keep-input
$input
$input:  not-found
$input:  fetch
8.0

17 Resolving Inputs

 (require xiden/input-info) package: xiden

A package input is an instance of input-info.

struct

(struct input-info (name source integrity signature)
    #:prefab)
  name : string?
  source : source?
  integrity : (or/c #f integrity-info?)
  signature : (or/c #f signature-info?)
A structure representing a request for exact bytes from a source.

procedure

(make-input-info name    
  [source    
  integrity    
  signature])  well-formed-input-info/c
  name : string?
  source : source? = null
  integrity : (or/c #f well-formed-integrity-info/c) = #f
  signature : (or/c #f well-formed-signature-info/c) = #f
A contracted input-info constructor.

value

well-formed-input-info/c : flat-contract?

 = 
(struct/c input-info
          file-name-string?
          (non-empty-listof string?)
          (or/c #f well-formed-integrity-info/c)
          (or/c #f well-formed-signature-info/c))
A contract that recognizes package inputs suitable for use in package definitions.

A contract that recognizes package inputs with only a name defined.

A contract that recognizes package inputs with a name and a source.

A parameter bound to inputs to use with input-ref.

procedure

(input-ref name)  (logged/c input-info?)

  name : string?
Returns the first element of (current-inputs) with an input-info-name equal? to name.

procedure

(find-input inputs name)  (logged/c input-info?)

  inputs : (listof input-info?)
  name : string?
Returns a logged procedure P that either uses the first input in inputs with the given name, or fails with $input-not-found on the program log.

procedure

(release-input input)  (logged/c void?)

  input : input-info?
Returns a logged procedure P that deletes the symbolic link derived from input.

procedure

(resolve-input input)  (logged/c path-string?)

  input : input-info?
Returns a logged procedure P that, when applied, acquires and verifies the bytes for input. P returns a relative path to a symbolic link in (current-directory).

The process will fail if the bytes do not meet the requirements of input, if no bytes are available, or if the runtime configuration does not place trust in the bytes.

procedure

(keep-input name)  (logged/c path-string?)

  name : string?
Equivalent to (mdo i := (input-ref name) (resolve-input i)).

Use for inputs that you do not intend to release.

struct

(struct $input $message (name))

  name : string?
A message regarding an input with a given name.

Represents a failure to find an input using find-input.

struct

(struct $input:fetch $input (errors))

  errors : (listof $message?)
Represents the status for fetching an input from a source.

If errors is empty, then the fetch was successful. Otherwise, the fetch failed, and errors holds messages that explain why.