Esempio n. 1
0
        public void CanTakeMultipleSharedLocks()
        {
            concurrencyManager = new ConcurrencyManager();

            var block = new Block(RandomFilename, 0);

            Assert.DoesNotThrow(() =>
            {
                concurrencyManager.SharedLock(block);
                concurrencyManager.SharedLock(block);
                concurrencyManager.SharedLock(block);
                concurrencyManager.SharedLock(block);
            });
        }
Esempio n. 2
0
        public int Length(string filename)
        {
            // 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.SharedLock(dummyBlock);

            var length = _fileManager.Length(filename) / _fileManager.BlockSize;

            return(length);
        }