Make drop notification timing for plugin custom values more consistent (#12341)

# Description
This keeps plugin custom values that have requested drop notification
around during the lifetime of a plugin call / stream by sending them to
a channel that gets persisted during the lifetime of the call.

Before this change, it was very likely that the drop notification would
be sent before the plugin ever had a chance to handle the value it
received.

Tests have been added to make sure this works - see the `custom_values`
plugin.

cc @ayax79 

# User-Facing Changes
This is basically just a bugfix, just a slightly big one.

However, I did add an `as_mut_any()` function for custom values, to
avoid having to clone them. This is a breaking change.
This commit is contained in:
Devyn Cairns
2024-04-04 00:13:25 -07:00
committed by GitHub
parent a6afc89338
commit cbf7feef22
33 changed files with 1115 additions and 368 deletions

View File

@ -34,6 +34,10 @@ impl CustomValue for NuDataFrame {
self
}
fn as_mut_any(&mut self) -> &mut dyn std::any::Any {
self
}
fn follow_path_int(
&self,
_self_span: Span,

View File

@ -34,6 +34,10 @@ impl CustomValue for NuExpression {
self
}
fn as_mut_any(&mut self) -> &mut dyn std::any::Any {
self
}
fn operation(
&self,
lhs_span: Span,

View File

@ -43,4 +43,8 @@ impl CustomValue for NuLazyFrame {
fn as_any(&self) -> &dyn std::any::Any {
self
}
fn as_mut_any(&mut self) -> &mut dyn std::any::Any {
self
}
}

View File

@ -37,4 +37,8 @@ impl CustomValue for NuLazyGroupBy {
fn as_any(&self) -> &dyn std::any::Any {
self
}
fn as_mut_any(&mut self) -> &mut dyn std::any::Any {
self
}
}

View File

@ -34,4 +34,8 @@ impl CustomValue for NuWhen {
fn as_any(&self) -> &dyn std::any::Any {
self
}
fn as_mut_any(&mut self) -> &mut dyn std::any::Any {
self
}
}