package com.atlassian.bitbucket.mesh.repository;

/**
 * Enumerates possible status results from {@link DataStoreManager#attachStorage}.{@link Repository} paths are
 * <i>initialized</i> for all statuses, except where otherwise noted, but may not exist on disk or may not identify
 * valid contents.
 */
public enum StorageStatus {

    /**
     * An appropriate {@link DataStore} has been located, repository paths have been initialized and storage has been
     * successfully attached. The repository exists on disk and has not been deleted.
     */
    ATTACHED,
    /**
     * An appropriate {@link DataStore} has been located, repository paths have been initialized, and the repository
     * exists on disk but has been marked as pending deletion, indicating it will probably no longer exist shortly
     * and should not be used.
     */
    DELETED,
    /**
     * No appropriate {@link DataStore} could be found. Repository paths <i>are not initialized</i> and cannot be used.
     * <p>
     * For {@link DataStore} implementations which support storing repository data on multiple shards, this status may
     * also be used to indicate no appropriate shard could be found within the store.
     */
    NO_STORE,
    /**
     * An appropriate {@link DataStore} has been located and repository paths have been initialized, but the repository
     * does not exist on disk. When this status is returned, {@link Repository#getPath} is guaranteed to denote a path
     * that does not exist (as a directory, file or any other type).
     */
    NONEXISTENT,
    /**
     * An appropriate {@link DataStore} has been located and repository paths have been initialized, but the
     * repository's path identifies something other than a directory, like a file.
     * <p>
     * Note that if the repository's path identifies a <i>symbolic link</i> to a directory, it is treated the same
     * as if it was a directory itself, and will not be considered occluded.
     */
    OCCLUDED,
    /**
     * An appropriate {@link DataStore} has been located and repository paths have been initialized, but the presence
     * of the repository directory could not be verified. This status could effectively mean any of:
     * <ul>
     *     <li>{@link #ATTACHED}</li>
     *     <li>{@link #DELETED}</li>
     *     <li>{@link #NONEXISTENT}</li>
     *     <li>{@link #OCCLUDED}</li>
     * </ul>
     * This status allows the <i>caller</i> to decide whether to continue or abort. Should processing continue, it may
     * produce a more useful error message than this status by itself.
     */
    UNKNOWN,
}
