Re: [PATCH proxmox-backup v6 18/22] datastore: add thresholds notification callback on datastore lookup

Hannes Laimer
2026-03-31T09:36:14Z

On 2026-03-19 10:41, Christian Ebner wrote:
> Pass in the callback to be executed when a datastore threshold value
> exceeds its set limit. This callback is then callable by the s3
> client request counters implementation, currently the only component
> defining thresholds.
>
> When a threshold is exceeded, the notification is generated by the
> callback and queued for being send.
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---

[..]

> +pub type ThresholdsExceededCallback = fn(&str, &str, u64, u64) -> Result<(), Error>;
> +
> pub struct DataStoreLookup<'a> {
> name: &'a str,
> operation: Operation,
> + thresholds_exceeded_callback: Arc<Option<ThresholdsExceededCallback>>,

fn pointers are `Copy + Send + Sync + 'static`, so we don't need an
`Arc` here

> }
>
> impl<'a> DataStoreLookup<'a> {
> - pub fn with(name: &'a str, operation: Operation) -> Self {
> - Self { name, operation }
> + pub fn with(
> + name: &'a str,
> + operation: Operation,
> + thresholds_exceeded_callback: Arc<Option<ThresholdsExceededCallback>>,
> + ) -> Self {
> + Self {
> + name,
> + operation,
> + thresholds_exceeded_callback,
> + }
> }
> }

[..]