Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6d10df7 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Jul 6, 2023
1 parent 052f3e2 commit ece9d32
Show file tree
Hide file tree
Showing 24 changed files with 335 additions and 189 deletions.
2 changes: 1 addition & 1 deletion implementors/core/clone/trait.Clone.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/fmt/trait.Debug.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/marker/trait.Copy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/marker/trait.Freeze.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/marker/trait.Send.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/marker/trait.Sync.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/marker/trait.Unpin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion implementors/core/panic/unwind_safe/trait.UnwindSafe.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion search-index.js

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions src/subspace_farmer/single_disk_plot.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,14 @@
<a href="#1000" id="1000">1000</a>
<a href="#1001" id="1001">1001</a>
<a href="#1002" id="1002">1002</a>
<a href="#1003" id="1003">1003</a>
<a href="#1004" id="1004">1004</a>
<a href="#1005" id="1005">1005</a>
<a href="#1006" id="1006">1006</a>
<a href="#1007" id="1007">1007</a>
<a href="#1008" id="1008">1008</a>
<a href="#1009" id="1009">1009</a>
<a href="#1010" id="1010">1010</a>
</pre></div><pre class="rust"><code><span class="kw">mod </span>farming;
<span class="kw">pub mod </span>piece_reader;
<span class="kw">mod </span>plotting;
Expand Down Expand Up @@ -1383,7 +1391,11 @@

<span class="attr">#[derive(Default, Debug)]
</span><span class="kw">struct </span>Handlers {
sector_plotted: Handler&lt;(PlottedSector, Arc&lt;OwnedSemaphorePermit&gt;)&gt;,
sector_plotted: Handler&lt;(
PlottedSector,
<span class="prelude-ty">Option</span>&lt;PlottedSector&gt;,
Arc&lt;OwnedSemaphorePermit&gt;,
)&gt;,
solution: Handler&lt;SolutionResponse&gt;,
}

