pub struct ControllerHandle<A>where
A: 'static + Authority,{ /* private fields */ }
Expand description
A handle to a Noria controller.
This handle is the primary mechanism for interacting with a running Noria instance, and lets you add and remove queries, retrieve handles for inserting or querying the underlying data, and to perform meta-operations such as fetching the dataflow’s GraphViz visualization.
To establish a new connection to Noria, use ControllerHandle::new
, and pass in the
appropriate Authority
. In the likely case that you are using Zookeeper, use
ControllerHandle::from_zk
.
Note that whatever Tokio Runtime you use to execute the Future
that resolves into the
ControllerHandle
will also be the one that executes all your reads and writes through View
and Table
. Make sure that that Runtime
stays alive, and continues to be driven, otherwise
none of your operations will ever complete! Furthermore, you must use the Runtime
to
execute any futures returned from ControllerHandle
(that is, you cannot just call .wait()
on them).
Implementations§
Source§impl<A: Authority + 'static> ControllerHandle<A>
impl<A: Authority + 'static> ControllerHandle<A>
Sourcepub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
pub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
Check that the ControllerHandle
can accept another request.
Note that this method must return Poll::Ready
before any other methods that return
a Future
on ControllerHandle
can be called.
Sourcepub async fn ready(&mut self) -> Result<(), Error>
pub async fn ready(&mut self) -> Result<(), Error>
A future that resolves when the controller can accept more messages.
When this future resolves, you it is safe to call any methods that require poll_ready
to
have returned Poll::Ready
.
Sourcepub async fn new(authority: A) -> Result<Self, Error>where
A: Send + 'static,
pub async fn new(authority: A) -> Result<Self, Error>where
A: Send + 'static,
Create a ControllerHandle
that bootstraps a connection to Noria via the configuration
stored in the given authority
.
You probably want to use ControllerHandle::from_zk
instead.
Sourcepub fn inputs(
&mut self,
) -> impl Future<Output = Result<BTreeMap<String, NodeIndex>, Error>>
pub fn inputs( &mut self, ) -> impl Future<Output = Result<BTreeMap<String, NodeIndex>, Error>>
Enumerate all known base tables.
These have all been created in response to a CREATE TABLE
statement in a recipe.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn outputs(
&mut self,
) -> impl Future<Output = Result<BTreeMap<String, NodeIndex>, Error>>
pub fn outputs( &mut self, ) -> impl Future<Output = Result<BTreeMap<String, NodeIndex>, Error>>
Enumerate all known external views.
These have all been created in response to a CREATE EXT VIEW
statement in a recipe.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn view(&mut self, name: &str) -> impl Future<Output = Result<View, Error>>
pub fn view(&mut self, name: &str) -> impl Future<Output = Result<View, Error>>
Obtain a View
that allows you to query the given external view.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn table(
&mut self,
name: &str,
) -> impl Future<Output = Result<Table, Error>>
pub fn table( &mut self, name: &str, ) -> impl Future<Output = Result<Table, Error>>
Obtain a Table
that allows you to perform writes, deletes, and other operations on the
given base table.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn statistics(&mut self) -> impl Future<Output = Result<GraphStats, Error>>
pub fn statistics(&mut self) -> impl Future<Output = Result<GraphStats, Error>>
Get statistics about the time spent processing different parts of the graph.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn flush_partial(&mut self) -> impl Future<Output = Result<(), Error>>
pub fn flush_partial(&mut self) -> impl Future<Output = Result<(), Error>>
Flush all partial state, evicting all rows present.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn extend_recipe(
&mut self,
recipe_addition: &str,
) -> impl Future<Output = Result<ActivationResult, Error>>
pub fn extend_recipe( &mut self, recipe_addition: &str, ) -> impl Future<Output = Result<ActivationResult, Error>>
Extend the existing recipe with the given set of queries.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn install_recipe(
&mut self,
new_recipe: &str,
) -> impl Future<Output = Result<ActivationResult, Error>>
pub fn install_recipe( &mut self, new_recipe: &str, ) -> impl Future<Output = Result<ActivationResult, Error>>
Replace the existing recipe with this one.
Self::poll_ready
must have returned Async::Ready
before you call this method.
Sourcepub fn graphviz(&mut self) -> impl Future<Output = Result<String, Error>>
pub fn graphviz(&mut self) -> impl Future<Output = Result<String, Error>>
Fetch a graphviz description of the dataflow graph.
Self::poll_ready
must have returned Async::Ready
before you call this method.