pub struct IngestHooks { /* private fields */ }Expand description
A node’s ingest wiring, shared by its workload hosts.
Implementations§
Source§impl IngestHooks
impl IngestHooks
Sourcepub fn new(
own_node: impl Into<String>,
registry: Arc<TokenRegistry>,
bridge: Arc<IngestBridge>,
shared: SocketAddr,
scoped_bind: Option<IpAddr>,
) -> Self
pub fn new( own_node: impl Into<String>, registry: Arc<TokenRegistry>, bridge: Arc<IngestBridge>, shared: SocketAddr, scoped_bind: Option<IpAddr>, ) -> Self
Hooks over registry and bridge; native cogs are told shared
(where the shared listener is bound).
Sourcepub fn disabled(own_node: impl Into<String>, reason: impl Into<String>) -> Self
pub fn disabled(own_node: impl Into<String>, reason: impl Into<String>) -> Self
Hooks for a node whose bridge could not start. Cogs are placed with
no token and no URL, and every place result, status and
advertisement says ingest: disabled.
Sourcepub fn with_project_controllers(
self,
c: HashMap<String, HashSet<String>>,
) -> Self
pub fn with_project_controllers( self, c: HashMap<String, HashSet<String>>, ) -> Self
Controllers (node ids) besides this node allowed to place for each project.
Sourcepub fn with_project_directory(self, d: Arc<dyn ProjectDirectory>) -> Self
pub fn with_project_directory(self, d: Arc<dyn ProjectDirectory>) -> Self
Identity records: a project’s bound key may place for it.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
True when the bridge is running.
Sourcepub fn disabled_reason(&self) -> Option<&str>
pub fn disabled_reason(&self) -> Option<&str>
Why the bridge is disabled.
Sourcepub fn registry(&self) -> &Arc<TokenRegistry> ⓘ
pub fn registry(&self) -> &Arc<TokenRegistry> ⓘ
The token registry.
May the controller in b.controller_node place a cog for
b.project_id, and is there a store owner for the placement? The
instance id is not known yet at place time and is ignored.
A project needs one of: the controller is this node; the controller is listed for the project in the config; the controller is the node of the project’s bound key. Whatever the project, a route to a store owner must exist, so a placement whose vectors could not be delivered is refused instead of placed.
Sourcepub async fn prepare(
&self,
route: &str,
contract: HostContract,
) -> Result<(HostContract, Option<BridgeHandle>), IngestError>
pub async fn prepare( &self, route: &str, contract: HostContract, ) -> Result<(HostContract, Option<BridgeHandle>), IngestError>
Complete contract for an instance on route: native cogs get the
shared bridge URL; other routes get their own token-scoped listener
(when scoped_bind is set) as their ingest_upstream.
Sourcepub fn lease(
&self,
binding: InstanceBinding,
contract: HostContract,
listener: Option<BridgeHandle>,
) -> Result<IngestLease, IngestError>
pub fn lease( &self, binding: InstanceBinding, contract: HostContract, listener: Option<BridgeHandle>, ) -> Result<IngestLease, IngestError>
Bind a loaded instance to its placement and accept its token.
Sourcepub fn activate(&self, l: &IngestLease) -> Result<(), IngestError>
pub fn activate(&self, l: &IngestLease) -> Result<(), IngestError>
Accept the token again (after a stop and a later start).
Sourcepub fn deactivate(&self, l: &IngestLease)
pub fn deactivate(&self, l: &IngestLease)
Stop accepting the instance’s token.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for IngestHooks
impl !UnwindSafe for IngestHooks
impl Freeze for IngestHooks
impl Send for IngestHooks
impl Sync for IngestHooks
impl Unpin for IngestHooks
impl UnsafeUnpin for IngestHooks
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,
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