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

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

            var block = new Block(RandomFilename, 0);

            var buffer = _buffersList.GetBuffer(block);

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

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

            Assert.DoesNotThrow(() =>
            {
                _bufferManager.Pin(block);
            });
        }
Esempio n. 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);
            });
        }
Esempio n. 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);
        }