bonfire-app/ActivityPub.Federator.Fetcher.html
2024-04-16 21:21:08 +00:00

695 lines
22 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.31.2">
<meta name="project" content="bonfire_umbrella v0.9.10-cooperation-beta.62">
<title>ActivityPub.Federator.Fetcher — bonfire_umbrella v0.9.10-cooperation-beta.62</title>
<link rel="stylesheet" href="dist/html-elixir-JKHCEBPC.css" />
<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
<script src="dist/handlebars.templates-A7S2WMC7.js"></script>
<script src="dist/sidebar_items-0AD831F9.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/html-JRPQ5PR6.js"></script>
</head>
<body data-type="modules" class="page-module">
<script>
try {
var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
if (settings.theme === 'dark' ||
((settings.theme === 'system' || settings.theme == null) &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.body.classList.add('dark')
}
} catch (error) { }
</script>
<div class="main">
<button id="sidebar-menu" class="sidebar-button sidebar-toggle" aria-label="toggle sidebar" aria-controls="sidebar">
<i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
</button>
<div class="background-layer"></div>
<nav id="sidebar" class="sidebar">
<div class="sidebar-header">
<div class="sidebar-projectInfo">
<a href="https://bonfirenetworks.org" class="sidebar-projectImage">
<img src="assets/logo.png" alt="bonfire_umbrella" />
</a>
<div>
<a href="https://bonfirenetworks.org" class="sidebar-projectName" translate="no">
bonfire_umbrella
</a>
<div class="sidebar-projectVersion" translate="no">
v0.9.10-cooperation-beta.62
</div>
</div>
</div>
<ul id="sidebar-listNav" class="sidebar-listNav" role="tablist">
<li>
<button id="extras-list-tab-button" role="tab" data-type="extras" aria-controls="extras-tab-panel" aria-selected="true" tabindex="0">
Pages
</button>
</li>
<li>
<button id="modules-list-tab-button" role="tab" data-type="modules" aria-controls="modules-tab-panel" aria-selected="false" tabindex="-1">
Modules
</button>
</li>
</ul>
</div>
<div id="extras-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="extras-list-tab-button">
<ul id="extras-full-list" class="full-list"></ul>
</div>
<div id="modules-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="modules-list-tab-button" hidden>
<ul id="modules-full-list" class="full-list"></ul>
</div>
</nav>
<main class="content">
<output role="status" id="toast"></output>
<div class="content-outer">
<div id="content" class="content-inner">
<div class="top-search">
<div class="search-settings">
<form class="search-bar" action="search.html">
<label class="search-label">
<span class="sr-only">Search documentation of bonfire_umbrella</span>
<input name="q" type="text" class="search-input" placeholder="Press / to search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
</label>
<button type="submit" class="search-button" aria-label="Submit Search">
<i class="ri-search-2-line ri-lg" aria-hidden="true" title="Submit search"></i>
</button>
<button type="button" tabindex="-1" class="search-close-button" aria-hidden="true">
<i class="ri-close-line ri-lg" title="Cancel search"></i>
</button>
</form>
<div class="autocomplete">
</div>
<button class="icon-settings display-settings">
<i class="ri-settings-3-line"></i>
<span class="sr-only">Settings</span>
</button>
</div>
</div>
<h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L1" title="View Source" class="icon-action" rel="help">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
<span translate="no">ActivityPub.Federator.Fetcher</span>
<small class="app-vsn" translate="no">(bonfire_umbrella v0.9.10-cooperation-beta.62)</small>
</h1>
<section id="moduledoc">
<p>Handles fetching AS2 objects from remote instances.</p>
</section>
<section id="summary" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#summary">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Summary</span>
</h1>
<div class="summary-functions summary">
<h2>
<a href="#functions">Functions</a>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#allowed_recursion?/2" translate="no">allowed_recursion?(distance, max_recursion \\ nil)</a>
</div>
<div class="summary-synopsis"><p>Returns <code class="inline">true</code> if the distance to target object does not exceed max configured value.
Serves to prevent fetching of very long threads, especially useful on smaller instances.
Addresses memory leaks on recursive replies fetching.
Applies to fetching of both ancestor (reply-to) and child (reply) objects.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#cache_fetch_error/1" translate="no">cache_fetch_error(id)</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#enqueue_fetch/2" translate="no">enqueue_fetch(id, worker_attrs \\ %{})</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_collection/2" translate="no">fetch_collection(ap_id, opts \\ [])</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_fresh_object_from_id/2" translate="no">fetch_fresh_object_from_id(id, opts \\ [])</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_object_from_id/2" translate="no">fetch_object_from_id(id, opts \\ [])</a>
</div>
<div class="summary-synopsis"><p>Checks if an object exists in the AP and Adapter databases and fetches and creates it if not.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_objects_from_id/2" translate="no">fetch_objects_from_id(ids, opts \\ [])</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_outbox/2" translate="no">fetch_outbox(actor, opts \\ [fetch_collection: :async])</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_remote_object_from_id/2" translate="no">fetch_remote_object_from_id(id, options \\ [])</a>
</div>
<div class="summary-synopsis"><p>Fetches an AS2 object from remote AP ID.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_replies/2" translate="no">fetch_replies(actor, opts \\ [fetch_collection: :async])</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#fetch_thread/2" translate="no">fetch_thread(actor, opts \\ [fetch_collection: :async])</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#get_cached_object_or_fetch_ap_id/2" translate="no">get_cached_object_or_fetch_ap_id(id, opts \\ [])</a>
</div>
<div class="summary-synopsis"><p>Checks if an object exists in the AP database and fetches it if not (but does not send to Adapter).</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#get_cached_object_or_fetch_pointer_id/2" translate="no">get_cached_object_or_fetch_pointer_id(pointer, opts \\ [])</a>
</div>
<div class="summary-synopsis"><p>Checks if an object exists in the AP database and prepares it if not (local objects only).</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#maybe_fetch/2" translate="no">maybe_fetch(entries, opts \\ [])</a>
</div>
<div class="summary-synopsis"><p>Fetch a list of objects within recursion limits. Used for reply_to/context, and replies or similar collections.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#maybe_parse_header_url/2" translate="no">maybe_parse_header_url(str, type)</a>
</div>
</div>
</div>
</section>
<section id="functions" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#functions">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Functions</span>
</h1>
<div class="functions-list">
<section class="detail" id="allowed_recursion?/2">
<span id="allowed_recursion?/1"></span>
<div class="detail-header">
<a href="#allowed_recursion?/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">allowed_recursion?(distance, max_recursion \\ nil)</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L715" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Returns <code class="inline">true</code> if the distance to target object does not exceed max configured value.
Serves to prevent fetching of very long threads, especially useful on smaller instances.
Addresses memory leaks on recursive replies fetching.
Applies to fetching of both ancestor (reply-to) and child (reply) objects.</p>
</section>
</section>
<section class="detail" id="cache_fetch_error/1">
<div class="detail-header">
<a href="#cache_fetch_error/1" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">cache_fetch_error(id)</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L501" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="enqueue_fetch/2">
<span id="enqueue_fetch/1"></span>
<div class="detail-header">
<a href="#enqueue_fetch/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">enqueue_fetch(id, worker_attrs \\ %{})</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L134" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="fetch_collection/2">
<span id="fetch_collection/1"></span>
<div class="detail-header">
<a href="#fetch_collection/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_collection(ap_id, opts \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L540" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="fetch_fresh_object_from_id/2">
<span id="fetch_fresh_object_from_id/1"></span>
<div class="detail-header">
<a href="#fetch_fresh_object_from_id/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_fresh_object_from_id(id, opts \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L143" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="fetch_object_from_id/2">
<span id="fetch_object_from_id/1"></span>
<div class="detail-header">
<a href="#fetch_object_from_id/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_object_from_id(id, opts \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L51" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Checks if an object exists in the AP and Adapter databases and fetches and creates it if not.</p>
</section>
</section>
<section class="detail" id="fetch_objects_from_id/2">
<span id="fetch_objects_from_id/1"></span>
<div class="detail-header">
<a href="#fetch_objects_from_id/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_objects_from_id(ids, opts \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L65" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="fetch_outbox/2">
<span id="fetch_outbox/1"></span>
<div class="detail-header">
<a href="#fetch_outbox/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_outbox(actor, opts \\ [fetch_collection: :async])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L267" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="fetch_remote_object_from_id/2">
<span id="fetch_remote_object_from_id/1"></span>
<div class="detail-header">
<a href="#fetch_remote_object_from_id/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_remote_object_from_id(id, options \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L339" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Fetches an AS2 object from remote AP ID.</p>
</section>
</section>
<section class="detail" id="fetch_replies/2">
<span id="fetch_replies/1"></span>
<div class="detail-header">
<a href="#fetch_replies/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_replies(actor, opts \\ [fetch_collection: :async])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L312" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="fetch_thread/2">
<span id="fetch_thread/1"></span>
<div class="detail-header">
<a href="#fetch_thread/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">fetch_thread(actor, opts \\ [fetch_collection: :async])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L289" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
<section class="detail" id="get_cached_object_or_fetch_ap_id/2">
<span id="get_cached_object_or_fetch_ap_id/1"></span>
<div class="detail-header">
<a href="#get_cached_object_or_fetch_ap_id/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">get_cached_object_or_fetch_ap_id(id, opts \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L26" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Checks if an object exists in the AP database and fetches it if not (but does not send to Adapter).</p>
</section>
</section>
<section class="detail" id="get_cached_object_or_fetch_pointer_id/2">
<span id="get_cached_object_or_fetch_pointer_id/1"></span>
<div class="detail-header">
<a href="#get_cached_object_or_fetch_pointer_id/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">get_cached_object_or_fetch_pointer_id(pointer, opts \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L43" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Checks if an object exists in the AP database and prepares it if not (local objects only).</p>
</section>
</section>
<section class="detail" id="maybe_fetch/2">
<span id="maybe_fetch/1"></span>
<div class="detail-header">
<a href="#maybe_fetch/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">maybe_fetch(entries, opts \\ [])</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L79" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Fetch a list of objects within recursion limits. Used for reply_to/context, and replies or similar collections.</p>
</section>
</section>
<section class="detail" id="maybe_parse_header_url/2">
<div class="detail-header">
<a href="#maybe_parse_header_url/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">maybe_parse_header_url(str, type)</h1>
<a href="https://github.com/bonfire-networks/activity_pub/blob/main/lib/federator/fetcher.ex#L505" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
</section>
</section>
</div>
</section>
<footer class="footer">
<p>
<span class="line">
<button class="a-main footer-button display-quick-switch" title="Search HexDocs packages">
Search HexDocs
</button>
<a href="bonfire_umbrella.epub" title="ePub version">
Download ePub version
</a>
</span>
</p>
<p class="built-using">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener" translate="no">ExDoc</a> (v0.31.2) for the
<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
</p>
</footer>
</div>
</div>
</main>
</div>
</body>
</html>