Only add local posts to index in activity_pub
[akkoma] / lib / pleroma / gun.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Gun do
6 @callback open(charlist(), pos_integer(), map()) :: {:ok, pid()}
7 @callback info(pid()) :: map()
8 @callback close(pid()) :: :ok
9 @callback await_up(pid, pos_integer()) :: {:ok, atom()} | {:error, atom()}
10 @callback connect(pid(), map()) :: reference()
11 @callback await(pid(), reference()) :: {:response, :fin, 200, []}
12 @callback set_owner(pid(), pid()) :: :ok
13
14 defp api, do: Pleroma.Config.get([Pleroma.Gun], Pleroma.Gun.API)
15
16 def open(host, port, opts), do: api().open(host, port, opts)
17
18 def info(pid), do: api().info(pid)
19
20 def close(pid), do: api().close(pid)
21
22 def await_up(pid, timeout \\ 5_000), do: api().await_up(pid, timeout)
23
24 def connect(pid, opts), do: api().connect(pid, opts)
25
26 def await(pid, ref), do: api().await(pid, ref)
27
28 def set_owner(pid, owner), do: api().set_owner(pid, owner)
29 end