pub struct State {Show 21 fields
pub tools: Vec<Tool>,
pub next_tool: u64,
pub jobs: Journaled<Job>,
pub next_job: u64,
pub workflows: Vec<Definition>,
pub workflow_runs: Vec<Run>,
pub bom_configuration: Configuration,
pub seq: u64,
pub users: Vec<User>,
pub sessions: Journaled<Session>,
pub api_tokens: Vec<ApiToken>,
pub part_types: Vec<PartType>,
pub parts: Parts,
pub categories: Vec<Category>,
pub manufacturers: Vec<Company>,
pub suppliers: Vec<Company>,
pub settings: Settings,
pub workspace_model: u32,
pub changes: Vec<Change>,
pub changes_from: u64,
pub workspace: Workspace,
}Expand description
Everything the server holds in memory, and exactly what the metadata file contains.
Fields§
§tools: Vec<Tool>The tools library (crate::tools), and the last tool number handed out.
next_tool: u64§jobs: Journaled<Job>The jobs floor queue (crate::jobs), journaled like sessions: a
floor signs a step a minute, and a list kept in the state’s other
fields cost every write on the server O(every job) — 0.56 s at 1,000
jobs of 30 steps. One meta row per job (job:<id>).
next_job: u64The last job number handed out.
workflows: Vec<Definition>§workflow_runs: Vec<Run>§bom_configuration: Configuration§seq: u64§users: Vec<User>§sessions: Journaled<Session>Browser sessions, journaled (crate::journal): one is added per
sign-in, so this grows with use, and a list outside a journal costs
every write O(its length).
api_tokens: Vec<ApiToken>Bearer tokens for callers that are not a browser (ApiToken).
part_types: Vec<PartType>§parts: Parts§categories: Vec<Category>The catalog tree, flat: each category names its parent.
manufacturers: Vec<Company>Who makes parts (Company); a manufacturer part names one.
suppliers: Vec<Company>Who sells parts (Company); a supplier offer names one.
settings: SettingsThe administrator’s policy choices (Settings).
workspace_model: u32The workspace model the store is at (crate::workspace::MODEL);
an older one is brought up to date when the store opens.
changes: Vec<Change>§changes_from: u64The lowest sequence the change log can still answer for completely.
It moves only when CHANGE_LOG_LIMIT forces entries out, so a
client is told stale when the log has actually DROPPED something it
needed — not merely because nothing happened at the sequence it asked
from, which is the ordinary case for a client that has been idle.
workspace: WorkspaceEvery user’s workspace entries (crate::model::WorkspaceEntry),
in creation order.
Implementations§
Source§impl State
impl State
pub fn user(&self, id: &str) -> Option<&User>
pub fn user_by_name(&self, username: &str) -> Option<&User>
pub fn part(&self, id: &str) -> Option<&Part>
pub fn part_type(&self, id: &str) -> Option<&PartType>
Sourcepub fn part_by_id_or_number(&self, key: &str) -> Option<&Part>
pub fn part_by_id_or_number(&self, key: &str) -> Option<&Part>
A part by its id, or else by its number.
Sourcepub fn part_with_number(&self, number: &str) -> Option<&Part>
pub fn part_with_number(&self, number: &str) -> Option<&Part>
The part that already carries number, compared without regard to
ASCII case. A part number is unique across ALL parts, whatever type
made it: it is what an ERP, a BOM and a person
reading a drawing use to mean exactly one part.
Sourcepub fn changes_floor(&self) -> u64
pub fn changes_floor(&self) -> u64
The oldest sequence the change log can still answer for completely.
A client asking from before this is told stale and must re-index.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for State
impl<'de> Deserialize<'de> for State
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for State
impl Freeze for Statewhere
*const u8 is !null: Freeze,
PhantomData<Tool>: Freeze,
PhantomData<Job>: Freeze,
PhantomData<(String, usize)>: Freeze,
*const LeafNode<String, Option<Job>> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Option<Job>)>>: Freeze,
PhantomData<Definition>: Freeze,
PhantomData<Run>: Freeze,
*const LeafNode<String, Vec<AttributeDef>> is !null: Freeze,
PhantomData<Box<(String, Vec<AttributeDef>)>>: Freeze,
PhantomData<AttributeDef>: Freeze,
PhantomData<Layout>: Freeze,
*const LeafNode<String, String> is !null: Freeze,
PhantomData<Box<(String, String)>>: Freeze,
PhantomData<User>: Freeze,
PhantomData<Session>: Freeze,
*const LeafNode<String, Option<Session>> is !null: Freeze,
PhantomData<Box<(String, Option<Session>)>>: Freeze,
PhantomData<ApiToken>: Freeze,
PhantomData<PartType>: Freeze,
PhantomData<Part>: Freeze,
*const LeafNode<usize, Option<Part>> is !null: Freeze,
PhantomData<Box<(usize, Option<Part>)>>: Freeze,
PhantomData<Category>: Freeze,
PhantomData<Company>: Freeze,
PhantomData<StatusOption>: Freeze,
PhantomData<ReviewerRef>: Freeze,
PhantomData<ReviewOverride>: Freeze,
PhantomData<Change>: Freeze,
PhantomData<WorkspaceEntry>: Freeze,
*const LeafNode<String, Option<WorkspaceEntry>> is !null: Freeze,
PhantomData<Box<(String, Option<WorkspaceEntry>)>>: Freeze,
impl Move for State
impl RefUnwindSafe for State
impl Send for Statewhere
RawVecInner: Send,
RawTable<usize>: Send,
RawTable<(String, usize)>: Send,
NodeRef<Owned, String, Option<Job>, LeafOrInternal>: Send,
BoxRaw<(String, Option<Job>)>: Send,
NodeRef<Owned, String, Step, LeafOrInternal>: Send,
BoxRaw<(String, Step)>: Send,
NodeRef<Owned, String, Vec<AttributeDef>, LeafOrInternal>: Send,
BoxRaw<(String, Vec<AttributeDef>)>: Send,
NodeRef<Owned, String, String, LeafOrInternal>: Send,
BoxRaw<(String, String)>: Send,
NodeRef<Owned, String, Option<Session>, LeafOrInternal>: Send,
BoxRaw<(String, Option<Session>)>: Send,
NodeRef<Owned, String, Value, LeafOrInternal>: Send,
BoxRaw<(String, Value)>: Send,
NodeRef<Owned, usize, Option<Part>, LeafOrInternal>: Send,
BoxRaw<(usize, Option<Part>)>: Send,
NodeRef<Owned, String, Option<WorkspaceEntry>, LeafOrInternal>: Send,
BoxRaw<(String, Option<WorkspaceEntry>)>: Send,
impl Sync for Statewhere
RawVecInner: Sync,
RawTable<usize>: Sync,
RawTable<(String, usize)>: Sync,
NodeRef<Owned, String, Option<Job>, LeafOrInternal>: Sync,
BoxRaw<(String, Option<Job>)>: Sync,
NodeRef<Owned, String, Step, LeafOrInternal>: Sync,
BoxRaw<(String, Step)>: Sync,
NodeRef<Owned, String, Vec<AttributeDef>, LeafOrInternal>: Sync,
BoxRaw<(String, Vec<AttributeDef>)>: Sync,
NodeRef<Owned, String, String, LeafOrInternal>: Sync,
BoxRaw<(String, String)>: Sync,
NodeRef<Owned, String, Option<Session>, LeafOrInternal>: Sync,
BoxRaw<(String, Option<Session>)>: Sync,
NodeRef<Owned, String, Value, LeafOrInternal>: Sync,
BoxRaw<(String, Value)>: Sync,
NodeRef<Owned, usize, Option<Part>, LeafOrInternal>: Sync,
BoxRaw<(usize, Option<Part>)>: Sync,
NodeRef<Owned, String, Option<WorkspaceEntry>, LeafOrInternal>: Sync,
BoxRaw<(String, Option<WorkspaceEntry>)>: Sync,
impl Unpin for Statewhere
*const u8 is !null: Unpin,
*const LeafNode<String, Option<Job>> is !null: Unpin,
Box<(String, Option<Job>)>: Unpin,
*const LeafNode<String, Step> is !null: Unpin,
Box<(String, Step)>: Unpin,
*const LeafNode<String, Vec<AttributeDef>> is !null: Unpin,
Box<(String, Vec<AttributeDef>)>: Unpin,
*const LeafNode<String, String> is !null: Unpin,
Box<(String, String)>: Unpin,
*const LeafNode<String, Option<Session>> is !null: Unpin,
Box<(String, Option<Session>)>: Unpin,
*const LeafNode<String, Value> is !null: Unpin,
Box<(String, Value)>: Unpin,
*const LeafNode<usize, Option<Part>> is !null: Unpin,
Box<(usize, Option<Part>)>: Unpin,
*const LeafNode<String, Option<WorkspaceEntry>> is !null: Unpin,
Box<(String, Option<WorkspaceEntry>)>: Unpin,
impl UnsafeUnpin for Statewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Tool>: UnsafeUnpin,
PhantomData<Job>: UnsafeUnpin,
PhantomData<(String, usize)>: UnsafeUnpin,
*const LeafNode<String, Option<Job>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Option<Job>)>>: UnsafeUnpin,
PhantomData<Definition>: UnsafeUnpin,
PhantomData<Run>: UnsafeUnpin,
*const LeafNode<String, Vec<AttributeDef>> is !null: UnsafeUnpin,
PhantomData<Box<(String, Vec<AttributeDef>)>>: UnsafeUnpin,
PhantomData<AttributeDef>: UnsafeUnpin,
PhantomData<Layout>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
PhantomData<User>: UnsafeUnpin,
PhantomData<Session>: UnsafeUnpin,
*const LeafNode<String, Option<Session>> is !null: UnsafeUnpin,
PhantomData<Box<(String, Option<Session>)>>: UnsafeUnpin,
PhantomData<ApiToken>: UnsafeUnpin,
PhantomData<PartType>: UnsafeUnpin,
PhantomData<Part>: UnsafeUnpin,
*const LeafNode<usize, Option<Part>> is !null: UnsafeUnpin,
PhantomData<Box<(usize, Option<Part>)>>: UnsafeUnpin,
PhantomData<Category>: UnsafeUnpin,
PhantomData<Company>: UnsafeUnpin,
PhantomData<StatusOption>: UnsafeUnpin,
PhantomData<ReviewerRef>: UnsafeUnpin,
PhantomData<ReviewOverride>: UnsafeUnpin,
PhantomData<Change>: UnsafeUnpin,
PhantomData<WorkspaceEntry>: UnsafeUnpin,
*const LeafNode<String, Option<WorkspaceEntry>> is !null: UnsafeUnpin,
PhantomData<Box<(String, Option<WorkspaceEntry>)>>: UnsafeUnpin,
impl UnwindSafe for Statewhere
RawVecInner: UnwindSafe,
NonNull<u8>: UnwindSafe,
HashMap<String, usize>: UnwindSafe,
BTreeMap<String, Option<Job>>: UnwindSafe,
BTreeMap<String, Step>: UnwindSafe,
BTreeMap<String, Vec<AttributeDef>>: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
BTreeMap<String, Option<Session>>: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
BTreeMap<usize, Option<Part>>: UnwindSafe,
BTreeMap<String, Option<WorkspaceEntry>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.