Expand Down Expand Up @@ -1897,9 +1909,9 @@
<span class="kw">move </span>|(sector_index, sector_metadata)| {
<span class="kw">let </span>sector_id = SectorId::new(public_key.hash(), sector_index);

<span class="kw">let </span><span class="kw-2">mut </span>piece_indexes = Vec::with_capacity(<span class="self">self</span>.pieces_in_sector.into());
<span class="kw">let </span><span class="kw-2">mut </span>piece_indexes = Vec::with_capacity(usize::from(<span class="self">self</span>.pieces_in_sector));
(PieceOffset::ZERO..)
.take(<span class="self">self</span>.pieces_in_sector.into())
.take(usize::from(<span class="self">self</span>.pieces_in_sector))
.map(|piece_offset| {
sector_id.derive_piece_index(
piece_offset,
Expand Down Expand Up @@ -1932,7 +1944,11 @@
/// throttling of the plotting process is desired.
</span><span class="kw">pub fn </span>on_sector_plotted(
<span class="kw-2">&amp;</span><span class="self">self</span>,
callback: HandlerFn&lt;(PlottedSector, Arc&lt;OwnedSemaphorePermit&gt;)&gt;,
callback: HandlerFn&lt;(
PlottedSector,
<span class="prelude-ty">Option</span>&lt;PlottedSector&gt;,
Arc&lt;OwnedSemaphorePermit&gt;,
)&gt;,
) -&gt; HandlerId {
<span class="self">self</span>.handlers.sector_plotted.add(callback)
}
Expand Down
98 changes: 89 additions & 9 deletions src/subspace_farmer/single_disk_plot/plotting.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,62 @@
<a href="#146" id="146">146</a>
<a href="#147" id="147">147</a>
<a href="#148" id="148">148</a>
<a href="#149" id="149">149</a>
<a href="#150" id="150">150</a>
<a href="#151" id="151">151</a>
<a href="#152" id="152">152</a>
<a href="#153" id="153">153</a>
<a href="#154" id="154">154</a>
<a href="#155" id="155">155</a>
<a href="#156" id="156">156</a>
<a href="#157" id="157">157</a>
<a href="#158" id="158">158</a>
<a href="#159" id="159">159</a>
<a href="#160" id="160">160</a>
<a href="#161" id="161">161</a>
<a href="#162" id="162">162</a>
<a href="#163" id="163">163</a>
<a href="#164" id="164">164</a>
<a href="#165" id="165">165</a>
<a href="#166" id="166">166</a>
<a href="#167" id="167">167</a>
<a href="#168" id="168">168</a>
<a href="#169" id="169">169</a>
<a href="#170" id="170">170</a>
<a href="#171" id="171">171</a>
<a href="#172" id="172">172</a>
<a href="#173" id="173">173</a>
<a href="#174" id="174">174</a>
<a href="#175" id="175">175</a>
<a href="#176" id="176">176</a>
<a href="#177" id="177">177</a>
<a href="#178" id="178">178</a>
<a href="#179" id="179">179</a>
<a href="#180" id="180">180</a>
<a href="#181" id="181">181</a>
<a href="#182" id="182">182</a>
<a href="#183" id="183">183</a>
<a href="#184" id="184">184</a>
<a href="#185" id="185">185</a>
<a href="#186" id="186">186</a>
<a href="#187" id="187">187</a>
<a href="#188" id="188">188</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::single_disk_plot::{Handlers, PlotMetadataHeader, RESERVED_PLOT_METADATA};
<span class="kw">use crate</span>::{node_client, NodeClient};
<span class="kw">use </span>memmap2::{MmapMut, MmapOptions};
<span class="kw">use </span>parity_scale_codec::Encode;
<span class="kw">use </span>parking_lot::RwLock;
<span class="kw">use </span>std::fs::File;
<span class="kw">use </span>std::io;
<span class="kw">use </span>std::num::NonZeroU16;
<span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::{io, mem};
<span class="kw">use </span>subspace_core_primitives::crypto::kzg::Kzg;
<span class="kw">use </span>subspace_core_primitives::{PublicKey, SectorIndex};
<span class="kw">use </span>subspace_core_primitives::{PieceOffset, PublicKey, SectorIndex};
<span class="kw">use </span>subspace_erasure_coding::ErasureCoding;
<span class="kw">use </span>subspace_farmer_components::plotting;
<span class="kw">use </span>subspace_farmer_components::plotting::{plot_sector, PieceGetter, PieceGetterRetryPolicy};
<span class="kw">use </span>subspace_farmer_components::plotting::{
plot_sector, PieceGetter, PieceGetterRetryPolicy, PlottedSector,
};
<span class="kw">use </span>subspace_farmer_components::sector::SectorMetadata;
<span class="kw">use </span>subspace_proof_of_space::Table;
<span class="kw">use </span>thiserror::Error;
Expand Down Expand Up @@ -278,18 +320,56 @@

metadata_header.sector_count += <span class="number">1</span>;
metadata_header_mmap.copy_from_slice(metadata_header.encode().as_slice());
sectors_metadata
.write()
.push(plotted_sector.sector_metadata.clone());
<span class="kw">let </span>maybe_old_sector_metadata = {
<span class="kw">let </span><span class="kw-2">mut </span>sectors_metadata = sectors_metadata.write();
<span class="comment">// If exists then we&#39;re replotting, otherwise we create sector for the first time
</span><span class="kw">if let </span><span class="prelude-val">Some</span>(existing_sector_metadata) = sectors_metadata.get_mut(sector_index <span class="kw">as </span>usize)
{
<span class="kw">let </span><span class="kw-2">mut </span>sector_metadata_tmp = plotted_sector.sector_metadata.clone();
mem::swap(existing_sector_metadata, <span class="kw-2">&amp;mut </span>sector_metadata_tmp);
<span class="prelude-val">Some</span>(sector_metadata_tmp)
} <span class="kw">else </span>{
sectors_metadata.push(plotted_sector.sector_metadata.clone());
<span class="prelude-val">None
</span>}
};

<span class="kw">let </span>old_plotted_sector = maybe_old_sector_metadata.map(|old_sector_metadata| {
<span class="kw">let </span>old_history_size = old_sector_metadata.history_size;

PlottedSector {
sector_id: plotted_sector.sector_id,
sector_index: plotted_sector.sector_index,
sector_metadata: old_sector_metadata,
piece_indexes: {
<span class="kw">let </span><span class="kw-2">mut </span>piece_indexes = Vec::with_capacity(usize::from(pieces_in_sector));
(PieceOffset::ZERO..)
.take(usize::from(pieces_in_sector))
.map(|piece_offset| {
plotted_sector.sector_id.derive_piece_index(
piece_offset,
old_history_size,
farmer_app_info.protocol_info.max_pieces_in_sector,
farmer_app_info.protocol_info.recent_segments,
farmer_app_info.protocol_info.recent_history_fraction,
)
})
.collect_into(<span class="kw-2">&amp;mut </span>piece_indexes);
piece_indexes
},
}
});

<span class="comment">// Inform others that this sector is no longer being modified
</span>modifying_sector_index.write().take();

<span class="macro">info!</span>(%sector_index, <span class="string">&quot;Sector plotted successfully&quot;</span>);

handlers
.sector_plotted
.call_simple(<span class="kw-2">&amp;</span>(plotted_sector, Arc::new(plotting_permit)));
handlers.sector_plotted.call_simple(<span class="kw-2">&amp;</span>(
plotted_sector,
old_plotted_sector,
Arc::new(plotting_permit),
));
}

<span class="prelude-val">Ok</span>(())
Expand Down
22 changes: 22 additions & 0 deletions src/subspace_farmer/utils/archival_storage_pieces.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@
<a href="#74" id="74">74</a>
<a href="#75" id="75">75</a>
<a href="#76" id="76">76</a>
<a href="#77" id="77">77</a>
<a href="#78" id="78">78</a>
<a href="#79" id="79">79</a>
<a href="#80" id="80">80</a>
<a href="#81" id="81">81</a>
<a href="#82" id="82">82</a>
<a href="#83" id="83">83</a>
<a href="#84" id="84">84</a>
<a href="#85" id="85">85</a>
<a href="#86" id="86">86</a>
<a href="#87" id="87">87</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>cuckoofilter::CuckooFilter;
<span class="kw">use </span>event_listener_primitives::{Bag, HandlerId};
<span class="kw">use </span>parking_lot::Mutex;
Expand Down Expand Up @@ -132,6 +143,17 @@
</span>);
}
}

<span class="kw">pub fn </span>delete_pieces(<span class="kw-2">&amp;</span><span class="self">self</span>, piece_indexes: <span class="kw-2">&amp;</span>[PieceIndex]) {
<span class="kw">let </span><span class="kw-2">mut </span>cuckoo_filter = <span class="self">self</span>.cuckoo_filter.lock();

<span class="kw">for </span>piece_index <span class="kw">in </span>piece_indexes {
cuckoo_filter.delete(piece_index);
}
drop(cuckoo_filter);

<span class="self">self</span>.listeners.call_simple(<span class="kw-2">&amp;</span>Notification);
}
}

<span class="kw">impl </span>CuckooFilterProvider <span class="kw">for </span>ArchivalStoragePieces {
Expand Down
Loading

0 comments on commit ece9d32

Please sign in to comment.