Able to create new documents.
This commit is contained in:
parent
3b641e7c28
commit
1572e2f86a
235
src/message.rs
235
src/message.rs
@ -1,4 +1,3 @@
|
|||||||
use crate::field::Field;
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
sync::{
|
sync::{
|
||||||
@ -19,13 +18,29 @@ enum MTTError {
|
|||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||||
enum Action {
|
enum Action {
|
||||||
Create,
|
Create,
|
||||||
|
Query,
|
||||||
//
|
//
|
||||||
NewDocumentType,
|
NewDocumentType,
|
||||||
Query,
|
|
||||||
Reply,
|
Reply,
|
||||||
Update,
|
Update,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<MsgAction> for Action {
|
||||||
|
fn from(value: MsgAction) -> Self {
|
||||||
|
match value {
|
||||||
|
MsgAction::Create(_) => Action::Create,
|
||||||
|
MsgAction::Query(_) => Action::Query,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&MsgAction> for Action {
|
||||||
|
fn from(value: &MsgAction) -> Self {
|
||||||
|
let action = value.clone();
|
||||||
|
Self::from(action)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||||
enum NameID {
|
enum NameID {
|
||||||
ID(Uuid),
|
ID(Uuid),
|
||||||
@ -56,16 +71,21 @@ impl From<&NameID> for NameID {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
enum MsgAction {
|
||||||
|
Create(DocDef),
|
||||||
|
Query(Access),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Message {
|
struct Message {
|
||||||
msg_id: Uuid,
|
msg_id: Uuid,
|
||||||
document_id: NameID,
|
document_id: NameID,
|
||||||
action: Action,
|
action: MsgAction,
|
||||||
//instructions: ?,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Message {
|
impl Message {
|
||||||
fn new<D>(doc_id: D, action: Action) -> Self
|
fn new<D>(doc_id: D, action: MsgAction) -> Self
|
||||||
where
|
where
|
||||||
D: Into<NameID>,
|
D: Into<NameID>,
|
||||||
{
|
{
|
||||||
@ -84,7 +104,7 @@ impl Message {
|
|||||||
&self.document_id
|
&self.document_id
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_action(&self) -> &Action {
|
fn get_action(&self) -> &MsgAction {
|
||||||
&self.action
|
&self.action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,12 +117,15 @@ mod messages {
|
|||||||
fn can_the_document_be_a_stringi_reference() {
|
fn can_the_document_be_a_stringi_reference() {
|
||||||
let dts = ["one", "two"];
|
let dts = ["one", "two"];
|
||||||
for document in dts.into_iter() {
|
for document in dts.into_iter() {
|
||||||
let msg = Message::new(document, Action::NewDocumentType);
|
let msg = Message::new(document, MsgAction::Create(DocDef::new()));
|
||||||
match msg.get_document_id() {
|
match msg.get_document_id() {
|
||||||
NameID::ID(_) => unreachable!("should have been a string id"),
|
NameID::ID(_) => unreachable!("should have been a string id"),
|
||||||
NameID::Name(data) => assert_eq!(data, document),
|
NameID::Name(data) => assert_eq!(data, document),
|
||||||
}
|
}
|
||||||
assert_eq!(msg.get_action(), &Action::NewDocumentType);
|
match msg.get_action() {
|
||||||
|
MsgAction::Create(_) => {}
|
||||||
|
_ => unreachable!("should have been a create document"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,31 +133,37 @@ mod messages {
|
|||||||
fn can_the_document_be_a_string() {
|
fn can_the_document_be_a_string() {
|
||||||
let dts = ["one".to_string(), "two".to_string()];
|
let dts = ["one".to_string(), "two".to_string()];
|
||||||
for document in dts.into_iter() {
|
for document in dts.into_iter() {
|
||||||
let msg = Message::new(document.clone(), Action::Update);
|
let msg = Message::new(document.clone(), MsgAction::Query(Access::new()));
|
||||||
match msg.get_document_id() {
|
match msg.get_document_id() {
|
||||||
NameID::ID(_) => unreachable!("should have been a string id"),
|
NameID::ID(_) => unreachable!("should have been a string id"),
|
||||||
NameID::Name(data) => assert_eq!(data, &document),
|
NameID::Name(data) => assert_eq!(data, &document),
|
||||||
}
|
}
|
||||||
assert_eq!(msg.get_action(), &Action::Update);
|
match msg.get_action() {
|
||||||
|
MsgAction::Query(_) => {}
|
||||||
|
_ => unreachable!("should have been an access query"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_the_document_be_an_id() {
|
fn can_the_document_be_an_id() {
|
||||||
let document = Uuid::new_v4();
|
let document = Uuid::new_v4();
|
||||||
let msg = Message::new(document.clone(), Action::Query);
|
let msg = Message::new(document.clone(), MsgAction::Query(Access::new()));
|
||||||
match msg.get_document_id() {
|
match msg.get_document_id() {
|
||||||
NameID::ID(data) => assert_eq!(data, &document),
|
NameID::ID(data) => assert_eq!(data, &document),
|
||||||
NameID::Name(_) => unreachable!("should have been an id"),
|
NameID::Name(_) => unreachable!("should have been an id"),
|
||||||
}
|
}
|
||||||
assert_eq!(msg.action, Action::Query);
|
match msg.get_action() {
|
||||||
|
MsgAction::Query(_) => {}
|
||||||
|
_ => unreachable!("should have been an access query"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn is_the_message_id_random() {
|
fn is_the_message_id_random() {
|
||||||
let mut ids: Vec<Uuid> = Vec::new();
|
let mut ids: Vec<Uuid> = Vec::new();
|
||||||
for _ in 0..5 {
|
for _ in 0..5 {
|
||||||
let msg = Message::new("tester", Action::NewDocumentType);
|
let msg = Message::new("tester", MsgAction::Create(DocDef::new()));
|
||||||
let id = msg.get_message_id().clone();
|
let id = msg.get_message_id().clone();
|
||||||
assert!(!ids.contains(&id), "{:?} containts {}", ids, id);
|
assert!(!ids.contains(&id), "{:?} containts {}", ids, id);
|
||||||
ids.push(id);
|
ids.push(id);
|
||||||
@ -185,23 +214,23 @@ struct RouteID {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<Route> for RouteID {
|
impl From<Route> for RouteID {
|
||||||
fn from(value: Route) -> Self {
|
fn from(value: Route) -> Self {
|
||||||
Self {
|
Self {
|
||||||
action: match value.action {
|
action: match value.action {
|
||||||
Include::All => None,
|
Include::All => None,
|
||||||
Include::Some(action) => Some(action.clone()),
|
Include::Some(action) => Some(action.clone()),
|
||||||
},
|
},
|
||||||
doc_type: match value.doc_type {
|
doc_type: match value.doc_type {
|
||||||
Include::All => None,
|
Include::All => None,
|
||||||
Include::Some(doc) => Some(doc.clone()),
|
Include::Some(doc) => Some(doc.clone()),
|
||||||
},
|
},
|
||||||
msg_id: match value.msg_id{
|
msg_id: match value.msg_id {
|
||||||
Include::All => None,
|
Include::All => None,
|
||||||
Include::Some(id) => Some(id.clone()),
|
Include::Some(id) => Some(id.clone()),
|
||||||
},
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
struct Route {
|
struct Route {
|
||||||
@ -211,8 +240,7 @@ struct Route {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Route {
|
impl Route {
|
||||||
fn new(msg_id: Include<Uuid>, doc: Include<Uuid>, action: Include<Action>) -> Self
|
fn new(msg_id: Include<Uuid>, doc: Include<Uuid>, action: Include<Action>) -> Self {
|
||||||
{
|
|
||||||
Self {
|
Self {
|
||||||
action: action,
|
action: action,
|
||||||
doc_type: doc,
|
doc_type: doc,
|
||||||
@ -243,7 +271,7 @@ impl From<RouteID> for Route {
|
|||||||
impl From<&RouteID> for Route {
|
impl From<&RouteID> for Route {
|
||||||
fn from(value: &RouteID) -> Self {
|
fn from(value: &RouteID) -> Self {
|
||||||
Self {
|
Self {
|
||||||
action: match &value.action {
|
action: match &value.action {
|
||||||
Some(data) => Include::Some(data.clone()),
|
Some(data) => Include::Some(data.clone()),
|
||||||
None => Include::All,
|
None => Include::All,
|
||||||
},
|
},
|
||||||
@ -286,19 +314,19 @@ mod roiutes {
|
|||||||
#[test]
|
#[test]
|
||||||
fn can_route_set_document_by_name() {
|
fn can_route_set_document_by_name() {
|
||||||
let doc_id = Uuid::new_v4();
|
let doc_id = Uuid::new_v4();
|
||||||
let route = Route::new(Include::All, Include::Some(doc_id.clone()), Include::All);
|
let route = Route::new(Include::All, Include::Some(doc_id.clone()), Include::All);
|
||||||
match route.msg_id {
|
match route.msg_id {
|
||||||
Include::All => {}
|
Include::All => {}
|
||||||
Include::Some(_) => unreachable!("should have been all"),
|
Include::Some(_) => unreachable!("should have been all"),
|
||||||
}
|
}
|
||||||
match route.doc_type {
|
match route.doc_type {
|
||||||
Include::All => unreachable!("should be a specific value"),
|
Include::All => unreachable!("should be a specific value"),
|
||||||
Include::Some(result) => assert_eq!(result, doc_id),
|
Include::Some(result) => assert_eq!(result, doc_id),
|
||||||
}
|
}
|
||||||
match route.action {
|
match route.action {
|
||||||
Include::All => {}
|
Include::All => {}
|
||||||
Include::Some(_) => unreachable!("should have been all"),
|
Include::Some(_) => unreachable!("should have been all"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -389,14 +417,19 @@ impl QueueData {
|
|||||||
let doc_id: Include<Uuid> = match self.get_doc_id(msg.get_document_id()) {
|
let doc_id: Include<Uuid> = match self.get_doc_id(msg.get_document_id()) {
|
||||||
Ok(id) => Include::Some(id.clone()),
|
Ok(id) => Include::Some(id.clone()),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
if msg.get_action() == &Action::Create {
|
let action: Action = msg.get_action().into();
|
||||||
|
if action == Action::Create {
|
||||||
Include::Some(Uuid::nil())
|
Include::Some(Uuid::nil())
|
||||||
} else {
|
} else {
|
||||||
return Err(err)
|
return Err(err);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
let route = Route::new(Include::Some(msg.get_message_id().clone()), doc_id, Include::Some(msg.get_action().clone()));
|
let route = Route::new(
|
||||||
|
Include::Some(msg.get_message_id().clone()),
|
||||||
|
doc_id,
|
||||||
|
Include::Some(msg.get_action().into()),
|
||||||
|
);
|
||||||
for (send_route, send_ids) in self.routes.iter() {
|
for (send_route, send_ids) in self.routes.iter() {
|
||||||
if route == send_route.into() {
|
if route == send_route.into() {
|
||||||
for send_id in send_ids {
|
for send_id in send_ids {
|
||||||
@ -452,11 +485,11 @@ mod queuedatas {
|
|||||||
let mut queuedata = QueueData::new();
|
let mut queuedata = QueueData::new();
|
||||||
let id = queuedata.register(name.clone(), tx).unwrap();
|
let id = queuedata.register(name.clone(), tx).unwrap();
|
||||||
queuedata.add_route(&id, Include::Some(name.clone()), action);
|
queuedata.add_route(&id, Include::Some(name.clone()), action);
|
||||||
let msg = Message::new(name.clone(), Action::Query);
|
let msg = Message::new(name.clone(), MsgAction::Query(Access::new()));
|
||||||
queuedata.send(msg.clone()).unwrap();
|
queuedata.send(msg.clone()).unwrap();
|
||||||
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
||||||
assert_eq!(result.get_message_id(), msg.get_message_id());
|
assert_eq!(result.get_message_id(), msg.get_message_id());
|
||||||
let msg = Message::new(id.clone(), Action::Query);
|
let msg = Message::new(id.clone(), MsgAction::Query(Access::new()));
|
||||||
queuedata.send(msg.clone()).unwrap();
|
queuedata.send(msg.clone()).unwrap();
|
||||||
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
||||||
assert_eq!(result.get_message_id(), msg.get_message_id());
|
assert_eq!(result.get_message_id(), msg.get_message_id());
|
||||||
@ -466,7 +499,7 @@ mod queuedatas {
|
|||||||
fn does_a_bad_document_name_fail() {
|
fn does_a_bad_document_name_fail() {
|
||||||
let docname = Uuid::new_v4().to_string();
|
let docname = Uuid::new_v4().to_string();
|
||||||
let queuedata = QueueData::new();
|
let queuedata = QueueData::new();
|
||||||
let msg = Message::new(docname.clone(), Action::Query);
|
let msg = Message::new(docname.clone(), MsgAction::Query(Access::new()));
|
||||||
match queuedata.send(msg) {
|
match queuedata.send(msg) {
|
||||||
Ok(_) => unreachable!("should have been an error"),
|
Ok(_) => unreachable!("should have been an error"),
|
||||||
Err(data) => match data {
|
Err(data) => match data {
|
||||||
@ -498,7 +531,7 @@ mod queuedatas {
|
|||||||
let name = "something";
|
let name = "something";
|
||||||
let (tx, _) = channel();
|
let (tx, _) = channel();
|
||||||
queuedata.register(name.to_string(), tx).unwrap();
|
queuedata.register(name.to_string(), tx).unwrap();
|
||||||
let msg = Message::new("something", Action::NewDocumentType);
|
let msg = Message::new("something", MsgAction::Create(DocDef::new()));
|
||||||
match queuedata.send(msg) {
|
match queuedata.send(msg) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(err) => unreachable!("got {:?}: should not error", err),
|
Err(err) => unreachable!("got {:?}: should not error", err),
|
||||||
@ -512,11 +545,11 @@ mod queuedatas {
|
|||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
let id = queuedata.register(doctype.to_string(), tx).unwrap();
|
let id = queuedata.register(doctype.to_string(), tx).unwrap();
|
||||||
queuedata.add_route(&id, Include::Some(doctype.to_string()), Action::Query);
|
queuedata.add_route(&id, Include::Some(doctype.to_string()), Action::Query);
|
||||||
let msg = Message::new(doctype, Action::Query);
|
let msg = Message::new(doctype, MsgAction::Query(Access::new()));
|
||||||
queuedata.send(msg.clone()).unwrap();
|
queuedata.send(msg.clone()).unwrap();
|
||||||
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
||||||
assert_eq!(result.get_message_id(), msg.get_message_id());
|
assert_eq!(result.get_message_id(), msg.get_message_id());
|
||||||
let msg = Message::new(doctype, Action::Reply);
|
let msg = Message::new(doctype, MsgAction::Query(Access::new()));
|
||||||
match rx.recv_timeout(TIMEOUT) {
|
match rx.recv_timeout(TIMEOUT) {
|
||||||
Ok(_) => unreachable!("should timeout"),
|
Ok(_) => unreachable!("should timeout"),
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
@ -531,13 +564,21 @@ mod queuedatas {
|
|||||||
let mut queuedata = QueueData::new();
|
let mut queuedata = QueueData::new();
|
||||||
let name1 = "task";
|
let name1 = "task";
|
||||||
let name2 = "work";
|
let name2 = "work";
|
||||||
let action = Action::Query;
|
let action = MsgAction::Query(Access::new());
|
||||||
let (tx1, rx1) = channel();
|
let (tx1, rx1) = channel();
|
||||||
let (tx2, rx2) = channel();
|
let (tx2, rx2) = channel();
|
||||||
let id1 = queuedata.register(name1.to_string(), tx1).unwrap();
|
let id1 = queuedata.register(name1.to_string(), tx1).unwrap();
|
||||||
let id2 = queuedata.register(name2.to_string(), tx2).unwrap();
|
let id2 = queuedata.register(name2.to_string(), tx2).unwrap();
|
||||||
queuedata.add_route(&id1, Include::Some(name1.to_string()), action.clone());
|
queuedata.add_route(
|
||||||
queuedata.add_route(&id2, Include::Some(name1.to_string()), action.clone());
|
&id1,
|
||||||
|
Include::Some(name1.to_string()),
|
||||||
|
action.clone().into(),
|
||||||
|
);
|
||||||
|
queuedata.add_route(
|
||||||
|
&id2,
|
||||||
|
Include::Some(name1.to_string()),
|
||||||
|
action.clone().into(),
|
||||||
|
);
|
||||||
let msg = Message::new(name1, action.clone());
|
let msg = Message::new(name1, action.clone());
|
||||||
queuedata.send(msg.clone()).unwrap();
|
queuedata.send(msg.clone()).unwrap();
|
||||||
let result1 = rx1.recv_timeout(TIMEOUT).unwrap();
|
let result1 = rx1.recv_timeout(TIMEOUT).unwrap();
|
||||||
@ -550,11 +591,11 @@ mod queuedatas {
|
|||||||
fn can_a_route_be_generally_set() {
|
fn can_a_route_be_generally_set() {
|
||||||
let mut queuedata = QueueData::new();
|
let mut queuedata = QueueData::new();
|
||||||
let doctype = "something";
|
let doctype = "something";
|
||||||
let action = Action::Query;
|
let action = MsgAction::Query(Access::new());
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
let id = queuedata.register(doctype.to_string(), tx).unwrap();
|
let id = queuedata.register(doctype.to_string(), tx).unwrap();
|
||||||
let data: Include<String> = Include::All;
|
let data: Include<String> = Include::All;
|
||||||
queuedata.add_route(&id, data, action.clone());
|
queuedata.add_route(&id, data, action.clone().into());
|
||||||
let msg = Message::new(doctype, action);
|
let msg = Message::new(doctype, action);
|
||||||
queuedata.send(msg.clone()).unwrap();
|
queuedata.send(msg.clone()).unwrap();
|
||||||
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
||||||
@ -608,6 +649,59 @@ mod queues {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct CreateDoc {
|
||||||
|
queue: Queue,
|
||||||
|
rx: Receiver<Message>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CreateDoc {
|
||||||
|
fn new(queue: Queue, rx: Receiver<Message>) -> Self {
|
||||||
|
Self {
|
||||||
|
queue: queue,
|
||||||
|
rx: rx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn start(mut queue: Queue) {
|
||||||
|
let (tx, rx) = channel();
|
||||||
|
let id = queue.register("document".to_string(), tx).unwrap();
|
||||||
|
let nameid: Include<NameID> = Include::All;
|
||||||
|
queue.add_route(&id, nameid, Action::Create);
|
||||||
|
let doc = CreateDoc::new(queue, rx);
|
||||||
|
spawn(move || {
|
||||||
|
doc.listen();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn listen(&self) {
|
||||||
|
loop {
|
||||||
|
let msg = self.rx.recv().unwrap();
|
||||||
|
match msg.get_document_id() {
|
||||||
|
NameID::Name(name) => Document::start(self.queue.clone(), name.clone()),
|
||||||
|
NameID::ID(_) => unreachable!("should be a name"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct DocDef;
|
||||||
|
|
||||||
|
impl DocDef {
|
||||||
|
fn new() -> Self {
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct Access;
|
||||||
|
|
||||||
|
impl Access {
|
||||||
|
fn new() -> Self {
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct Document {
|
struct Document {
|
||||||
queue: Queue,
|
queue: Queue,
|
||||||
rx: Receiver<Message>,
|
rx: Receiver<Message>,
|
||||||
@ -621,9 +715,9 @@ impl Document {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start(mut queue: Queue) {
|
fn start(mut queue: Queue, name: String) {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
queue.register("document".to_string(), tx);
|
queue.register(name, tx);
|
||||||
let doc = Document::new(queue, rx);
|
let doc = Document::new(queue, rx);
|
||||||
spawn(move || {
|
spawn(move || {
|
||||||
doc.listen();
|
doc.listen();
|
||||||
@ -638,24 +732,19 @@ impl Document {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod documents {
|
mod createdocs {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::{thread::sleep, time::Duration};
|
||||||
|
|
||||||
//#[test]
|
#[test]
|
||||||
fn create_document_creation() {
|
fn create_document_creation() {
|
||||||
let queue = Queue::new();
|
let queue = Queue::new();
|
||||||
Document::start(queue.clone());
|
CreateDoc::start(queue.clone());
|
||||||
let name = "project";
|
let name = "project";
|
||||||
let msg = Message::new(name, Action::Create);
|
let msg = Message::new(name, MsgAction::Create(DocDef::new()));
|
||||||
queue.send(msg).unwrap();
|
queue.send(msg).unwrap();
|
||||||
let msg2 = Message::new(name, Action::Query);
|
sleep(Duration::from_secs(1));
|
||||||
|
let msg2 = Message::new(name, MsgAction::Query(Access::new()));
|
||||||
queue.send(msg2).unwrap();
|
queue.send(msg2).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a double hash map. posswible names that leads to an id that is int eh ids
|
|
||||||
// \and the second is the id and the sender to be used.and a third for who wants to
|
|
||||||
// listen to what.
|
|
||||||
//
|
|
||||||
// The queue has a read write lock on the abbove strucutee. A clone of this is given to
|
|
||||||
// every process.
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user