package com.atlassian.bitbucket.mesh.config;

import com.atlassian.bitbucket.mesh.annotation.ManagedByControlPlane;

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

public interface HooksConfig {

    /**
     * @return the size of the buffer allocated to processing hook callbacks
     */
    @ManagedByControlPlane
    long getBufferCapacity();

    /**
     * @return the maximum time a git hook callback to the RPC client is allowed to execute before being aborted
     */
    @ManagedByControlPlane
    @Nonnull
    Duration getCallbackTimeout();

    /**
     * @return the maximum time the pack-objects hook is allowed to run before timing out
     */
    @Nonnull
    Duration getPackObjectsTimeout();

    /**
     * @return the number of core callback threads
     */
    int getThreadsCore();

    /**
     * @return how long hook callback threads are kept alive when there are no callbacks to process
     */
    @Nonnull
    Duration getThreadsKeepAlive();

    /**
     * @return how many callback threads can be started
     */
    int getThreadsMax();

    /**
     * @return the network address to bind the callback socket to
     */
    @Nullable
    String getSocketAddress();

    /**
     * @return the network port to bind the callback socket to
     */
    int getSocketPort();

    /**
     * @return {@code true} if native hooks are enabled
     */
    boolean isNativeCallbackEnabled();
}
