Separating elements from their parts.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
Jeff Baskin 2025-12-24 17:54:25 -05:00
parent 9df6c4db42
commit 44850710df
3 changed files with 49 additions and 29 deletions

View File

@ -1,13 +1,22 @@
mod message; mod message;
mod mtterror;
use message::{ use message::{
Action, Addition, CalcValue, Calculation, Clock, CreateDoc, Field, FieldType, Include, Message, Action, Addition, CalcValue, Calculation, Clock, CreateDoc, Field, FieldType, Include, Message,
Name, NameType, Operand, Path, Queue, RegMsg, Register, Session, Name, NameType, Operand, Path, Queue, RegMsg, Register, Session,
}; };
pub use message::{MsgAction, Query}; pub use message::{MsgAction, Query};
use mtterror::MTTError;
use std::sync::mpsc::{channel, Receiver}; use std::sync::mpsc::{channel, Receiver};
use uuid::Uuid; use uuid::Uuid;
#[cfg(test)]
mod support_tests {
use std::time::Duration;
pub static TIMEOUT: Duration = Duration::from_millis(500);
}
#[derive(Clone)] #[derive(Clone)]
pub struct MoreThanText { pub struct MoreThanText {
queue: Queue, queue: Queue,

View File

@ -11,36 +11,16 @@ use std::{
time::Duration, time::Duration,
}; };
use uuid::Uuid; use uuid::Uuid;
use super::MTTError;
/*
#[cfg(test)] #[cfg(test)]
mod support_test { mod support_test {
use std::time::Duration; use std::time::Duration;
pub static TIMEOUT: Duration = Duration::from_millis(500); pub static TIMEOUT: Duration = Duration::from_millis(500);
} }
*/
#[derive(Clone, Debug)]
pub enum MTTError {
AdditionMissingField(Name),
CannotConvertMessageToRouteID,
DocumentAlreadyExists(String),
DocumentFieldAlreadyExists(String, Field),
DocumentFieldMissing(String),
DocumentFieldNotFound(String),
DocumentFieldWrongDataType(FieldType, FieldType),
DocumentNotFound(String),
FieldDuplicate,
FieldInvalidType,
FieldMissingData,
InvalidNone,
RecordMismatch,
NameDuplicate(Name),
NameInvalidID(Uuid),
NameMissingTranslation(Language),
NameNotFound(Name),
QueryCannotChangeData,
RouteRequiresDocumentID,
}
#[derive(Clone, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub enum Action { pub enum Action {
@ -1591,7 +1571,8 @@ impl Router {
#[cfg(test)] #[cfg(test)]
mod routers { mod routers {
use super::{support_test::TIMEOUT, *}; use crate::support_tests::TIMEOUT;
use super::*;
#[test] #[test]
fn can_pass_message() { fn can_pass_message() {
@ -1700,7 +1681,8 @@ impl Queue {
#[cfg(test)] #[cfg(test)]
mod queues { mod queues {
use super::{support_test::TIMEOUT, *}; use crate::support_tests::TIMEOUT;
use super::*;
use std::sync::mpsc::RecvTimeoutError; use std::sync::mpsc::RecvTimeoutError;
struct TestQueue { struct TestQueue {
@ -5262,7 +5244,8 @@ impl DocumentFile {
#[cfg(test)] #[cfg(test)]
mod document_files { mod document_files {
use super::{support_test::TIMEOUT, *}; use crate::support_tests::TIMEOUT;
use super::*;
use std::{sync::mpsc::RecvTimeoutError, thread::sleep}; use std::{sync::mpsc::RecvTimeoutError, thread::sleep};
fn standard_paths() -> Vec<Path> { fn standard_paths() -> Vec<Path> {
@ -6942,7 +6925,7 @@ mod document_files {
#[cfg(test)] #[cfg(test)]
mod createdocs { mod createdocs {
use super::support_test::TIMEOUT; use crate::support_tests::TIMEOUT;
use super::*; use super::*;
struct TestCreateDoc { struct TestCreateDoc {
@ -7350,7 +7333,8 @@ impl MessageLog {
#[cfg(test)] #[cfg(test)]
mod message_logs { mod message_logs {
use super::{support_test::TIMEOUT, *}; use crate::support_tests::TIMEOUT;
use super::*;
#[test] #[test]
fn does_log_store_messages() { fn does_log_store_messages() {
@ -7474,7 +7458,8 @@ impl Session {
#[cfg(test)] #[cfg(test)]
mod sessions { mod sessions {
use super::{support_test::TIMEOUT, *}; use crate::support_tests::TIMEOUT;
use super::*;
use std::{sync::mpsc::RecvTimeoutError, thread::sleep}; use std::{sync::mpsc::RecvTimeoutError, thread::sleep};
struct Setup { struct Setup {

26
src/mtterror.rs Normal file
View File

@ -0,0 +1,26 @@
use isolang::Language;
use super::message::{Field, FieldType, Name};
use uuid::Uuid;
#[derive(Clone, Debug)]
pub enum MTTError {
AdditionMissingField(Name),
CannotConvertMessageToRouteID,
DocumentAlreadyExists(String),
DocumentFieldAlreadyExists(String, Field),
DocumentFieldMissing(String),
DocumentFieldNotFound(String),
DocumentFieldWrongDataType(FieldType, FieldType),
DocumentNotFound(String),
FieldDuplicate,
FieldInvalidType,
FieldMissingData,
InvalidNone,
RecordMismatch,
NameDuplicate(Name),
NameInvalidID(Uuid),
NameMissingTranslation(Language),
NameNotFound(Name),
QueryCannotChangeData,
RouteRequiresDocumentID,
}