logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

gun.ex (1008B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Gun do
  5. @callback open(charlist(), pos_integer(), map()) :: {:ok, pid()}
  6. @callback info(pid()) :: map()
  7. @callback close(pid()) :: :ok
  8. @callback await_up(pid, pos_integer()) :: {:ok, atom()} | {:error, atom()}
  9. @callback connect(pid(), map()) :: reference()
  10. @callback await(pid(), reference()) :: {:response, :fin, 200, []}
  11. @callback set_owner(pid(), pid()) :: :ok
  12. defp api, do: Pleroma.Config.get([Pleroma.Gun], Pleroma.Gun.API)
  13. def open(host, port, opts), do: api().open(host, port, opts)
  14. def info(pid), do: api().info(pid)
  15. def close(pid), do: api().close(pid)
  16. def await_up(pid, timeout \\ 5_000), do: api().await_up(pid, timeout)
  17. def connect(pid, opts), do: api().connect(pid, opts)
  18. def await(pid, ref), do: api().await(pid, ref)
  19. def set_owner(pid, owner), do: api().set_owner(pid, owner)
  20. end