package com.atlassian.bitbucket.mesh.config;

import javax.annotation.Nonnull;
import java.time.Duration;

public interface Backoff {

    /**
     * @return a new {@link Execution} that determines the rate at which an operation should be retried
     */
    @Nonnull
    Execution start();

    /**
     * Provides the amount of backoff delay between subsequent attempts of an operation that should be retried.
     */
    interface Execution {

        @Nonnull
        Duration nextDelay();
    }
}
