nim-libp2p/investigate-use-of-closed-c.../libp2p/peerstore.html

579 lines
46 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/peerstore</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/peerstore</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AddressBook" title="AddressBook {.public.} = ref object of SeqPeerBook[MultiAddress]">AddressBook</a></li>
<li><a class="reference" href="#AgentBook" title="AgentBook {.public.} = ref object of PeerBook[string]">AgentBook</a></li>
<li><a class="reference" href="#KeyBook" title="KeyBook {.public.} = ref object of PeerBook[PublicKey]">KeyBook</a></li>
<li><a class="reference" href="#PeerBook" title="PeerBook[T] {.public.} = ref object of BasePeerBook
book*: Table[PeerId, T]">PeerBook</a></li>
<li><a class="reference" href="#PeerBookChangeHandler" title="PeerBookChangeHandler = proc (peerId: PeerId) {.gcsafe, raises: [].}">PeerBookChangeHandler</a></li>
<li><a class="reference" href="#PeerStore" title="PeerStore {.public.} = ref object
capacity*: int
toClean*: seq[PeerId]">PeerStore</a></li>
<li><a class="reference" href="#ProtoBook" title="ProtoBook {.public.} = ref object of SeqPeerBook[string]">ProtoBook</a></li>
<li><a class="reference" href="#ProtoVersionBook" title="ProtoVersionBook {.public.} = ref object of PeerBook[string]">ProtoVersionBook</a></li>
<li><a class="reference" href="#SeqPeerBook" title="SeqPeerBook[T] = ref object of PeerBook[seq[T]]">SeqPeerBook</a></li>
<li><a class="reference" href="#SPRBook" title="SPRBook {.public.} = ref object of PeerBook[Envelope]">SPRBook</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">[]
<li><a class="reference" href="#%5B%5D%2CPeerStore%2Ctype%5BT%5D" title="`[]`[T](p: PeerStore; typ: type[T]): T">`[]`[T](p: PeerStore; typ: type[T]): T</a></li>
<li><a class="reference" href="#%5B%5D%2CPeerBook%5BT%5D%2CPeerId" title="`[]`[T](peerBook: PeerBook[T]; peerId: PeerId): T">`[]`[T](peerBook: PeerBook[T]; peerId: PeerId): T</a></li>
</ul>
<ul class="simple nested-toc-section">[]=
<li><a class="reference" href="#%5B%5D%3D%2CPeerBook%5BT%5D%2CPeerId%2CT" title="`[]=`[T](peerBook: PeerBook[T]; peerId: PeerId; entry: T)">`[]=`[T](peerBook: PeerBook[T]; peerId: PeerId; entry: T)</a></li>
</ul>
<ul class="simple nested-toc-section">addHandler
<li><a class="reference" href="#addHandler%2CPeerBook%5BT%5D%2CPeerBookChangeHandler" title="addHandler[T](peerBook: PeerBook[T]; handler: PeerBookChangeHandler)">addHandler[T](peerBook: PeerBook[T]; handler: PeerBookChangeHandler)</a></li>
</ul>
<ul class="simple nested-toc-section">cleanup
<li><a class="reference" href="#cleanup%2CPeerStore%2CPeerId" title="cleanup(peerStore: PeerStore; peerId: PeerId)">cleanup(peerStore: PeerStore; peerId: PeerId)</a></li>
</ul>
<ul class="simple nested-toc-section">contains
<li><a class="reference" href="#contains%2CPeerBook%5BT%5D%2CPeerId" title="contains[T](peerBook: PeerBook[T]; peerId: PeerId): bool">contains[T](peerBook: PeerBook[T]; peerId: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">del
<li><a class="reference" href="#del%2CPeerStore%2CPeerId" title="del(peerStore: PeerStore; peerId: PeerId)">del(peerStore: PeerStore; peerId: PeerId)</a></li>
<li><a class="reference" href="#del%2CPeerBook%5BT%5D%2CPeerId" title="del[T](peerBook: PeerBook[T]; peerId: PeerId): bool">del[T](peerBook: PeerBook[T]; peerId: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getMostObservedProtosAndPorts
<li><a class="reference" href="#getMostObservedProtosAndPorts%2CPeerStore" title="getMostObservedProtosAndPorts(self: PeerStore): seq[MultiAddress]">getMostObservedProtosAndPorts(self: PeerStore): seq[MultiAddress]</a></li>
</ul>
<ul class="simple nested-toc-section">guessDialableAddr
<li><a class="reference" href="#guessDialableAddr%2CPeerStore%2CMultiAddress" title="guessDialableAddr(self: PeerStore; ma: MultiAddress): MultiAddress">guessDialableAddr(self: PeerStore; ma: MultiAddress): MultiAddress</a></li>
</ul>
<ul class="simple nested-toc-section">identify
<li><a class="reference" href="#identify%2CPeerStore%2CMuxer" title="identify(peerStore: PeerStore; muxer: Muxer)">identify(peerStore: PeerStore; muxer: Muxer)</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CPeerBook%5BT%5D" title="len[T](peerBook: PeerBook[T]): int">len[T](peerBook: PeerBook[T]): int</a></li>
</ul>
<ul class="simple nested-toc-section">new
<li><a class="reference" href="#new%2CtypePeerStore%2CIdentify%2Cint" title="new(T: type PeerStore; identify: Identify; capacity = 1000): PeerStore">new(T: type PeerStore; identify: Identify; capacity = 1000): PeerStore</a></li>
</ul>
<ul class="simple nested-toc-section">updatePeerInfo
<li><a class="reference" href="#updatePeerInfo%2CPeerStore%2CIdentifyInfo" title="updatePeerInfo(peerStore: PeerStore; info: IdentifyInfo)">updatePeerInfo(peerStore: PeerStore; info: IdentifyInfo)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Stores generic informations about peers.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Comment"># Will keep info of all connected peers +</span>
<span class="Comment"># last 50 disconnected peers</span>
<span class="Keyword">let</span> <span class="Identifier">peerStore</span> <span class="Operator">=</span> <span class="Identifier">PeerStore</span><span class="Operator">.</span><span class="Identifier">new</span><span class="Punctuation">(</span><span class="Identifier">capacity</span> <span class="Operator">=</span> <span class="DecNumber">50</span><span class="Punctuation">)</span>
<span class="Comment"># Create a custom book type</span>
<span class="Keyword">type</span> <span class="Identifier">MoodBook</span> <span class="Operator">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">PeerBook</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span>
<span class="Keyword">var</span> <span class="Identifier">somePeerId</span> <span class="Operator">=</span> <span class="Identifier">PeerId</span><span class="Operator">.</span><span class="Identifier">random</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">expect</span><span class="Punctuation">(</span><span class="StringLit">&quot;get random key&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">peerStore</span><span class="Punctuation">[</span><span class="Identifier">MoodBook</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="Identifier">somePeerId</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">&quot;Happy&quot;</span>
<span class="Identifier">doAssert</span> <span class="Identifier">peerStore</span><span class="Punctuation">[</span><span class="Identifier">MoodBook</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="Identifier">somePeerId</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;Happy&quot;</span></pre>##############################################################################</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="crypto/crypto.html">crypto/crypto</a>, <a class="reference external" href="protocols/identify.html">protocols/identify</a>, <a class="reference external" href="protocols/protocol.html">protocols/protocol</a>, <a class="reference external" href="peerid.html">peerid</a>, <a class="reference external" href="peerinfo.html">peerinfo</a>, <a class="reference external" href="routing_record.html">routing_record</a>, <a class="reference external" href="multiaddress.html">multiaddress</a>, <a class="reference external" href="stream/connection.html">stream/connection</a>, <a class="reference external" href="multistream.html">multistream</a>, <a class="reference external" href="muxers/muxer.html">muxers/muxer</a>, <a class="reference external" href="utility.html">utility</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AddressBook" class="tohide">
<dt><pre><a href="peerstore.html#AddressBook"><span class="Identifier">AddressBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#SeqPeerBook"><span class="Identifier">SeqPeerBook</span></a><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L61" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L61" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AgentBook" class="tohide">
<dt><pre><a href="peerstore.html#AgentBook"><span class="Identifier">AgentBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L65" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L65" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="KeyBook" class="tohide">
<dt><pre><a href="peerstore.html#KeyBook"><span class="Identifier">KeyBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><a href="crypto/crypto.html#PublicKey"><span class="Identifier">PublicKey</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L63" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L63" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PeerBook" class="tohide">
<dt><pre><a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">BasePeerBook</span>
<span class="Identifier">book</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Table</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">T</span><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L56" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L56" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PeerBookChangeHandler" class="tohide">
<dt><pre><a href="peerstore.html#PeerBookChangeHandler"><span class="Identifier">PeerBookChangeHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PeerStore" class="tohide">
<dt><pre><a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">capacity</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">toClean</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoBook" class="tohide">
<dt><pre><a href="peerstore.html#ProtoBook"><span class="Identifier">ProtoBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#SeqPeerBook"><span class="Identifier">SeqPeerBook</span></a><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L62" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L62" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoVersionBook" class="tohide">
<dt><pre><a href="peerstore.html#ProtoVersionBook"><span class="Identifier">ProtoVersionBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L66" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L66" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SeqPeerBook" class="tohide">
<dt><pre><a href="peerstore.html#SeqPeerBook"><span class="Identifier">SeqPeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L59" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L59" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SPRBook" class="tohide">
<dt><pre><a href="peerstore.html#SPRBook"><span class="Identifier">SPRBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><a href="signed_envelope.html#Envelope"><span class="Identifier">Envelope</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L67" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L67" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="[]-procs-all">
<div id="[],PeerStore,type[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CPeerStore%2Ctype%5BT%5D"><span class="Identifier">`[]`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">typ</span><span class="Other">:</span> <span class="Identifier">type</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get a book from the PeerStore (ex: peerStore<a class="reference internal nimdoc" title="type AddressBook" href="#AddressBook">AddressBook</a>)
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L135" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L135" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="[],PeerBook[T],PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CPeerBook%5BT%5D%2CPeerId"><span class="Identifier">`[]`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get all known metadata of a provided peer, or default(T) if missing
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L89" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L89" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="[]=-procs-all">
<div id="[]=,PeerBook[T],PeerId,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%3D%2CPeerBook%5BT%5D%2CPeerId%2CT"><span class="Identifier">`[]=`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">entry</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Set metadata for a given peerId.
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L94" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L94" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="addHandler-procs-all">
<div id="addHandler,PeerBook[T],PeerBookChangeHandler" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#addHandler%2CPeerBook%5BT%5D%2CPeerBookChangeHandler"><span class="Identifier">addHandler</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="peerstore.html#PeerBookChangeHandler"><span class="Identifier">PeerBookChangeHandler</span></a><span class="Other">)</span> {.
<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Adds a callback that will be called everytime the book changes
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L121" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L121" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="cleanup-procs-all">
<div id="cleanup,PeerStore,PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#cleanup%2CPeerStore%2CPeerId"><span class="Identifier">cleanup</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L180" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L180" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="contains-procs-all">
<div id="contains,PeerBook[T],PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#contains%2CPeerBook%5BT%5D%2CPeerId"><span class="Identifier">contains</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L118" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L118" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="del-procs-all">
<div id="del,PeerStore,PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#del%2CPeerStore%2CPeerId"><span class="Identifier">del</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Delete the provided peer from every book.
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L148" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L148" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="del,PeerBook[T],PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#del%2CPeerBook%5BT%5D%2CPeerId"><span class="Identifier">del</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Delete the provided peer from the book. Returns whether the peer was in the book
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L105" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L105" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getMostObservedProtosAndPorts-procs-all">
<div id="getMostObservedProtosAndPorts,PeerStore" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getMostObservedProtosAndPorts%2CPeerStore"><span class="Identifier">getMostObservedProtosAndPorts</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L221" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L221" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="guessDialableAddr-procs-all">
<div id="guessDialableAddr,PeerStore,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#guessDialableAddr%2CPeerStore%2CMultiAddress"><span class="Identifier">guessDialableAddr</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L224" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L224" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="identify-procs-all">
<div id="identify,PeerStore,Muxer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#identify%2CPeerStore%2CMuxer"><span class="Identifier">identify</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">muxer</span><span class="Other">:</span> <a href="muxers/muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L196" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L196" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-procs-all">
<div id="len,PeerBook[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CPeerBook%5BT%5D"><span class="Identifier">len</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L125" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L125" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="new-procs-all">
<div id="new,typePeerStore,Identify,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2CtypePeerStore%2CIdentify%2Cint"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">PeerStore</span><span class="Other">;</span> <span class="Identifier">identify</span><span class="Other">:</span> <a href="protocols/identify.html#Identify"><span class="Identifier">Identify</span></a><span class="Other">;</span> <span class="Identifier">capacity</span> <span class="Other">=</span> <span class="DecNumber">1000</span><span class="Other">)</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a> {.
<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="updatePeerInfo-procs-all">
<div id="updatePeerInfo,PeerStore,IdentifyInfo" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#updatePeerInfo%2CPeerStore%2CIdentifyInfo"><span class="Identifier">updatePeerInfo</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="protocols/identify.html#IdentifyInfo"><span class="Identifier">IdentifyInfo</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/investigate-use-of-closed-connection/libp2p/peerstore.nim#L154" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L154" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-26 14:45:09 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>