Imp.ACP.Local (Imp v0.5.0)

Copy Markdown View Source

Local ACP attachment to a long-running application over a private UNIX socket.

Each accepted connection gets its own ordinary Imp.ACP adapter. A host application supplies a program factory that attaches to its own runtime; closing the connection closes the adapter, not that independently owned runtime. relay/2 exposes this socket as standard ACP stdio to an ordinary client.

Existing socket paths are always refused, including stale paths. Remove a stale socket only after independently establishing that its owner is gone. The parent directory must be private (0700); an absent directory is created.

Summary

Functions

Returns a specification to start this module under a supervisor.

Relays bounded ACP frames between standard streams and a local service socket.

Listens on a private UNIX socket and gives each connection its own agent.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

relay(path, opts \\ [])

Relays bounded ACP frames between standard streams and a local service socket.

Options

  • :max_frame_bytes (pos_integer/0) - Largest ACP frame read or written, in bytes. The default value is 1048576.

start_link(opts)

Listens on a private UNIX socket and gives each connection its own agent.

The agent options are validated here, before anything listens, and an option this function does not know raises ArgumentError.

Options

  • :socket_path (String.t/0) - Required. Where to listen. The path must not exist; its directory must be private.

  • :max_frame_bytes (pos_integer/0) - Largest ACP frame read or written, in bytes. The default value is 1048576.

  • :agent_options - Options for the Imp.ACP agent each connection gets, as Imp.ACP.start_link/1 takes them, less the transport and frame limit this module sets: :name, :transport, :transport_mod, :transport_options, :max_frame_bytes. The default value is [].