Module Octogram.Agent_builtins

This module introduces the remote procedure allowing to manage the lifecycle of a remote agent.

val agent_should_continue : Agent_state.t -> bool
type start_http_server = {
  1. directory : string;
  2. http_port : string option;
}
type start_http_server_r = {
  1. port : int;
}
type action =
  1. | Create
  2. | Extract
type 'uri tar = {
  1. contents : string;
  2. archive : 'uri;
  3. action : action;
}
type Remote_procedure.t +=
  1. | Quit : (unit, 'uri) Remote_procedure.t
    (*

    Quit can be used to terminate an agent gracefully.

    *)
  2. | Start_http_server : start_http_server -> (start_http_server_r, 'uri) Remote_procedure.t
    (*

    Start_http_server spawns a HTTP server on the agent, which can later be used to fetch files from it.

    Each agent can spawn at most one HTTP server.

    *)
  3. | Tar : 'uri tar -> (unit, 'uri) Remote_procedure.t
    (*

    Tar requests an agent to Create or Extract an archive.

    When Extracting, the archive can be on a remote agent. In such a case, the HTTP server of this agent will be used as a means to fetch the archive.

    *)