Moved InternalRecord into document module.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
Jeff Baskin 2026-02-13 12:37:47 -05:00
parent 4f69ecc7a9
commit 45bcd04ee3
4 changed files with 36 additions and 35 deletions

View File

@ -5,7 +5,7 @@ mod field;
mod record;
mod session;
use record::InternalRecords;
use record::{InternalRecord, InternalRecords};
pub use clock::Clock;
pub use create::CreateDoc;

View File

@ -1,11 +1,11 @@
use super::InternalRecords;
use super::{InternalRecord, InternalRecords};
use crate::{
action::{Action, CalcValue, Calculation, MsgAction, Query, Records},
document::{
definition::{DocDef, DocFuncType},
field::Field,
},
message::wrapper::{InternalRecord, Message, Oid, Reply, Update},
message::wrapper::{Message, Oid, Reply, Update},
mtterror::{ErrorID, MTTError},
name::NameType,
queue::{

View File

@ -1,10 +1,42 @@
use crate::{
action::Field,
message::wrapper::{InternalRecord, Oid},
message::wrapper::Oid,
mtterror::{ErrorID, MTTError},
name::{Name, NameType, Names},
};
use std::collections::HashMap;
use uuid::Uuid;
#[derive(Clone, Debug)]
pub struct InternalRecord {
data: HashMap<Uuid, Field>,
}
impl InternalRecord {
pub fn new() -> Self {
Self {
data: HashMap::new(),
}
}
pub fn insert<F>(&mut self, id: Uuid, data: F) -> Field
where
F: Into<Field>,
{
match self.data.insert(id, data.into()) {
Some(data) => data.clone(),
None => Field::None,
}
}
pub fn get(&self, id: &Uuid) -> Option<&Field> {
self.data.get(id)
}
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
}
#[derive(Clone, Debug)]
pub struct InternalRecords {

View File

@ -365,37 +365,6 @@ mod replies {
}
}
#[derive(Clone, Debug)]
pub struct InternalRecord {
data: HashMap<Uuid, Field>,
}
impl InternalRecord {
pub fn new() -> Self {
Self {
data: HashMap::new(),
}
}
pub fn insert<F>(&mut self, id: Uuid, data: F) -> Field
where
F: Into<Field>,
{
match self.data.insert(id, data.into()) {
Some(data) => data.clone(),
None => Field::None,
}
}
pub fn get(&self, id: &Uuid) -> Option<&Field> {
self.data.get(id)
}
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
}
#[derive(Clone, Debug)]
pub struct Document {
data: HashMap<NameType, CalcValue>,