Files
VirtualFS/VirtualFS/IRootFileSystem.cs
grzegorz.russek 5f748e55a2 Initial commit
2024-05-15 09:38:41 +02:00

69 lines
3.3 KiB
C#

/*
* VirtualFS - Virtual File System library.
* Copyright (c) 2013, Grzegorz Russek (grzegorz.russek@gmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Collections.Generic;
namespace VirtualFS
{
/// <summary>Interface describing root file system.</summary>
public interface IRootFileSystem : IFileSystem
{
/// <summary>Gets root of the file system.</summary>
Directory Root { get; }
/// <summary>Mount file system in given path.</summary>
/// <remarks>Mounting another file system can overlap, you
/// can mount several file systems in a given directory.
/// Mount path can't be a file. You can mount file system
/// in file system in file system and so on... When opening
/// a file which might exist on any of those file systems
/// last mounted is taken to consideration first.</remarks>
/// <param name="fs">File system to mount.</param>
/// <param name="path">Path on which mount new file system.</param>
/// <returns>Returns <c>true</c> if file system was mounted
/// correctly, otherwise <c>false</c>.</returns>
bool Mount(IFileSystem fs, Path path);
/// <summary>Un mounts file system from current file system.</summary>
/// <remarks>All file systems mounted previously in path owned by
/// this file system will remain mounted and accessible.</remarks>
/// <param name="fs">File system to un mount.</param>
/// <returns>Returns <c>true</c> if file system was un mounted
/// correctly, otherwise <c>false</c>.</returns>
bool Umount(IFileSystem fs);
/// <summary>Enumerate mounted file systems.</summary>
/// <returns>Enumeration of mounted file systems.</returns>
IEnumerable<IFileSystem> GetMounted();
/// <summary>Get mount path of this file system.</summary>
/// <param name="fileSystem">File system to check.</param>
/// <returns>Path to file system on root file system.</returns>
Path GetMountPath(IFileSystem fileSystem);
}
}