Provides read/write access to all of the different types of disk types to use to store the file structure.
Inheritance: IDisposable
Ejemplo n.º 1
0
        public static DiskIo OpenFile(string fileName, MemoryPool pool, bool isReadOnly)
        {
            CustomFileStream fileStream = CustomFileStream.OpenFile(fileName, pool.PageSize, out int fileStructureBlockSize, isReadOnly, true);
            DiskMedium       disk       = DiskMedium.OpenFile(fileStream, pool, fileStructureBlockSize);

            return(new DiskIo(disk, isReadOnly));
        }
Ejemplo n.º 2
0
        public static DiskIo CreateFile(string fileName, MemoryPool pool, int fileStructureBlockSize, params Guid[] flags)
        {
            //Exclusive opening to prevent duplicate opening.
            CustomFileStream fileStream = CustomFileStream.CreateFile(fileName, pool.PageSize, fileStructureBlockSize);
            DiskMedium       disk       = DiskMedium.CreateFile(fileStream, pool, fileStructureBlockSize, flags);

            return(new DiskIo(disk, false));
        }
Ejemplo n.º 3
0
 private DiskIo(DiskMedium stream, bool isReadOnly)
 {
     if (stream == null)
         throw new ArgumentNullException("stream");
     m_isReadOnly = isReadOnly;
     m_blockSize = stream.BlockSize;
     m_stream = stream;
 }
Ejemplo n.º 4
0
 private DiskIo(DiskMedium stream, bool isReadOnly)
 {
     if (stream is null)
     {
         throw new ArgumentNullException("stream");
     }
     m_isReadOnly = isReadOnly;
     m_blockSize  = stream.BlockSize;
     m_stream     = stream;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Releases the unmanaged resources used by the <see cref="DiskIo"/> object and optionally releases the managed resources.
 /// </summary>
 public void Dispose()
 {
     if (!m_disposed)
     {
         try
         {
             if (m_stream != null)
             {
                 m_stream.Dispose();
             }
         }
         finally
         {
             GC.SuppressFinalize(this);
             m_stream   = null;
             m_disposed = true;
         }
     }
 }
Ejemplo n.º 6
0
        public static DiskIo CreateMemoryFile(MemoryPool pool, int fileStructureBlockSize, params Guid[] flags)
        {
            DiskMedium disk = DiskMedium.CreateMemoryFile(pool, fileStructureBlockSize, flags);

            return(new DiskIo(disk, false));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Releases the unmanaged resources used by the <see cref="DiskIo"/> object and optionally releases the managed resources.
 /// </summary>
 public void Dispose()
 {
     if (!m_disposed)
     {
         try
         {
             if (m_stream != null)
             {
                 m_stream.Dispose();
             }
         }
         finally
         {
             GC.SuppressFinalize(this);
             m_stream = null;
             m_disposed = true;
         }
     }
 }