mirror of
https://github.com/jmcorgan/fips.git
synced 2026-07-30 19:46:15 +00:00
proto/bloom: relocate bloom filter into sans-IO layout
Migrate the v1 bloom filter subsystem into src/proto/bloom/, matching the discovery/routing/fmp/mmp/stp reference layout and completing the proto/ relocation series for the data/wire subsystems. - wire.rs: the FilterAnnounce (0x20) codec, moved from protocol/filter.rs - core.rs: the pure BloomFilter algorithm (hash/insert/contains/merge/ as_bytes/from_bytes/estimated_count), moved from bloom/filter.rs - state.rs: BloomState (per-peer inbound store, compute_outgoing_filter, the injected-clock send debounce), moved from bloom/state.rs - limits.rs: the v1 sizing constants - mod.rs: module wiring + the BloomError enum - tests/: the unit suite split by target (core/state/wire), no inline tests no_std+alloc hygiene: core::fmt over std::fmt, the tracing dependency dropped from the pure filter, and std collections replaced with BTreeMap/BTreeSet (NodeAddr: Ord) for deterministic iteration. The pure filter combination stays a BloomState method; the two irreducible shell gathers (peer_inbound_filters, build_filter_announce) remain in the async shell. Wire bytes and observable behavior are unchanged; full local CI green (36/36) including the bloom-storm chaos gate.
This commit is contained in:
+5
-5
@@ -4,12 +4,12 @@
|
||||
//! including debounced propagation to peers.
|
||||
|
||||
use crate::NodeAddr;
|
||||
use crate::bloom::BloomFilter;
|
||||
use crate::protocol::FilterAnnounce;
|
||||
use crate::proto::bloom::BloomFilter;
|
||||
use crate::proto::bloom::FilterAnnounce;
|
||||
|
||||
use super::reject::BloomReject;
|
||||
use super::{Node, NodeError};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::BTreeMap;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
impl Node {
|
||||
@@ -17,8 +17,8 @@ impl Node {
|
||||
///
|
||||
/// Returns a map of (peer_node_addr -> filter) for peers that
|
||||
/// have sent us a FilterAnnounce.
|
||||
pub(super) fn peer_inbound_filters(&self) -> HashMap<NodeAddr, BloomFilter> {
|
||||
let mut filters = HashMap::new();
|
||||
pub(super) fn peer_inbound_filters(&self) -> BTreeMap<NodeAddr, BloomFilter> {
|
||||
let mut filters = BTreeMap::new();
|
||||
for (addr, peer) in &self.peers {
|
||||
if self.is_tree_peer(addr)
|
||||
&& let Some(filter) = peer.inbound_filter()
|
||||
|
||||
Reference in New Issue
Block a user