ifile.cs

来自「Perst开源实时数据库」· CS 代码 · 共 61 行

CS
61
字号
namespace Perst
{
    /// <summary> Interface of file.
    /// Prorgemmer can provide its own impleentation of this interface, adding such features
    /// as support of flash cards, encrypted files,...
    /// Implentation of this interface should throw StorageError exception in case of failure
    /// </summary>
    public interface IFile 
    { 
        /// <summary> Write data to the file
        /// </summary>
        /// <param name="pos"> offset in the file
        /// </param>
        /// <param name="buf"> array with data to be writter (size is always equal to database page size)
        /// </param>
        /// 
        void Write(long pos, byte[] buf);

        /// <summary> Reade data from the file
        /// </summary>
        /// <param name="pos"> offset in the file
        /// </param>
        /// <param name="buf"> array to receive readen data (size is always equal to database page size)
        /// </param>
        /// <returns> param number of bytes actually readen
        /// </returns>
        int Read(long pos, byte[] buf);

        /// <summary> Flush all fiels changes to the disk
        /// </summary>
        void Sync();
    
        /// <summary>
        /// Prevent other processes from modifying the file
        /// </summary>
        void Lock();

        /// <summary> Close file
        /// </summary>
        void Close();

        /// <summary>
        /// Boolean property. Set to <c>true</c> to avoid flushing the stream, or <c>false</c> to flush the stream with every calls to <see cref="Sync"/>
        /// </summary>
        bool NoFlush
        {
            get;
            set;
        }

        /// <summary>
        /// Length of the file
        /// </summary>
        /// <returns>length of file in bytes</returns>
        long Length
        {
            get;
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?