Пример #1
0
        public void CannotGetUnusedBuffer()
        {
            _buffersList = new TransactionBuffersList(_bufferManager);

            var block = new Block(RandomFilename, 0);

            var buffer = _buffersList.GetBuffer(block);

            Assert.IsNull(buffer);
        }
Пример #2
0
        public void CanGetTransactionBuffer()
        {
            _buffersList = new TransactionBuffersList(_bufferManager);

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

            Assert.DoesNotThrow(() =>
            {
                _buffersList.Pin(block);
            });

            var buffer = _buffersList.GetBuffer(block);

            Assert.IsNotNull(buffer);
        }
Пример #3
0
        public bool GetInt(Block block, int offset, out int value)
        {
            _concurrencyManager.SharedLock(block);
            var buffer = _bufferList.GetBuffer(block);

            return(buffer.GetInt(offset, out value));
        }