Пример #1
0
        public void CanTakeExclusiveLockIfAlreadyTaken()
        {
            var lockTable = new LockTable(TimeSpan.FromMilliseconds(300), TimeSpan.FromMilliseconds(100));

            concurrencyManager = new ConcurrencyManager();

            var block = new Block(RandomFilename, 0);

            Assert.DoesNotThrow(() =>
            {
                concurrencyManager.ExclusiveLock(block);
                concurrencyManager.ExclusiveLock(block);
            });
        }
Пример #2
0
        public void CanTakeExclusiveLock()
        {
            concurrencyManager = new ConcurrencyManager();

            var block = new Block(RandomFilename, 0);

            Assert.DoesNotThrow(() =>
            {
                concurrencyManager.ExclusiveLock(block);
            });
        }
Пример #3
0
        public Block Append(string filename, IPageFormatter pageFormatter)
        {
            // A dummy block because honestly we do not care about block, we need to get length of this file
            var dummyBlock = new Block(filename, -1);

            _concurrencyManager.ExclusiveLock(dummyBlock);

            var lastBlock = _bufferList.PinNew(filename, pageFormatter);

            return(lastBlock);
        }