Exemple #1
0
 public void CanCreateTransactionBuffersList()
 {
     Assert.DoesNotThrow(() =>
     {
         _buffersList = new TransactionBuffersList(_bufferManager);
     });
 }
Exemple #2
0
        public void CanPinNewBuffer()
        {
            _buffersList = new TransactionBuffersList(_bufferManager);

            Assert.DoesNotThrow(() =>
            {
                _buffersList.PinNew(RandomFilename, new BasePageFormatter());
            });
        }
Exemple #3
0
        public void CannotGetUnusedBuffer()
        {
            _buffersList = new TransactionBuffersList(_bufferManager);

            var block = new Block(RandomFilename, 0);

            var buffer = _buffersList.GetBuffer(block);

            Assert.IsNull(buffer);
        }
Exemple #4
0
        public void CanPinBuffer()
        {
            _buffersList = new TransactionBuffersList(_bufferManager);

            _ = _fileManager.Append(RandomFilename, out var block);

            Assert.DoesNotThrow(() =>
            {
                _bufferManager.Pin(block);
            });
        }
Exemple #5
0
        public void CanPinMultipleTimes()
        {
            _buffersList = new TransactionBuffersList(_bufferManager);

            var block = new Block(RandomFilename, 0);

            Assert.DoesNotThrow(() =>
            {
                _buffersList.Pin(block);
                _buffersList.Pin(block);
                _buffersList.Pin(block);
            });
        }
Exemple #6
0
        public Transaction(
            ITransactionNumberDispatcher numberDispatcher,
            IBufferManager bufferManager,
            IConcurrencyManager concurrencyManager,
            IFileManager fileManager,
            ILogManager logManager)
        {
            _numberDispatcher   = numberDispatcher;
            _concurrencyManager = concurrencyManager;
            _fileManager        = fileManager;
            _bufferList         = new TransactionBuffersList(bufferManager);

            _transactionNumber = _numberDispatcher.GetNextTransactionNumber();
            _recoveryManager   = new RecoveryManager(bufferManager, logManager, _transactionNumber);
        }