Retry layer

Add retry for temporary failed operations.

Notes

This layer will retry failed operations when [Error::is_temporary] returns true. If operation still failed, this layer will set error to Persistent which means error has been retried.

write and blocking_write don't support retry so far, visit this issue for more details.

Examples

const op = new Operator("file", { root: "/tmp" })

const retry = new RetryLayer();
retry.max_times = 3;
retry.jitter = true;

op.layer(retry.build());

Constructors

Accessors

Methods

Constructors

Accessors

  • set factor(v): void
  • Set factor of current backoff.

    Panics

    This function will panic if input factor smaller than 1.0.

    Parameters

    • v: number

    Returns void

  • set jitter(v): void
  • Set jitter of current backoff.

    If jitter is enabled, ExponentialBackoff will add a random jitter in `[0, min_delay) to current delay.

    Parameters

    • v: boolean

    Returns void

  • set maxDelay(v): void
  • Set max_delay of current backoff.

    Delay will not increasing if current delay is larger than max_delay.

    Notes

    • The unit of max_delay is millisecond.

    Parameters

    • v: number

    Returns void

  • set maxTimes(v): void
  • Set max_times of current backoff.

    Backoff will return None if max times is reaching.

    Parameters

    • v: number

    Returns void

  • set minDelay(v): void
  • Set min_delay of current backoff.

    Notes

    • The unit of min_delay is millisecond.

    Parameters

    • v: number

    Returns void

Methods

Copyright © 2022-2024, The Apache Software Foundation. Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation.