Skip to content

Commit 4626040

Browse files
committed
deploy: 054b6c5
1 parent 4408323 commit 4626040

File tree

2 files changed

+30
-46
lines changed

2 files changed

+30
-46
lines changed

pr/101/docs/src/iroh_blobs/store/fs/bao_file.rs.html

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -840,23 +840,7 @@
840840
<a href="#839" id="839">839</a>
841841
<a href="#840" id="840">840</a>
842842
<a href="#841" id="841">841</a>
843-
<a href="#842" id="842">842</a>
844-
<a href="#843" id="843">843</a>
845-
<a href="#844" id="844">844</a>
846-
<a href="#845" id="845">845</a>
847-
<a href="#846" id="846">846</a>
848-
<a href="#847" id="847">847</a>
849-
<a href="#848" id="848">848</a>
850-
<a href="#849" id="849">849</a>
851-
<a href="#850" id="850">850</a>
852-
<a href="#851" id="851">851</a>
853-
<a href="#852" id="852">852</a>
854-
<a href="#853" id="853">853</a>
855-
<a href="#854" id="854">854</a>
856-
<a href="#855" id="855">855</a>
857-
<a href="#856" id="856">856</a>
858-
<a href="#857" id="857">857</a>
859-
<a href="#858" id="858">858</a></pre></div><pre class="rust"><code><span class="kw">use </span>core::fmt;
843+
<a href="#842" id="842">842</a></pre></div><pre class="rust"><code><span class="kw">use </span>core::fmt;
860844
<span class="kw">use </span>std::{
861845
fs::{File, OpenOptions},
862846
io,
@@ -892,7 +876,7 @@
892876
fs::{meta::raw_outboard_size, TaskContext},
893877
util::{
894878
read_checksummed_and_truncate, write_checksummed, FixedSize, MemOrFile,
895-
PartialMemStorage, SizeInfo, SparseMemFile, DD,
879+
PartialMemStorage, DD,
896880
},
897881
Hash, IROH_BLOCK_SIZE,
898882
},
@@ -1389,21 +1373,11 @@
13891373
<span class="kw">if </span>Arc::strong_count(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>) &gt; <span class="number">1 </span>{
13901374
<span class="kw">return </span><span class="bool-val">false</span>;
13911375
}
1392-
<span class="comment">// there is the possibility that somebody else will increase the strong count
1393-
// here. there is nothing we can do about it, but they won't be able to
1394-
// access the internals of the handle because we have the lock.
1395-
//
1396-
// We poison the storage. A poisoned storage is considered dead and will
1397-
// have to be recreated, but only *after* we are done with persisting
1398-
// the bitfield.
1399-
</span><span class="kw">let </span>BaoFileStorage::Partial(fs) = guard.take() <span class="kw">else </span>{
1376+
<span class="kw">let </span>BaoFileStorage::Partial(fs) = guard.take() <span class="kw">else </span>{
14001377
<span class="kw">return </span><span class="bool-val">false</span>;
14011378
};
14021379
<span class="kw">let </span>options = <span class="kw-2">&amp;</span><span class="self">self</span>.options;
14031380
<span class="kw">let </span>path = options.path.bitfield_path(<span class="kw-2">&amp;</span><span class="self">self</span>.hash);
1404-
<span class="kw">if </span>fs.bitfield.size == <span class="number">8000000 </span>{
1405-
<span class="macro">println!</span>(<span class="string">"PERSISTING THE TEST CASE FILE to {}"</span>, path.display());
1406-
}
14071381
<span class="macro">trace!</span>(
14081382
<span class="string">"writing bitfield for hash {} to {}"</span>,
14091383
<span class="self">self</span>.hash,
@@ -1626,7 +1600,7 @@
16261600
}
16271601

16281602
<span class="kw">impl </span>PartialMemStorage {
1629-
<span class="doccomment">/// Persist the batch to disk, creating a FileBatch.
1603+
<span class="doccomment">/// Persist the batch to disk.
16301604
</span><span class="kw">fn </span>persist(<span class="self">self</span>, ctx: <span class="kw-2">&amp;</span>TaskContext, hash: <span class="kw-2">&amp;</span>Hash) -&gt; io::Result&lt;PartialFileStorage&gt; {
16311605
<span class="kw">let </span>options = <span class="kw-2">&amp;</span>ctx.options.path;
16321606
ctx.protect.protect(
@@ -1654,12 +1628,6 @@
16541628
bitfield: <span class="self">self</span>.bitfield,
16551629
})
16561630
}
1657-
1658-
<span class="doccomment">/// Get the parts data, outboard and sizes
1659-
</span><span class="attr">#[allow(dead_code)]
1660-
</span><span class="kw">pub fn </span>into_parts(<span class="self">self</span>) -&gt; (SparseMemFile, SparseMemFile, SizeInfo) {
1661-
(<span class="self">self</span>.data, <span class="self">self</span>.outboard, <span class="self">self</span>.size)
1662-
}
16631631
}
16641632

