CliSubprocessCore.JSONRPC (CliSubprocessCore v0.2.0)

Copy Markdown View Source

JSON-RPC helper on top of CliSubprocessCore.ProtocolSession.

The helper owns generic JSON-RPC framing, request id allocation, response decoding, and peer-request reply encoding. Provider-specific methods, params, and schemas stay outside the core.

Summary

Functions

Waits for the JSON-RPC session to become ready.

Stops the JSON-RPC session.

Returns JSON-RPC session information.

Interrupts the underlying session.

Sends a JSON-RPC notification.

Starts an unlinked JSON-RPC session.

Starts a linked JSON-RPC session.

Types

Functions

await_ready(session, timeout_ms)

@spec await_ready(t(), pos_integer()) :: :ok | {:error, term()}

Waits for the JSON-RPC session to become ready.

close(session)

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

Stops the JSON-RPC session.

info(session)

@spec info(t()) :: info_t()

Returns JSON-RPC session information.

interrupt(session)

@spec interrupt(t()) :: :ok | {:error, term()}

Interrupts the underlying session.

notify(session, method, params \\ nil)

@spec notify(t(), String.t(), map() | list() | nil) :: :ok | {:error, term()}

Sends a JSON-RPC notification.

request(session, method, params \\ nil, opts \\ [])

@spec request(t(), String.t(), map() | list() | nil, keyword()) ::
  {:ok, term()} | {:error, term()}

Sends a JSON-RPC request.

start(opts)

@spec start(keyword()) :: {:ok, t()} | {:error, term()}

Starts an unlinked JSON-RPC session.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts a linked JSON-RPC session.