Class ChaosLayer

java.lang.Object
org.apache.opendal.Layer
org.apache.opendal.layer.ChaosLayer

public class ChaosLayer extends Layer
Injects temporary OpenDALException.Code.Unexpected errors when opening a read or reading data, to exercise error handling in tests.
See Also:
  • Constructor Details

    • ChaosLayer

      public ChaosLayer(double errorRatio)
      Creates a layer with the supplied error ratio.
      Parameters:
      errorRatio - the chance that a read call fails, from 0.0 (none) to 1.0 (all), rounded down to a whole percentage point
      Throws:
      IllegalArgumentException - if the ratio is outside [0.0, 1.0] or is NaN
  • Method Details

    • layer

      protected long layer(long nativeOp)
      Specified by:
      layer in class Layer