internal static WriteAction Read(IFileSystemInterface fsi) { try { var position = fsi.ReadLong(); var size = fsi.ReadInt(); var bytes = fsi.ReadBytes(size); var writeAction = new WriteAction(position, bytes); Log4NetHelper.Instance.LogDebugMessage(string.Format("Transaction WriteAction: Loading Write Action at {0} => {1}", fsi.GetPosition(), writeAction)); return(writeAction); } catch (OdbRuntimeException) { Log4NetHelper.Instance.LogErrorMessage(string.Format("Transaction WriteAction: error reading write action at position {0}", fsi.GetPosition())); throw; } }
internal static WriteAction Read(IFileSystemInterface fsi) { try { var position = fsi.ReadLong(); var size = fsi.ReadInt(); var bytes = fsi.ReadBytes(size); var writeAction = new WriteAction(position, bytes); if (OdbConfiguration.IsLoggingEnabled()) { DLogger.Debug(string.Format("Transaction WriteAction: Loading Write Action at {0} => {1}", fsi.GetPosition(), writeAction)); } return(writeAction); } catch (OdbRuntimeException) { DLogger.Error(string.Format("Transaction WriteAction: error reading write action at position {0}", fsi.GetPosition())); throw; } }
public void ReadDatabaseHeader() { var version = ReadDatabaseVersion(); StorageEngineConstant.CheckDbVersionCompatibility(version); var databaseIdsArray = new long[4]; databaseIdsArray[0] = _fsi.ReadLong(); databaseIdsArray[1] = _fsi.ReadLong(); databaseIdsArray[2] = _fsi.ReadLong(); databaseIdsArray[3] = _fsi.ReadLong(); IDatabaseId databaseId = new DatabaseId(databaseIdsArray); var nbClasses = ReadNumberOfClasses(); var firstClassPosition = ReadFirstClassOid(); if (nbClasses < 0) { throw new CorruptedDatabaseException( NDatabaseError.NegativeClassNumberInHeader.AddParameter(nbClasses).AddParameter(firstClassPosition)); } ReadLastOdbCloseStatus(); ReadDatabaseCharacterEncoding(); var currentBlockPosition = _fsi.ReadLong(); // Gets the current id block number _fsi.SetReadPosition(currentBlockPosition + StorageEngineConstant.BlockIdOffsetForBlockNumber); var currentBlockIdNumber = _fsi.ReadInt(); var blockMaxId = OIDFactory.BuildObjectOID(_fsi.ReadLong()); _storageEngine.SetDatabaseId(databaseId); var currentBlockInfo = new CurrentIdBlockInfo { CurrentIdBlockPosition = currentBlockPosition, CurrentIdBlockNumber = currentBlockIdNumber, CurrentIdBlockMaxOid = blockMaxId }; _storageEngine.SetCurrentIdBlockInfos(currentBlockInfo); }
internal static WriteAction Read(IFileSystemInterface fsi) { try { var position = fsi.ReadLong(); var size = fsi.ReadInt(); var bytes = fsi.ReadBytes(size); var writeAction = new WriteAction(position, bytes); if (OdbConfiguration.IsLoggingEnabled()) DLogger.Debug(string.Format("Transaction WriteAction: Loading Write Action at {0} => {1}", fsi.GetPosition(), writeAction)); return writeAction; } catch (OdbRuntimeException) { DLogger.Error(string.Format("Transaction WriteAction: error reading write action at position {0}", fsi.GetPosition())); throw; } }