DBreeze.Storage.RISR.Rollback C# (CSharp) Method

Rollback() public method

Standard and transactional rollback
public Rollback ( ) : void
return void
        public void Rollback()
        {
            try
            {
                lock (lock_fs)
                {
                    //Clearing random buffer
                    if (_randBuf.Count() != 0)
                    {
                        usedBufferSize = 0;
                        _randBuf.Clear();
                    }

                    //Restoring Rollback records
                    byte[] btWork = null;

                    if (_rollbackCache.Count() > 0)
                    {

                        foreach (var rb in _rollbackCache)
                        {
                            btWork = new byte[rb.Value.l];

                            RIC.RollbackFilePosition = rb.Value.o;
                            RIC.RollbackFileRead(btWork, 0, btWork.Length);
                            //_fsRollback.Position = rb.Value.o;
                            //_fsRollback.Read(btWork, 0, btWork.Length);

                            RIC.DataFilePosition = rb.Key;
                            RIC.DataFileWrite(btWork, 0, btWork.Length,false);
                            //_fsData.Position = rb.Key;
                            //_fsData.Write(btWork, 0, btWork.Length);

                            if (_backupIsActive)
                            {
                                this._configuration.Backup.WriteBackupElement(ulFileName, 0, rb.Key, btWork);
                            }
                        }

                        RIC.DataFileFlush();
                       // NET_Flush(_fsData);

                         if (_backupIsActive)
                        {
                            this._configuration.Backup.Flush();
                        }

                        //Restoring rhp
                        eofRollback = 0;

                        RIC.RollbackHelperFilePosition = 0;
                        RIC.RollbackHelperFileWrite(eofRollback.To_8_bytes_array_BigEndian(), 0, 8, true);
                        //_fsRollbackHelper.Position = 0;
                        //_fsRollbackHelper.Write(eofRollback.To_8_bytes_array_BigEndian(), 0, 8);
                        //NET_Flush(_fsRollbackHelper);

                        if (_backupIsActive)
                        {
                            this._configuration.Backup.WriteBackupElement(ulFileName, 2, 0, eofRollback.To_8_bytes_array_BigEndian());
                            this._configuration.Backup.Flush();
                        }

                        //Clearing rollbackCache
                        _rollbackCache.Clear();

                    }

                    //we dont move eofData, space can be re-used up to next restart (may be root can have this info in next protocols)
                    //eofData = this._fsData.Length;
                }
            }
            catch (Exception ex)
            {
                IsOperable = false;
                throw DBreezeException.Throw(DBreezeException.eDBreezeExceptions.RESTORE_ROLLBACK_DATA_FAILED, this._fileName, ex);
            }
        }