moved path to router.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
parent
fd9754d224
commit
7cfc982be9
@ -5,12 +5,12 @@ mod router;
|
||||
|
||||
use message::{
|
||||
Action, Addition, CalcValue, Calculation, Clock, CreateDoc, Field, FieldType, Message, Operand,
|
||||
Path, Queue, RegMsg, Register, Session,
|
||||
Queue, RegMsg, Register, Session,
|
||||
};
|
||||
pub use message::{MsgAction, Query};
|
||||
use mtterror::MTTError;
|
||||
use name::{Name, NameType};
|
||||
use router::Include;
|
||||
use router::{Include, Path};
|
||||
use std::sync::mpsc::{channel, Receiver};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use super::MTTError;
|
||||
use crate::{
|
||||
name::{Name, NameType, Names},
|
||||
router::Include,
|
||||
router::{Include, Path},
|
||||
};
|
||||
use chrono::prelude::*;
|
||||
use std::{
|
||||
@ -66,48 +66,6 @@ impl From<&MsgAction> for Action {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
enum NameID {
|
||||
ID(Uuid),
|
||||
Name(String),
|
||||
None,
|
||||
}
|
||||
|
||||
impl NameID {
|
||||
fn is_none(&self) -> bool {
|
||||
match self {
|
||||
Self::None => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for NameID {
|
||||
fn from(value: &str) -> Self {
|
||||
Self::Name(value.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for NameID {
|
||||
fn from(value: String) -> Self {
|
||||
Self::Name(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Uuid> for NameID {
|
||||
fn from(value: Uuid) -> Self {
|
||||
Self::ID(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&NameID> for NameID {
|
||||
fn from(value: &NameID) -> Self {
|
||||
value.clone()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum MsgAction {
|
||||
Addition(Addition),
|
||||
@ -532,23 +490,6 @@ mod route_ids {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Path {
|
||||
pub msg_id: Include<Uuid>,
|
||||
pub doc: Include<NameType>,
|
||||
pub action: Include<Action>,
|
||||
}
|
||||
|
||||
impl Path {
|
||||
pub fn new(id: Include<Uuid>, doc: Include<NameType>, action: Include<Action>) -> Self {
|
||||
Self {
|
||||
msg_id: id,
|
||||
doc: doc,
|
||||
action: action,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum RegMsg {
|
||||
AddRoute(Path),
|
||||
@ -744,25 +685,6 @@ mod routes {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
struct RouteRequest {
|
||||
msg_id: Include<Uuid>,
|
||||
doc_name: Include<String>,
|
||||
action: Include<Action>,
|
||||
}
|
||||
|
||||
impl RouteRequest {
|
||||
fn new(msg_id: Include<Uuid>, doc_name: Include<String>, action: Include<Action>) -> Self {
|
||||
Self {
|
||||
msg_id: msg_id,
|
||||
doc_name: doc_name,
|
||||
action: action,
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
struct RouteStorage {
|
||||
data: HashMap<RouteID, HashSet<Uuid>>,
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
message::{Path, Route},
|
||||
message::Route,
|
||||
mtterror::MTTError,
|
||||
router::Include,
|
||||
router::{Include, Path},
|
||||
};
|
||||
use isolang::Language;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
use crate::{message::Action, name::NameType};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash)]
|
||||
pub enum Include<T> {
|
||||
All,
|
||||
@ -26,9 +29,26 @@ mod includes {
|
||||
let b: Include<isize> = Include::Just(5);
|
||||
let c: Include<isize> = Include::Just(7);
|
||||
assert!(a == a, "all should equal all");
|
||||
assert!(a == b, "all should equal some");
|
||||
assert!(b == a, "some should equal all");
|
||||
assert!(b == b, "same some should equal");
|
||||
assert!(b != c, "different somes do not equal");
|
||||
assert!(a == b, "all should equal just");
|
||||
assert!(b == a, "just should equal all");
|
||||
assert!(b == b, "same just should equal");
|
||||
assert!(b != c, "different justs do not equal");
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Path {
|
||||
pub msg_id: Include<Uuid>,
|
||||
pub doc: Include<NameType>,
|
||||
pub action: Include<Action>,
|
||||
}
|
||||
|
||||
impl Path {
|
||||
pub fn new(id: Include<Uuid>, doc: Include<NameType>, action: Include<Action>) -> Self {
|
||||
Self {
|
||||
msg_id: id,
|
||||
doc: doc,
|
||||
action: action,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user