FulcrumFS FulcrumFS
FulcrumFS FulcrumFS
DocFX + Singulink = ♥

Search Results for

    Method EnsureCreated

    EnsureCreated()

    Ensures that the file repository exists at the configured base directory, creating it or repairing its directory structure as necessary, and then initializes this instance exactly as EnsureInitialized() does. When this method returns, the repository exists and this instance has it open.

    Declaration
    public void EnsureCreated()
    Remarks

    If the base directory does not exist or is empty, it is created as a FulcrumFS repository with the format version configured by MinimumFormatVersion.

    If the base directory contains an existing FulcrumFS repository (identified by the presence of the InfoFileName marker file), any missing required subdirectories are restored. Foreign files and folders alongside the repository are left untouched.

    If the base directory exists, contains foreign content, and is not already a FulcrumFS repository, an exception is thrown rather than initializing the directory as a repository.

    The instance is then initialized: it acquires the repository lock, which it holds until it is disposed, and upgrades a repository with an older format version than MinimumFormatVersion to that version, so the repository is at least at that version and FormatVersion reports the version it has. Like EnsureInitialized(), this method does not wait for the lock: if another instance holds the repository, it throws an IOException. This is what an overlapped restart looks like, since the previous process holds the lock until it exits, and waiting would not help because that process may hold it for minutes: do not restart a process that owns a repository with overlap, or open the repository lazily on first use rather than at startup. EnsureInitialized() is the variant that throws a DirectoryNotFoundException instead of creating a repository that does not exist. Both methods can be called any number of times.

    In ReadOnly mode this method behaves exactly as EnsureInitialized(): an existing repository is verified and opened without a lock, nothing is created, repaired or upgraded, and a DirectoryNotFoundException is thrown if the repository does not exist.

    Exceptions
    Type Condition
    InvalidOperationException

    The base directory contains content that does not belong to a FulcrumFS repository.

    DirectoryNotFoundException

    This instance was opened read-only and the repository does not exist or is in an incomplete state, which only an instance with full access can create or repair.

    IOException

    Another instance holds the repository lock, or another I/O error occurred.

    NotSupportedException

    The repository was created by a newer incompatible version of FulcrumFS.

    InvalidDataException

    The repository info file is malformed.

    © Singulink. All rights reserved.