@@ -19,8 +19,8 @@ use std::{fmt, ops};
1919
2020use crate :: commons:: {
2121 BindingDestinationType , ChannelId , MessageTransferAcknowledgementMode , OverflowBehavior ,
22- PolicyTarget , QueueType , SupportedProtocol , Username , VirtualHostName , X_ARGUMENT_KEY_X_OVERFLOW ,
23- X_ARGUMENT_KEY_X_QUEUE_TYPE ,
22+ PolicyTarget , QueueType , SupportedProtocol , Username , VirtualHostName ,
23+ X_ARGUMENT_KEY_X_OVERFLOW , X_ARGUMENT_KEY_X_QUEUE_TYPE ,
2424} ;
2525use crate :: error:: ConversionError ;
2626use crate :: formatting:: * ;
@@ -979,6 +979,184 @@ pub struct QueueInfo {
979979 pub unacknowledged_message_count : u64 ,
980980}
981981
982+ /// Represents detailed queue information with extended metrics and garbage collection details.
983+ /// This is an enhanced version of `QueueInfo` that includes additional fields from the detailed queues endpoint.
984+ #[ derive( Debug , Deserialize , Clone ) ]
985+ #[ cfg_attr( feature = "tabled" , derive( Tabled ) ) ]
986+ #[ allow( dead_code) ]
987+ pub struct DetailedQueueInfo {
988+ pub name : String ,
989+ pub vhost : VirtualHostName ,
990+ #[ serde( rename( deserialize = "type" ) ) ]
991+ pub queue_type : String ,
992+ pub durable : bool ,
993+ pub auto_delete : bool ,
994+ pub exclusive : bool ,
995+ #[ cfg_attr( feature = "tabled" , tabled( display = "display_arg_table" ) ) ]
996+ pub arguments : XArguments ,
997+
998+ #[ serde( default = "undefined" ) ]
999+ pub node : String ,
1000+ #[ serde( default ) ]
1001+ pub state : String ,
1002+ // only quorum queues and streams will have this
1003+ #[ cfg_attr( feature = "tabled" , tabled( display = "display_option" ) ) ]
1004+ pub leader : Option < String > ,
1005+ #[ cfg_attr( feature = "tabled" , tabled( display = "display_option" ) ) ]
1006+ pub members : Option < NodeList > ,
1007+ #[ cfg_attr( feature = "tabled" , tabled( display = "display_option" ) ) ]
1008+ pub online : Option < NodeList > ,
1009+
1010+ #[ serde( default ) ]
1011+ pub memory : u64 ,
1012+ #[ serde( rename( deserialize = "consumers" ) ) ]
1013+ #[ serde( default ) ]
1014+ pub consumer_count : u16 ,
1015+ #[ serde( default ) ]
1016+ pub consumer_utilisation : f32 ,
1017+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1018+ pub exclusive_consumer_tag : Option < String > ,
1019+
1020+ #[ cfg_attr( feature = "tabled" , tabled( display = "display_option" ) ) ]
1021+ pub policy : Option < String > ,
1022+
1023+ #[ serde( default ) ]
1024+ pub message_bytes : u64 ,
1025+ #[ serde( default ) ]
1026+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1027+ pub message_bytes_persistent : u64 ,
1028+ #[ serde( default ) ]
1029+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1030+ pub message_bytes_ram : u64 ,
1031+ #[ serde( default ) ]
1032+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1033+ pub message_bytes_ready : u64 ,
1034+ #[ serde( default ) ]
1035+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1036+ pub message_bytes_unacknowledged : u64 ,
1037+
1038+ #[ serde( rename( deserialize = "messages" ) ) ]
1039+ #[ serde( default ) ]
1040+ pub message_count : u64 ,
1041+ #[ serde( rename( deserialize = "messages_persistent" ) ) ]
1042+ #[ serde( default ) ]
1043+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1044+ pub on_disk_message_count : u64 ,
1045+ #[ serde( rename( deserialize = "messages_ram" ) ) ]
1046+ #[ serde( default ) ]
1047+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1048+ pub in_memory_message_count : u64 ,
1049+ #[ serde( rename( deserialize = "messages_unacknowledged" ) ) ]
1050+ #[ serde( default ) ]
1051+ pub unacknowledged_message_count : u64 ,
1052+
1053+ // Additional detailed fields
1054+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1055+ pub garbage_collection : Option < GarbageCollectionDetails > ,
1056+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1057+ pub io_batch_size : Option < u32 > ,
1058+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1059+ pub io_batch_size_avg : Option < f64 > ,
1060+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1061+ pub io_batch_size_details : Option < Rate > ,
1062+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1063+ pub io_file_handle_open_attempt_avg_time : Option < f64 > ,
1064+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1065+ pub io_file_handle_open_attempt_avg_time_details : Option < Rate > ,
1066+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1067+ pub io_read_avg_time : Option < f64 > ,
1068+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1069+ pub io_read_avg_time_details : Option < Rate > ,
1070+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1071+ pub io_read_bytes : Option < u64 > ,
1072+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1073+ pub io_read_bytes_details : Option < Rate > ,
1074+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1075+ pub io_read_count : Option < u64 > ,
1076+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1077+ pub io_read_count_details : Option < Rate > ,
1078+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1079+ pub io_reopen_count : Option < u64 > ,
1080+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1081+ pub io_reopen_count_details : Option < Rate > ,
1082+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1083+ pub io_seek_avg_time : Option < f64 > ,
1084+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1085+ pub io_seek_avg_time_details : Option < Rate > ,
1086+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1087+ pub io_seek_count : Option < u64 > ,
1088+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1089+ pub io_seek_count_details : Option < Rate > ,
1090+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1091+ pub io_sync_avg_time : Option < f64 > ,
1092+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1093+ pub io_sync_avg_time_details : Option < Rate > ,
1094+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1095+ pub io_sync_count : Option < u64 > ,
1096+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1097+ pub io_sync_count_details : Option < Rate > ,
1098+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1099+ pub io_write_avg_time : Option < f64 > ,
1100+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1101+ pub io_write_avg_time_details : Option < Rate > ,
1102+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1103+ pub io_write_bytes : Option < u64 > ,
1104+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1105+ pub io_write_bytes_details : Option < Rate > ,
1106+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1107+ pub io_write_count : Option < u64 > ,
1108+ #[ cfg_attr( feature = "tabled" , tabled( skip) ) ]
1109+ pub io_write_count_details : Option < Rate > ,
1110+ }
1111+
1112+ /// Garbage collection details for queue processes
1113+ #[ derive( Debug , Deserialize , Clone ) ]
1114+ #[ cfg_attr( feature = "tabled" , derive( Tabled ) ) ]
1115+ #[ allow( dead_code) ]
1116+ pub struct GarbageCollectionDetails {
1117+ pub fullsweep_after : u32 ,
1118+ pub max_heap_size : u32 ,
1119+ pub min_bin_vheap_size : u32 ,
1120+ pub min_heap_size : u32 ,
1121+ pub minor_gcs : u32 ,
1122+ }
1123+
1124+ impl QueueOps for DetailedQueueInfo {
1125+ fn name ( & self ) -> & str {
1126+ & self . name
1127+ }
1128+
1129+ fn queue_type ( & self ) -> QueueType {
1130+ QueueType :: from ( self . queue_type . as_str ( ) )
1131+ }
1132+
1133+ fn policy_target_type ( & self ) -> PolicyTarget {
1134+ PolicyTarget :: from ( self . queue_type ( ) )
1135+ }
1136+
1137+ fn x_arguments ( & self ) -> & XArguments {
1138+ & self . arguments
1139+ }
1140+ }
1141+
1142+ impl NamedPolicyTargetObject for DetailedQueueInfo {
1143+ fn vhost ( & self ) -> String {
1144+ self . vhost . clone ( )
1145+ }
1146+
1147+ fn name ( & self ) -> String {
1148+ self . name . clone ( )
1149+ }
1150+
1151+ fn policy_target ( & self ) -> PolicyTarget {
1152+ self . policy_target_type ( )
1153+ }
1154+
1155+ fn does_match ( & self , policy : & Policy ) -> bool {
1156+ policy. does_match_object ( self )
1157+ }
1158+ }
1159+
9821160impl QueueOps for QueueInfo {
9831161 fn name ( & self ) -> & str {
9841162 & self . name
0 commit comments