queue declare

This commit is contained in:
nora 2022-02-26 21:55:17 +01:00
parent 606438f301
commit 8532d454c3
13 changed files with 255 additions and 71 deletions

View file

@ -25,6 +25,8 @@ impl Default for GlobalData {
inner: Arc::new(Mutex::new(GlobalDataInner {
connections: HashMap::new(),
channels: HashMap::new(),
queues: HashMap::new(),
default_exchange: HashMap::new(),
})),
}
}
@ -40,6 +42,9 @@ impl GlobalData {
pub struct GlobalDataInner {
pub connections: HashMap<Uuid, ConnectionHandle>,
pub channels: HashMap<Uuid, ChannelHandle>,
pub queues: HashMap<Uuid, Queue>,
/// Todo: This is just for testing and will be removed later!
pub default_exchange: HashMap<String, Queue>,
}
pub type ConnectionHandle = Handle<Connection>;
@ -104,3 +109,14 @@ impl Channel {
global_data.channels.remove(&self.id);
}
}
pub fn gen_uuid() -> Uuid {
Uuid::from_bytes(rand::random())
}
#[macro_export]
macro_rules! amqp_todo {
() => {
return Err(::amqp_core::error::ConException::NotImplemented.into())
};
}

View file

@ -12,6 +12,7 @@ pub struct RawQueue {
pub name: String,
pub messages: Mutex<Vec<Message>>, // use a concurrent linked list???
pub durable: bool,
pub exclusive: Option<Uuid>,
/// Whether the queue will automatically be deleted when no consumers uses it anymore.
/// The queue can always be manually deleted.
/// If auto-delete is enabled, it keeps track of the consumer count.