package com.atlassian.bitbucket.mesh.test.cluster;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.Callable;

public interface MeshClusterNode {

    /**
     * @return the ID under which the node has been registered with the control plane; {@code null} if not (yet)
     *         registered
     */
    @Nullable
    String getId();

    @Nonnull
    String getName();

    @Nonnull
    List<Path> getShards();

    @Nonnull
    String getUrl();

    /**
     * Executes the provided action while this node is simulated to be offline
     * @param action the action to execute
     */
    <T> T whileOffline(Callable<T> action) throws Exception;
}
