pub enum SyntheticNode {
Dir {
children: HashMap<String, SyntheticNode>,
},
DynamicDir {
list: Box<dyn Fn() -> Vec<DirEntry> + Send + Sync>,
resolve: Box<dyn Fn(&str) -> Option<SyntheticNode> + Send + Sync>,
},
ReadFile(Box<dyn Fn() -> Vec<u8> + Send + Sync>),
CtlFile {
handler: Box<dyn Fn(&[u8], &Subject) -> Result<Vec<u8>, String> + Send + Sync>,
},
WatchFile(Sender<Bytes>),
OneshotFile(Arc<OneshotState>),
AsyncCtlFile {
handler: Box<dyn Fn(Vec<u8>, Subject) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send>> + Send + Sync>,
},
}Expand description
A node in the synthetic file tree.
Variants§
Dir
Static directory with fixed children.
Fields
children: HashMap<String, SyntheticNode>DynamicDir
Directory whose children are computed dynamically (e.g., model list).
Fields
ReadFile(Box<dyn Fn() -> Vec<u8> + Send + Sync>)
Read-only file whose content is generated on read.
CtlFile
Control file: write input, read response. Mutations go here (Plan9 ctl pattern).
The handler receives the caller’s Subject so it can enforce per-caller authorization.
WatchFile(Sender<Bytes>)
Status file backed by tokio::sync::watch. Always returns the latest value.
Stores the Sender so receivers can be cloned per-fid at walk time.
Uses bytes::Bytes for O(1) reference-counted clone on the read path.
OneshotFile(Arc<OneshotState>)
Completion file backed by tokio::sync::OnceCell. First reader resolves;
all subsequent readers get the cached value.
AsyncCtlFile
Async ctl file with an async handler. Used for operations that need .await
(e.g., forwarding to remote services). Must resolve as ResolvedNode::Static
to avoid holding DashMap guards across await points.
Auto Trait Implementations§
impl Freeze for SyntheticNode
impl !RefUnwindSafe for SyntheticNode
impl Send for SyntheticNode
impl Sync for SyntheticNode
impl Unpin for SyntheticNode
impl UnsafeUnpin for SyntheticNode
impl !UnwindSafe for SyntheticNode
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request