Skip to content

Commit

Permalink
CARL-API -> Deprecate device_interfaces field in OldPeerConfiguration.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfm committed Jan 13, 2025
1 parent dcfe41c commit 395fd44
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions opendut-carl/src/cluster/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ impl ClusterManager {
Err(DeployClusterError::Internal { cluster_id, cause: message })
}
};

#[expect(deprecated)]
vpn_address.map(|vpn_address|
PeerClusterAssignment { peer_id, vpn_address, can_server_port, device_interfaces }
)
Expand Down Expand Up @@ -548,6 +550,7 @@ mod test {
assert_that!(fixture.testee.lock().await.deploy_cluster(cluster_id).await, ok(eq(&())));


#[expect(deprecated)]
let assert_cluster_assignment_valid = |cluster_assignment: &ClusterAssignment| {
assert_that!(
cluster_assignment,
Expand Down
2 changes: 1 addition & 1 deletion opendut-types/proto/opendut/types/cluster/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ message PeerClusterAssignment {
opendut.types.peer.PeerId peer_id = 1;
opendut.types.util.IpAddress vpn_address = 2;
opendut.types.util.Port can_server_port = 3;
repeated opendut.types.util.NetworkInterfaceDescriptor device_interfaces = 4;
repeated opendut.types.util.NetworkInterfaceDescriptor device_interfaces = 4; //deprecated since 0.5.0
}
// ANCHOR_END: PeerClusterAssignment

Expand Down
1 change: 1 addition & 0 deletions opendut-types/src/cluster/assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ pub struct PeerClusterAssignment {
pub peer_id: PeerId,
pub vpn_address: IpAddr,
pub can_server_port: Port,
#[deprecated(since="0.5.0", note="Use PeerConfiguration::device_interfaces instead.")]
pub device_interfaces: Vec<NetworkInterfaceDescriptor>,
}
2 changes: 2 additions & 0 deletions opendut-types/src/proto/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ impl From<crate::cluster::PeerClusterAssignment> for PeerClusterAssignment {
peer_id: Some(value.peer_id.into()),
vpn_address: Some(value.vpn_address.into()),
can_server_port: Some(value.can_server_port.into()),
#[expect(deprecated)]
device_interfaces: value.device_interfaces.into_iter().map(Into::into).collect(),
}
}
Expand Down Expand Up @@ -253,6 +254,7 @@ impl TryFrom<PeerClusterAssignment> for crate::cluster::PeerClusterAssignment {
.map(TryInto::try_into)
.collect::<Result<_, _>>()?;

#[expect(deprecated)]
Ok(Self {
peer_id,
vpn_address,
Expand Down
4 changes: 4 additions & 0 deletions tests/src/peer_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ async fn carl_should_send_peer_configurations_in_happy_flow() -> anyhow::Result<
}));
Ok::<_, anyhow::Error>(())
};

#[expect(deprecated)]
let validate_old_peer_configuration = |old_peer_configuration: OldPeerConfiguration| {
assert_that!(old_peer_configuration, matches_pattern!(OldPeerConfiguration {
cluster_assignment: some(matches_pattern!(ClusterAssignment {
Expand Down Expand Up @@ -164,6 +166,8 @@ async fn carl_should_send_cluster_related_peer_configuration_if_a_peer_comes_onl
}));
Ok::<_, anyhow::Error>(())
};

#[expect(deprecated)]
let validate_old_peer_configuration = |old_peer_configuration: OldPeerConfiguration| {
assert_that!(old_peer_configuration, matches_pattern!(OldPeerConfiguration {
cluster_assignment: some(matches_pattern!(ClusterAssignment {
Expand Down

0 comments on commit 395fd44

Please sign in to comment.