Skip to content

Commit

Permalink
some terminology updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed Feb 12, 2024
1 parent 7990273 commit 6508a6d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion broker/src/handlers/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ where
let Ok((verification_key, topics)) =
BrokerAuth::<UserSignatureScheme, UserProtocolType>::verify_user(
&mut connection,
&self.identifier,
&self.identity,
&mut self.redis_client.clone(),
)
.await
Expand Down
10 changes: 6 additions & 4 deletions broker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct Inner<
UserProtocolType: Protocol,
> {
/// A broker identifier that we can use to establish uniqueness among brokers.
identifier: BrokerIdentifier,
identity: BrokerIdentifier,

/// The (clonable) `Redis` client that we will use to maintain consistency between brokers and marshals
redis_client: redis::Client,
Expand All @@ -66,6 +66,8 @@ struct Inner<
/// against the stake table.
keypair: KeyPair<BrokerSignatureScheme>,

/// The set of all broker identities we see. Mapped against the brokers we see in `Redis`
/// so that we don't connect multiple times.
connected_broker_identities: RwLock<HashSet<BrokerIdentifier>>,

/// A map of interests to their possible broker connections. We use this to facilitate
Expand Down Expand Up @@ -137,14 +139,14 @@ where
} = config;

// Create a unique broker identifier
let identifier = BrokerIdentifier {
let identity = BrokerIdentifier {
user_advertise_address,
broker_advertise_address,
};

// Create the `Redis` client we will use to maintain consistency
let redis_client = bail!(
redis::Client::new(redis_endpoint, Some(identifier.clone()),).await,
redis::Client::new(redis_endpoint, Some(identity.clone()),).await,
Parse,
"failed to create Redis client"
);
Expand Down Expand Up @@ -181,7 +183,7 @@ where
Ok(Self {
inner: Arc::from(Inner {
redis_client,
identifier,
identity,
keypair,
connected_broker_identities: RwLock::default(),
broker_connection_lookup: RwLock::default(),
Expand Down
2 changes: 1 addition & 1 deletion proto/src/connection/auth/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ macro_rules! verify_broker {
// Verify the other broker's authentication
if let Err(err) = BrokerAuth::<BrokerSignatureScheme, BrokerProtocolType>::verify_broker(
&mut $connection,
&$inner.identifier,
&$inner.identity,
&$inner.keypair.verification_key,
)
.await
Expand Down
4 changes: 2 additions & 2 deletions proto/src/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Client {
///
/// # Errors
/// - If we couldn't parse the `Redis` endpoint
pub async fn new(endpoint: String, identifier: Option<BrokerIdentifier>) -> Result<Self> {
pub async fn new(endpoint: String, identity: Option<BrokerIdentifier>) -> Result<Self> {
// Parse the `Redis` URL, creating a `redis-rs` client from it.
let client = bail!(
redis::Client::open(endpoint),
Expand All @@ -42,7 +42,7 @@ impl Client {

// Use the supplied identifier or a blank one, if we don't need/want one.
// We only "need" the identifier if we want to register with Redis
let identifier = identifier.map_or_else(
let identifier = identity.map_or_else(
|| BrokerIdentifier {
user_advertise_address: String::new(),
broker_advertise_address: String::new(),
Expand Down

0 comments on commit 6508a6d

Please sign in to comment.