ChanMgr: Rename ChannelMap to MgrState

We're doing this because the type now holds "all the mutable state
in a ChanMgr", not just the map.

This is a pure renaming; no documentation has been updated.

Part of #606.
This commit is contained in:
Nick Mathewson 2022-11-16 11:32:49 -05:00
parent 09b918515c
commit 8271037d37
2 changed files with 7 additions and 7 deletions

View File

@ -82,7 +82,7 @@ pub(crate) struct AbstractChanMgr<CF: AbstractChannelFactory> {
connector: CF,
/// A map from ed25519 identity to channel, or to pending channel status.
pub(crate) channels: map::ChannelMap<CF::Channel>,
pub(crate) channels: map::MgrState<CF::Channel>,
}
/// Type alias for a future that we wait on to see when a pending
@ -103,7 +103,7 @@ impl<CF: AbstractChannelFactory> AbstractChanMgr<CF> {
) -> Self {
AbstractChanMgr {
connector,
channels: map::ChannelMap::new(config.clone(), dormancy, netparams),
channels: map::MgrState::new(config.clone(), dormancy, netparams),
}
}

View File

@ -31,7 +31,7 @@ mod padding_test;
/// `Mutex<HashMap<...>>` to limit the amount of code that can see and
/// lock the Mutex here. (We're using a blocking mutex close to async
/// code, so we need to be careful.)
pub(crate) struct ChannelMap<C: AbstractChannel> {
pub(crate) struct MgrState<C: AbstractChannel> {
/// The data, within a lock
inner: std::sync::Mutex<Inner<C>>,
}
@ -221,7 +221,7 @@ impl<C: AbstractChannel> ChannelState<C> {
}
}
impl<C: AbstractChannel> ChannelMap<C> {
impl<C: AbstractChannel> MgrState<C> {
/// Create a new empty ChannelMap.
pub(crate) fn new(
config: ChannelConfig,
@ -234,7 +234,7 @@ impl<C: AbstractChannel> ChannelMap<C> {
.unwrap_or_else(|e: tor_error::Bug| panic!("bug detected on startup: {:?}", e));
let _: Option<_> = update; // there are no channels yet, that would need to be told
ChannelMap {
MgrState {
inner: std::sync::Mutex::new(Inner {
channels: ByRelayIds::new(),
config,
@ -517,8 +517,8 @@ mod test {
use tor_llcrypto::pk::ed25519::Ed25519Identity;
use tor_proto::channel::params::ChannelPaddingInstructionsUpdates;
fn new_test_channel_map<C: AbstractChannel>() -> ChannelMap<C> {
ChannelMap::new(
fn new_test_channel_map<C: AbstractChannel>() -> MgrState<C> {
MgrState::new(
ChannelConfig::default(),
Default::default(),
&Default::default(),