pub enum FileTreeEvent {
Snapshot {
children: Vec<FileTreeNode>,
},
Upserted {
path: Vec<String>,
node: FileTreeNode,
},
Removed {
path: Vec<String>,
},
}Expand description
One event on the /filetree SSE stream. The first is always a
Snapshot; every later one upserts or
removes a single node as the filesystem changes.
Variants§
Snapshot
The full tree — the watched root’s child nodes — sent once immediately on connect.
Fields
children: Vec<FileTreeNode>The watched root’s entries (its own identity is implicit — the caller knows the watched path).
Upserted
A single node came into existence or changed. A directory carries its whole (re-walked) subtree.
Fields
path: Vec<String>The FULL component path to the node, relative to the
watched root (the last element equals node’s name).
node: FileTreeNodeThe new/updated node.
Removed
A single node (and, if a directory, its whole subtree) was removed.
Implementations§
Source§impl FileTreeEvent
impl FileTreeEvent
Sourcepub fn apply(self, root: &mut Vec<FileTreeNode>)
pub fn apply(self, root: &mut Vec<FileTreeNode>)
Fold this event into a live tree (the watched root’s children).
Snapshot replaces the whole child set; Upserted inserts or
replaces one node at its path (a directory node carries its
whole subtree); Removed drops the node at its path (and,
being a subtree, everything under it). Idempotent — replaying an
already-applied event leaves the tree unchanged, so at-least-once
delivery is safe.
This is THE fold, shared by every holder of a materialized tree:
the SDK’s FileTree client, the laboratory host’s per-lab
state, and the CLI daemon’s per-host state.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for FileTreeEvent
impl<'arbitrary> Arbitrary<'arbitrary> for FileTreeEvent
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for FileTreeEvent
impl Clone for FileTreeEvent
Source§fn clone(&self) -> FileTreeEvent
fn clone(&self) -> FileTreeEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileTreeEvent
impl Debug for FileTreeEvent
Source§impl<'de> Deserialize<'de> for FileTreeEvent
impl<'de> Deserialize<'de> for FileTreeEvent
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>,
impl Eq for FileTreeEvent
Source§impl JsonSchema for FileTreeEvent
impl JsonSchema for FileTreeEvent
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for FileTreeEvent
impl PartialEq for FileTreeEvent
Source§impl Serialize for FileTreeEvent
impl Serialize for FileTreeEvent
impl StructuralPartialEq for FileTreeEvent
Auto Trait Implementations§
impl Freeze for FileTreeEvent
impl RefUnwindSafe for FileTreeEvent
impl Send for FileTreeEvent
impl Sync for FileTreeEvent
impl Unpin for FileTreeEvent
impl UnsafeUnpin for FileTreeEvent
impl UnwindSafe for FileTreeEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more