public override void ApplySlotChanges(IVisitable slotChangeTree, int slotChangeCount
                                              , Slot reservedSlot)
        {
            if (slotChangeCount < 1)
            {
                return;
            }
            var commitHook = _container.CommitHook();

            FlushDatabaseFile();
            EnsureLogAndLock();
            var length    = TransactionLogSlotLength(slotChangeCount);
            var logBuffer = new ByteArrayBuffer(length);

            logBuffer.WriteInt(length);
            logBuffer.WriteInt(slotChangeCount);
            AppendSlotChanges(logBuffer, slotChangeTree);
            Write(_logFile, logBuffer);
            _logFile.Sync();
            WriteToLockFile(LockInt);
            WriteSlots(slotChangeTree);
            commitHook.Run();
            FlushDatabaseFile();
            WriteToLockFile(0);
        }
Example #2
0
 public virtual void Sync()
 {
     lock (this)
     {
         _bin.Sync();
     }
 }
        private void WriteToLockFile(int lockSignal)
        {
            var lockBuffer = NewLockFileBuffer();

            lockBuffer.WriteInt(lockSignal);
            lockBuffer.WriteInt(lockSignal);
            Write(_lockFile, lockBuffer);
            _lockFile.Sync();
        }
 protected virtual void Close()
 {
     if (null != _bin)
     {
         _bin.Sync();
         _bin.Close();
         _bin = null;
     }
 }
Example #5
0
            private long BackupLength()
            {
                IBin backupBin = BackupStorage().Open(new BinConfiguration(TempFile(), true, 0, true
                                                                           ));
                long backupLength = backupBin.Length();

                backupBin.Sync();
                backupBin.Close();
                return(backupLength);
            }
 private void SyncAndClose(IBin bin)
 {
     try
     {
         bin.Sync();
     }
     finally
     {
         bin.Close();
     }
 }
Example #7
0
 private static void SyncAndClose(IBin bin)
 {
     if (bin != null)
     {
         try
         {
             bin.Sync();
         }
         finally
         {
             bin.Close();
         }
     }
 }
Example #8
0
 /// <seealso cref="IBin.Sync()">IBin.Sync()</seealso>
 public virtual void Sync()
 {
     _bin.Sync();
 }
		private static void SyncAndClose(IBin bin)
		{
			if (bin != null)
			{
				try
				{
					bin.Sync();
				}
				finally
				{
					bin.Close();
				}
			}
		}
Example #10
0
 public virtual void Replay(IBin bin)
 {
     bin.Sync();
 }
Example #11
0
		public virtual void Replay(IBin bin)
		{
			bin.Sync();
		}
		private void SyncAndClose(IBin bin)
		{
			try
			{
				bin.Sync();
			}
			finally
			{
				bin.Close();
			}
		}