Skip to content

Commit

Permalink
Rename ReplyBlockStore to SurbStore and update its usages and file na…
Browse files Browse the repository at this point in the history
…me accordingly
  • Loading branch information
nullchinchilla committed Aug 18, 2024
1 parent 841e976 commit 2fb7cf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/n2r_node.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod reply_block_store;
mod surb_store;

use std::{sync::Arc, time::Duration};

Expand All @@ -16,7 +16,7 @@ use smolscale::immortal::{Immortal, RespawnStrategy};

use crate::link_node::{IncomingMsg, LinkNode};

use self::reply_block_store::ReplyBlockStore;
use self::surb_store::SurbStore;

/// An implementation of the N2R layer.
pub struct N2rNode {
Expand All @@ -31,7 +31,7 @@ impl N2rNode {
link_node: Arc::new(link_node),
anon_queues: Arc::new(DashMap::new()),
relay_queues: Arc::new(DashMap::new()),
rb_store: Arc::new(Mutex::new(ReplyBlockStore::new())),
rb_store: Arc::new(Mutex::new(SurbStore::new())),
degarblers: Cache::builder()
.time_to_live(Duration::from_secs(3600))
.build(),
Expand Down Expand Up @@ -157,7 +157,7 @@ struct N2rNodeCtx {
link_node: Arc<LinkNode>,
anon_queues: Arc<DashMap<AnonEndpoint, Sender<(Bytes, RelayEndpoint, usize)>>>,
relay_queues: Arc<DashMap<Dock, Sender<(Bytes, AnonEndpoint)>>>,
rb_store: Arc<Mutex<ReplyBlockStore>>,
rb_store: Arc<Mutex<SurbStore>>,
degarblers: Cache<u64, ReplyDegarbler>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ use earendil_crypt::AnonEndpoint;
use earendil_packet::Surb;
use lru::LruCache;

pub struct ReplyBlockStore {
pub struct SurbStore {
items: LruCache<AnonEndpoint, ReplyBlockDeque>,
}

impl Default for ReplyBlockStore {
impl Default for SurbStore {
fn default() -> Self {
Self::new()
}
}

impl ReplyBlockStore {
impl SurbStore {
pub fn new() -> Self {
let items =
LruCache::new(NonZeroUsize::new(5000).expect("reply block store can't be of size 0"));
Expand Down Expand Up @@ -44,7 +44,7 @@ struct ReplyBlockDeque {
impl ReplyBlockDeque {
fn new(capacity: usize) -> Self {
ReplyBlockDeque {
deque: VecDeque::with_capacity(capacity),
deque: VecDeque::new(),
capacity,
}
}
Expand Down

0 comments on commit 2fb7cf3

Please sign in to comment.