Nostr.RelayPool (nostr_access v0.3.3)

View Source

Manages a pool of connections to a single relay.

Summary

Functions

Checks in a connection after use.

Checks out a connection with a free slot.

Returns a specification to start this module under a supervisor.

Starts a relay pool for the given URI.

Functions

checkin_conn(pool_pid, conn_pid)

@spec checkin_conn(pid(), pid()) :: :ok

Checks in a connection after use.

checkout_conn(pool_pid)

@spec checkout_conn(pid()) ::
  {:ok, pid()} | {:error, :no_slot} | {:error, {:connection_failed, term()}}

Checks out a connection with a free slot.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(uri)

@spec start_link(String.t()) :: {:ok, pid()} | {:error, term()}

Starts a relay pool for the given URI.