Struct mz_orchestratord::controller::materialize::Context
source · pub struct Context {
config: Args,
tracing: TracingCliArgs,
orchestratord_namespace: String,
metrics: Arc<Metrics>,
needs_update: Arc<Mutex<BTreeSet<String>>>,
}
Fields§
§config: Args
§tracing: TracingCliArgs
§orchestratord_namespace: String
§metrics: Arc<Metrics>
§needs_update: Arc<Mutex<BTreeSet<String>>>
Implementations§
source§impl Context
impl Context
pub fn new( config: Args, tracing: TracingCliArgs, orchestratord_namespace: String, metrics: Arc<Metrics>, ) -> Self
fn set_needs_update(&self, mz: &Materialize, needs_update: bool)
async fn update_status( &self, mz_api: &Api<Materialize>, mz: &Materialize, status: MaterializeStatus, needs_update: bool, ) -> Result<Materialize, Error>
Trait Implementations§
source§impl Context for Context
impl Context for Context
§type Resource = Materialize
type Resource = Materialize
The type of Kubernetes resource that will be watched by
the
Controller
this context is passed tosource§const FINALIZER_NAME: &'static str = "orchestratord.materialize.cloud/materialize"
const FINALIZER_NAME: &'static str = "orchestratord.materialize.cloud/materialize"
The name to use for the finalizer. This must be unique across
controllers - if multiple controllers with the same finalizer name
run against the same resource, unexpected behavior can occur.
source§fn apply<'life0, 'life1, 'async_trait>(
&'life0 self,
client: Client,
mz: &'life1 Self::Resource,
) -> Pin<Box<dyn Future<Output = Result<Option<Action>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn apply<'life0, 'life1, 'async_trait>(
&'life0 self,
client: Client,
mz: &'life1 Self::Resource,
) -> Pin<Box<dyn Future<Output = Result<Option<Action>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
This method is called when a watched resource is created or updated.
The
Client
used by the controller is passed in to allow making
additional API requests, as is the resource which triggered this
event. If this method returns Some(action)
, the given action will
be performed, otherwise if None
is returned,
success_action
will be called to find the
action to perform.source§fn cleanup<'life0, 'life1, 'async_trait>(
&'life0 self,
_client: Client,
mz: &'life1 Self::Resource,
) -> Pin<Box<dyn Future<Output = Result<Option<Action>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cleanup<'life0, 'life1, 'async_trait>(
&'life0 self,
_client: Client,
mz: &'life1 Self::Resource,
) -> Pin<Box<dyn Future<Output = Result<Option<Action>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
This method is called when a watched resource is marked for deletion.
The
Client
used by the controller is passed in to allow making
additional API requests, as is the resource which triggered this
event. If this method returns Some(action)
, the given action will
be performed, otherwise if None
is returned,
success_action
will be called to find the
action to perform.source§fn success_action(&self, resource: &Self::Resource) -> Action
fn success_action(&self, resource: &Self::Resource) -> Action
source§fn error_action(
self: Arc<Self>,
resource: Arc<Self::Resource>,
err: &Error<Self::Error>,
consecutive_errors: u32,
) -> Action
fn error_action( self: Arc<Self>, resource: Arc<Self::Resource>, err: &Error<Self::Error>, consecutive_errors: u32, ) -> Action
This method is called when a call to
apply
or
cleanup
returns Err
. It should return the
default Action
to perform. The error returned will be passed in
here, as well as a count of how many consecutive errors have happened
for this resource, to allow for an exponential backoff strategy. The
default implementation uses exponential backoff with a max of 256
seconds and some added randomization to avoid thundering herds.Auto Trait Implementations§
impl !Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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
Mutably borrows from an owned value. Read more
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
Creates a shared type from an unshared type.
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
The method of
std::ops::AddAssign
, for types that do not implement AddAssign
.