private void SaveMetaInfStorage(MetaInfDataStorage meta) { _fileStream.Seek(-GetCalculateMetaInfDataStorageSize(), SeekOrigin.End); ZeroFormatterSerializer.Serialize(_fileStream, meta); metaInfDataStorage = LoadMetaInfStorage(); writeCount++; }
public TableFileManager(FileStream fs_, Table table, int blockSize) { _fileStream = fs_; using var memStream = new MemoryStream(); ZeroFormatterSerializer.Serialize(memStream, table.TableMetaInf); var metaInfStorage = new MetaInfDataStorage { TableMetaInfSize = (int)memStream.Length, RowRecordSize = CalculateRowRecordSize(table), DataBlockSize = blockSize, HeadDataBlockList = 0, HeadFreeBlockList = 0 }; memStream.WriteTo(_fileStream); CreateMetaInfInEnd(metaInfStorage); metaInfDataStorage = LoadMetaInfStorage(); }
private static int GetCalculateMetaInfDataStorageSize() { using var memStream = new MemoryStream(); var dataBlock = new MetaInfDataStorage { DataBlockSize = int.MaxValue, RowRecordSize = int.MaxValue, HeadDataBlockList = int.MaxValue, HeadFreeBlockList = int.MaxValue, TableMetaInfSize = int.MaxValue }; ZeroFormatterSerializer.Serialize(memStream, dataBlock); return((int)memStream.Length); }
private void CreateMetaInfInEnd(MetaInfDataStorage meta) { _fileStream.Seek(0, SeekOrigin.End); ZeroFormatterSerializer.Serialize(_fileStream, meta); metaInfDataStorage = LoadMetaInfStorage(); }
public TableFileManager(FileStream fileStream) { _fileStream = fileStream; metaInfDataStorage = LoadMetaInfStorage(); }