16651633
<span class="kw">pub struct </span>BaoFileStorageSubscriber {

pr/101/docs/src/iroh_blobs/store/fs/util/entity_manager.rs.html

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,15 @@
10281028
<a href="#1027" id="1027">1027</a>
10291029
<a href="#1028" id="1028">1028</a>
10301030
<a href="#1029" id="1029">1029</a>
1031-
<a href="#1030" id="1030">1030</a></pre></div><pre class="rust"><code><span class="attr">#![allow(dead_code)]
1031+
<a href="#1030" id="1030">1030</a>
1032+
<a href="#1031" id="1031">1031</a>
1033+
<a href="#1032" id="1032">1032</a>
1034+
<a href="#1033" id="1033">1033</a>
1035+
<a href="#1034" id="1034">1034</a>
1036+
<a href="#1035" id="1035">1035</a>
1037+
<a href="#1036" id="1036">1036</a>
1038+
<a href="#1037" id="1037">1037</a>
1039+
<a href="#1038" id="1038">1038</a></pre></div><pre class="rust"><code><span class="attr">#![allow(dead_code)]
10321040
</span><span class="kw">use </span>std::{fmt::Debug, future::Future, hash::Hash};
10331041

10341042
<span class="kw">use </span>n0_future::{future, FuturesUnordered};
@@ -1342,8 +1350,8 @@
13421350
<span class="kw">impl</span>&lt;P: Params&gt; EntityHandle&lt;P&gt; {
13431351
<span class="kw">pub fn </span>send(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="kw-2">&amp;</span>mpsc::Sender&lt;entity_actor::Command&lt;P&gt;&gt; {
13441352
<span class="kw">match </span><span class="self">self </span>{
1345-
EntityHandle::Live { send: sender } =&gt; sender,
1346-
EntityHandle::ShuttingDown { send: sender, .. } =&gt; sender,
1353+
EntityHandle::Live { send } =&gt; send,
1354+
EntityHandle::ShuttingDown { send, .. } =&gt; send,
13471355
}
13481356
}
13491357
}
@@ -1456,7 +1464,10 @@
14561464
task
14571465
}
14581466

1459-
<span class="attr">#[must_use = <span class="string">"this function may return a future that must be spawned by the caller"</span>]
1467+
<span class="doccomment">/// This function needs to be polled by the owner of the actor state to advance the
1468+
/// entity manager state machine. If it returns a future, that future must be spawned
1469+
/// by the caller.
1470+
</span><span class="attr">#[must_use = <span class="string">"this function may return a future that must be spawned by the caller"</span>]
14601471
</span><span class="kw">pub async fn </span>tick(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;<span class="kw">impl </span>Future&lt;Output = ()&gt; + Send + <span class="lifetime">'static</span>&gt; {
14611472
<span class="kw">if let </span><span class="prelude-val">Some</span>(cmd) = <span class="self">self</span>.internal_recv.recv().<span class="kw">await </span>{
14621473
<span class="kw">match </span>cmd {
@@ -1522,6 +1533,8 @@
15221533
}
15231534

15241535
<span class="doccomment">/// Get or create an entity actor for the given id.
1536+
///
1537+
/// If this function returns a future, it must be spawned by the caller.
15251538
</span><span class="kw">fn </span>get_or_create(
15261539
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
15271540
id: P::EntityId,
@@ -1531,14 +1544,17 @@
15311544
) {
15321545
<span class="kw">let </span><span class="kw-2">mut </span>task = <span class="prelude-val">None</span>;
15331546
<span class="kw">let </span>handle = <span class="self">self</span>.live.entry(id.clone()).or_insert_with(|| {
1534-
<span class="kw">if let </span><span class="prelude-val">Some</span>((sender, <span class="kw-2">mut </span>actor)) = <span class="self">self</span>.pool.pop() {
1535-
actor.state.id = id.clone();
1547+
<span class="kw">if let </span><span class="prelude-val">Some</span>((send, <span class="kw-2">mut </span>actor)) = <span class="self">self</span>.pool.pop() {
1548+
<span class="comment">// Get an actor from the pool of inactive actors and initialize it.
1549+
</span>actor.state.id = id.clone();
15361550
actor.state.global = <span class="self">self</span>.state.clone();
1537-
actor.state.state.reset();
1551+
<span class="comment">// strictly speaking this is not needed, since we reset the state when adding the actor to the pool.
1552+
</span>actor.state.state.reset();
15381553
task = <span class="prelude-val">Some</span>(actor.run());
1539-
EntityHandle::Live { send: sender }
1554+
EntityHandle::Live { send }
15401555
} <span class="kw">else </span>{
1541-
<span class="kw">let </span>(sender, recv) = mpsc::channel(<span class="self">self</span>.entity_inbox_size);
1556+
<span class="comment">// Create a new entity actor and inbox.
1557+
</span><span class="kw">let </span>(send, recv) = mpsc::channel(<span class="self">self</span>.entity_inbox_size);
15421558
<span class="kw">let </span>state: entity_actor::State&lt;P&gt; = entity_actor::State {
15431559
id: id.clone(),
15441560
global: <span class="self">self</span>.state.clone(),
@@ -1553,7 +1569,7 @@
15531569
),
15541570
};
15551571
task = <span class="prelude-val">Some</span>(actor.run());
1556-
EntityHandle::Live { send: sender }
1572+
EntityHandle::Live { send }
15571573
}
15581574
});
15591575
(handle, task)

0 commit comments

Comments
 (0)