Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove stuttering in names #160

Merged
merged 1 commit into from
Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dds/dp_event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl DPEventLoop {
fn handle_writer_acknack_action(&mut self, _event: &Event) {
while let Ok((acknack_sender_prefix, acknack_submessage)) = self.ack_nack_receiver.try_recv() {
let writer_guid = GUID::new_with_prefix_and_id(
self.domain_info.domain_participant_guid.guid_prefix,
self.domain_info.domain_participant_guid.prefix,
acknack_submessage.writer_id(),
);
if let Some(found_writer) = self.writers.get_mut(&writer_guid.entity_id) {
Expand All @@ -518,7 +518,7 @@ impl DPEventLoop {
info!(
"update_participant {:?} myself={}",
participant_guid_prefix,
participant_guid_prefix == self.domain_info.domain_participant_guid.guid_prefix
participant_guid_prefix == self.domain_info.domain_participant_guid.prefix
);

{
Expand Down
7 changes: 3 additions & 4 deletions src/dds/message_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ impl MessageReceiver {
}
}
InterpreterSubmessage::InfoDestination(info_dest, _flags) => {
if info_dest.guid_prefix == GUID::GUID_UNKNOWN.guid_prefix {
if info_dest.guid_prefix == GUID::GUID_UNKNOWN.prefix {
self.dest_guid_prefix = self.own_guid_prefix;
} else {
self.dest_guid_prefix = info_dest.guid_prefix;
Expand Down Expand Up @@ -483,7 +483,6 @@ mod tests {
EntityId::create_custom_entity_id([0, 0, 0], EntityKind::READER_WITH_KEY_USER_DEFINED);
let new_guid = GUID::new_with_prefix_and_id(gui_prefix, entity);

new_guid.from_prefix(entity);
let (send, _rec) = mio_channel::sync_channel::<()>(100);
let (status_sender, _status_receiver) =
mio_extras::channel::sync_channel::<DataReaderStatus>(100);
Expand Down Expand Up @@ -604,7 +603,7 @@ mod tests {
mio_channel::sync_channel::<(GuidPrefix, AckSubmessage)>(10);
let (spdp_liveness_sender, _spdp_liveness_receiver) = mio_channel::sync_channel(8);
let mut message_receiver =
MessageReceiver::new(guid_new.guid_prefix, acknack_sender, spdp_liveness_sender);
MessageReceiver::new(guid_new.prefix, acknack_sender, spdp_liveness_sender);

message_receiver.handle_received_packet(&udp_bits1);
assert_eq!(message_receiver.submessage_count, 4);
Expand All @@ -616,7 +615,7 @@ mod tests {
#[test]
fn mr_test_header() {
let guid_new = GUID::default();
let header = Header::new(guid_new.guid_prefix);
let header = Header::new(guid_new.prefix);

let bytes = header.write_to_vec().unwrap();
let new_header = Header::read_from_buffer(&bytes).unwrap();
Expand Down
8 changes: 4 additions & 4 deletions src/dds/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ pub mod data_types {
}

// DDS Error and Result types
pub use crate::dds::values::result::*;

pub use participant::DomainParticipant;
pub use topic::{Topic, TopicKind};
pub use pubsub::{Publisher, Subscriber};

pub use crate::dds::values::result::*;
// Discovery results
pub use crate::discovery::data_types::topic_data::{DiscoveredTopicData, SubscriptionBuiltinTopicData};

pub use crate::discovery::data_types::topic_data::{
DiscoveredTopicData, SubscriptionBuiltinTopicData,
};
4 changes: 2 additions & 2 deletions src/dds/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ impl DomainParticipantInner {
listeners,
dds_cache_clone,
disc_db_clone,
new_guid.guid_prefix,
new_guid.prefix,
TokenReceiverPair {
token: ADD_READER_TOKEN,
receiver: receiver_add_reader,
Expand Down Expand Up @@ -1120,7 +1120,7 @@ mod tests {
protocol_id: ProtocolId::default(),
protocol_version: ProtocolVersion { major: 2, minor: 3 },
vendor_id: VendorId::THIS_IMPLEMENTATION,
guid_prefix: GUID::default().guid_prefix,
guid_prefix: GUID::default().prefix,
};
m.set_header(h);
m.add_submessage(s);
Expand Down
2 changes: 1 addition & 1 deletion src/dds/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ impl InnerPublisher {
.ok_or("upgrade fail")
.or_else(|e| log_and_err_internal!("Where is my DomainParticipant? {}", e))?;

let guid = GUID::new_with_prefix_and_id(dp.guid().guid_prefix, entity_id);
let guid = GUID::new_with_prefix_and_id(dp.guid().prefix, entity_id);

let new_writer = WriterIngredients {
guid,
Expand Down
2 changes: 2 additions & 0 deletions src/dds/qos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub enum QosPolicyId {

/// Utility for building [QosPolicies]
#[derive(Default)]
#[must_use]
pub struct QosPolicyBuilder {
durability: Option<policy::Durability>,
presentation: Option<policy::Presentation>,
Expand Down Expand Up @@ -243,6 +244,7 @@ impl QosPolicies {
///
/// Constructs a QosPolicy, where each policy is taken from `self`,
/// and overwritten with those policies from `other` that are defined.
#[must_use]
pub fn modify_by(&self, other: &QosPolicies) -> QosPolicies {
QosPolicies {
durability: other.durability.or(self.durability),
Expand Down
20 changes: 10 additions & 10 deletions src/dds/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ impl Reader {
protocol_id: ProtocolId::default(),
protocol_version: ProtocolVersion::THIS_IMPLEMENTATION,
vendor_id: VendorId::THIS_IMPLEMENTATION,
guid_prefix: self.my_guid.guid_prefix,
guid_prefix: self.my_guid.prefix,
});

match info_dst.create_submessage(infodst_flags) {
Expand Down Expand Up @@ -952,7 +952,7 @@ impl Reader {
count: self.sent_ack_nack_count,
},
InfoDestination {
guid_prefix: writer_proxy.remote_writer_guid.guid_prefix,
guid_prefix: writer_proxy.remote_writer_guid.prefix,
},
&writer_proxy.unicast_locator_list,
);
Expand Down Expand Up @@ -1052,14 +1052,14 @@ mod tests {
);

let writer_guid = GUID {
guid_prefix: GuidPrefix::new(&[1; 12]),
prefix: GuidPrefix::new(&[1; 12]),
entity_id: EntityId::create_custom_entity_id(
[1; 3],
EntityKind::WRITER_WITH_KEY_USER_DEFINED,
),
};
let mr_state = MessageReceiverState {
source_guid_prefix: writer_guid.guid_prefix,
source_guid_prefix: writer_guid.prefix,
..Default::default()
};

Expand Down Expand Up @@ -1118,15 +1118,15 @@ mod tests {
);

let writer_guid = GUID {
guid_prefix: GuidPrefix::new(&[1; 12]),
prefix: GuidPrefix::new(&[1; 12]),
entity_id: EntityId::create_custom_entity_id(
[1; 3],
EntityKind::WRITER_WITH_KEY_USER_DEFINED,
),
};

let mr_state = MessageReceiverState {
source_guid_prefix: writer_guid.guid_prefix,
source_guid_prefix: writer_guid.prefix,
..Default::default()
};

Expand Down Expand Up @@ -1193,7 +1193,7 @@ mod tests {
);

let writer_guid = GUID {
guid_prefix: GuidPrefix::new(&[1; 12]),
prefix: GuidPrefix::new(&[1; 12]),
entity_id: EntityId::create_custom_entity_id(
[1; 3],
EntityKind::WRITER_WITH_KEY_USER_DEFINED,
Expand All @@ -1203,7 +1203,7 @@ mod tests {
let writer_id = writer_guid.entity_id;

let mr_state = MessageReceiverState {
source_guid_prefix: writer_guid.guid_prefix,
source_guid_prefix: writer_guid.prefix,
..Default::default()
};

Expand Down Expand Up @@ -1327,7 +1327,7 @@ mod tests {
);

let writer_guid = GUID {
guid_prefix: GuidPrefix::new(&[1; 12]),
prefix: GuidPrefix::new(&[1; 12]),
entity_id: EntityId::create_custom_entity_id(
[1; 3],
EntityKind::WRITER_WITH_KEY_USER_DEFINED,
Expand All @@ -1336,7 +1336,7 @@ mod tests {
let writer_id = writer_guid.entity_id;

let mr_state = MessageReceiverState {
source_guid_prefix: writer_guid.guid_prefix,
source_guid_prefix: writer_guid.prefix,
..Default::default()
};

Expand Down
10 changes: 5 additions & 5 deletions src/dds/with_key/datareader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,14 +1341,14 @@ mod tests {
let data_key = random_data.key();

let writer_guid = GUID {
guid_prefix: GuidPrefix::new(&[1; 12]),
prefix: GuidPrefix::new(&[1; 12]),
entity_id: EntityId::create_custom_entity_id(
[1; 3],
EntityKind::WRITER_WITH_KEY_USER_DEFINED,
),
};
let mr_state = MessageReceiverState {
source_guid_prefix: writer_guid.guid_prefix,
source_guid_prefix: writer_guid.prefix,
..Default::default()
};

Expand Down Expand Up @@ -1475,14 +1475,14 @@ mod tests {
.unwrap();

let writer_guid = GUID {
guid_prefix: GuidPrefix::new(&[1; 12]),
prefix: GuidPrefix::new(&[1; 12]),
entity_id: EntityId::create_custom_entity_id(
[1; 3],
EntityKind::WRITER_WITH_KEY_USER_DEFINED,
),
};
let mr_state = MessageReceiverState {
source_guid_prefix: writer_guid.guid_prefix,
source_guid_prefix: writer_guid.prefix,
..Default::default()
};
reader.matched_writer_add(
Expand Down Expand Up @@ -1720,7 +1720,7 @@ mod tests {
entity_id: EntityId::create_custom_entity_id([1; 3], EntityKind::WRITER_WITH_KEY_USER_DEFINED),
};
let mut mr_state = MessageReceiverState::default();
mr_state.source_guid_prefix = writer_guid.guid_prefix;
mr_state.source_guid_prefix = writer_guid.prefix;
reader.matched_writer_add(
writer_guid.clone(),
EntityId::UNKNOWN,
Expand Down
14 changes: 7 additions & 7 deletions src/dds/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,14 @@ impl Writer {
}

pub fn local_readers(&self) -> Vec<EntityId> {
let min = GUID::new_with_prefix_and_id(self.my_guid.guid_prefix, EntityId::MIN);
let max = GUID::new_with_prefix_and_id(self.my_guid.guid_prefix, EntityId::MAX);
let min = GUID::new_with_prefix_and_id(self.my_guid.prefix, EntityId::MIN);
let max = GUID::new_with_prefix_and_id(self.my_guid.prefix, EntityId::MAX);

self
.readers
.range((Included(min), Included(max)))
.filter_map(|(guid, _)| {
if guid.guid_prefix == self.my_guid.guid_prefix {
if guid.prefix == self.my_guid.prefix {
Some(guid.entity_id)
} else {
None
Expand Down Expand Up @@ -407,7 +407,7 @@ impl Writer {
let liveliness_flag = false;
let data_hb_message = data_hb_message_builder
.heartbeat_msg(self, EntityId::UNKNOWN, final_flag, liveliness_flag)
.add_header_and_build(self.my_guid.guid_prefix);
.add_header_and_build(self.my_guid.prefix);
self.send_message_to_readers(
DeliveryMode::Multicast,
&data_hb_message,
Expand Down Expand Up @@ -543,7 +543,7 @@ impl Writer {
let hb_message = MessageBuilder::new()
.ts_msg(self.endianness, Some(Timestamp::now()))
.heartbeat_msg(self, EntityId::UNKNOWN, final_flag, liveliness_flag)
.add_header_and_build(self.my_guid.guid_prefix);
.add_header_and_build(self.my_guid.prefix);
debug!(
"Writer {:?} topic={:} HEARTBEAT {:?}",
self.guid().entity_id,
Expand Down Expand Up @@ -698,7 +698,7 @@ impl Writer {
// Note: The reader_proxy is now removed from readers map
let reader_guid = reader_proxy.remote_reader_guid;
let mut partial_message = MessageBuilder::new()
.dst_submessage(self.endianness, reader_guid.guid_prefix)
.dst_submessage(self.endianness, reader_guid.prefix)
.ts_msg(self.endianness, Some(Timestamp::now()));
// TODO: This timestamp should probably not be
// the current (retransmit) time, but the initial sample production timestamp,
Expand Down Expand Up @@ -753,7 +753,7 @@ impl Writer {
partial_message =
partial_message.gap_msg(&BTreeSet::from_iter(no_longer_relevant), self, reader_guid);
}
let data_gap_msg = partial_message.add_header_and_build(self.my_guid.guid_prefix);
let data_gap_msg = partial_message.add_header_and_build(self.my_guid.prefix);

self.send_message_to_readers(
DeliveryMode::Unicast,
Expand Down
4 changes: 2 additions & 2 deletions src/discovery/data_types/spdp_participant_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl SpdpDiscoveredParticipantData {
entity_id: Option<EntityId>,
) -> RtpsReaderProxy {
let remote_reader_guid = GUID::new_with_prefix_and_id(
self.participant_guid.guid_prefix,
self.participant_guid.prefix,
match entity_id {
Some(id) => id,
None => EntityId::SPDP_BUILTIN_PARTICIPANT_READER,
Expand Down Expand Up @@ -89,7 +89,7 @@ impl SpdpDiscoveredParticipantData {
entity_id: Option<EntityId>,
) -> RtpsWriterProxy {
let remote_writer_guid = GUID::new_with_prefix_and_id(
self.participant_guid.guid_prefix,
self.participant_guid.prefix,
match entity_id {
Some(id) => id,
None => EntityId::SPDP_BUILTIN_PARTICIPANT_WRITER,
Expand Down
17 changes: 7 additions & 10 deletions src/discovery/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ impl Discovery {
// This will read the participant from Discovery DB and construct
// ReaderProxy and WriterProxy objects for built-in Readers and Writers
self.send_discovery_notification(DiscoveryNotificationType::ParticipantUpdated {
guid_prefix: dp.guid().guid_prefix,
guid_prefix: dp.guid().prefix,
});

// insert a (fake) reader proxy as multicast address, so discovery notifications
Expand Down Expand Up @@ -838,10 +838,7 @@ impl Discovery {
content_filter: None,
};

let writer_guid = GUID::new(
dp.guid().guid_prefix,
EntityId::SPDP_BUILTIN_PARTICIPANT_WRITER,
);
let writer_guid = GUID::new(dp.guid().prefix, EntityId::SPDP_BUILTIN_PARTICIPANT_WRITER);

let writer_proxy = WriterProxy::new(
writer_guid,
Expand Down Expand Up @@ -901,7 +898,7 @@ impl Discovery {
let was_new = self
.discovery_db_write()
.update_participant(&participant_data);
let guid_prefix = participant_data.participant_guid.guid_prefix;
let guid_prefix = participant_data.participant_guid.prefix;
self.send_discovery_notification(DiscoveryNotificationType::ParticipantUpdated {
guid_prefix,
});
Expand All @@ -917,12 +914,12 @@ impl Discovery {
}
}
// Err means that DomainParticipant was disposed
Err(guid) => {
Err(data_key) => {
self
.discovery_db_write()
.remove_participant(guid.0.guid_prefix);
.remove_participant(data_key.0.prefix);
self.send_discovery_notification(DiscoveryNotificationType::ParticipantLost {
guid_prefix: guid.0.guid_prefix,
guid_prefix: data_key.0.prefix,
});
}
},
Expand Down Expand Up @@ -961,7 +958,7 @@ impl Discovery {
let mut db = self.discovery_db_write();
trace!("handle_subscription_reader discovered {:?}", &d);
if read_history
.map(|e| e == d.reader_proxy.remote_reader_guid.guid_prefix)
.map(|e| e == d.reader_proxy.remote_reader_guid.prefix)
.unwrap_or(true)
{
if let Some((drd, rtps_reader_proxy)) = db.update_subscription(&d) {
Expand Down
Loading