Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VirtualFileSystem"/> class.
        /// Create new file system.
        /// </summary>
        internal VirtualFileSystem([NotNull] IDirectDiskAccess diskAccess, ulong newVolumeSize)
        {
            Validate.ArgumentNotNull(diskAccess, "diskAccess");

            _diskAccess = diskAccess;
            _record = MasterRecord.CreateNewVolume(diskAccess, newVolumeSize);
            _record.Save();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VirtualFileSystem"/> class.
        /// Load existing file system.
        /// </summary>
        internal VirtualFileSystem([NotNull] IDirectDiskAccess diskAccess)
        {
            Validate.ArgumentNotNull(diskAccess, "diskAccess");

            _diskAccess = diskAccess;
            _record = new MasterRecord(diskAccess);
            _record.Load();
        }
Пример #3
0
        private ulong _size; // will mean file size, bytes for file node, and number of entries for directory node.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Node"/> class.
        /// </summary>
        /// <param name="blockAllocator">The block allocator.</param>
        /// <param name="diskAccess">The disk access.</param>
        /// <param name="address">The address.</param>
        /// <param name="globalBlockStartAddress">The global block start address.</param>
        public Node(
            [NotNull] IBlockAllocator blockAllocator,
            [NotNull] IDirectDiskAccess diskAccess,
            [NotNull] Address address,
            [NotNull] Address globalBlockStartAddress)
        {
            Validate.ArgumentNotNull(blockAllocator, "blockAllocator");
            Validate.ArgumentNotNull(diskAccess, "diskAccess");
            Validate.ArgumentNotNull(address, "address");
            Validate.ArgumentNotNull(globalBlockStartAddress, "globalBlockStartAddress");

            _address = address;
            DiskAccess = diskAccess;
            Storage = new BlockAddressStorage(
                diskAccess, blockAllocator, new Address(_address.Value + 25), globalBlockStartAddress);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BlockAddressStorage"/> class.
        /// </summary>
        /// <param name="diskAccess">The disk access interface.</param>
        /// <param name="allocator">The allocator interface.</param>
        /// <param name="storageAddress">The current instance start address in disk storage.</param>
        /// <param name="globalBlocksStartAddress">The global blocks start address, used to calculate offsets and block indexes.</param>
        public BlockAddressStorage(
            [NotNull] IDirectDiskAccess diskAccess,
            [NotNull] IBlockAllocator allocator,
            [NotNull] Address storageAddress,
            [NotNull] Address globalBlocksStartAddress)
        {
            Validate.ArgumentNotNull(diskAccess, "diskAccess");
            Validate.ArgumentNotNull(allocator, "allocator");
            Validate.ArgumentNotNull(storageAddress, "storageAddress");
            Validate.ArgumentNotNull(globalBlocksStartAddress, "globalBlocksStartAddress");

            _address = storageAddress;
            _diskAccess = diskAccess;
            _allocator = allocator;
            _globalBlocksStartAddress = globalBlocksStartAddress;
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MasterRecord"/> class.
        /// </summary>
        /// <param name="diskAccess">The disk access interface.</param>
        public MasterRecord([NotNull] IDirectDiskAccess diskAccess)
        {
            Validate.ArgumentNotNull(diskAccess, "diskAccess");

            _diskAccess = diskAccess;
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SparseWriter"/> class.
        /// </summary>
        /// <param name="diskAccess">The direct disk access interface.</param>
        public SparseWriter([NotNull] IDirectDiskAccess diskAccess)
        {
            Validate.ArgumentNotNull(diskAccess, "diskAccess");

            _diskAccess = diskAccess;
        }