示例#1
0
文件: Block.cs 项目: codellica/MyDB
        public Block(long id, BlockOptions options, Stream stream)
        {
            Id                      = id;
            _options                = options;
            _stream                 = stream;
            _blockHeadersCount      = options.BlockHeaderSize / _1B;
            _cachedHeaders          = BlockHeader.ToDictionary <long?>();
            _blockFirstSector       = new byte[_options.DiskSectorSize];
            _originPositionInStream = Id * _options.BlockSize;

            ReadBlockFirstSector();
        }
示例#2
0
 public BlockStorage(Stream stream, BlockOptions options)
 {
     _stream  = stream ?? throw new ArgumentNullException(nameof(stream));
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }