Beispiel #1
0
        public void setup()
        {
            //given
            _cache = new PartitionStateCache(10);
            _cachedAtCheckpointTag1 = CheckpointTag.FromPosition(1000, 900);
            for (var i = 0; i < 15; i++)
            {
                CheckpointTag at = CheckpointTag.FromPosition(1000 + (i * 100), 1000 + (i * 100) - 50);
                _cache.CacheAndLockPartitionState("partition1", new PartitionStateCache.State("data1", at), at);
            }

            _cachedAtCheckpointTag2 = CheckpointTag.FromPosition(20100, 20050);
            _cachedAtCheckpointTag3 = CheckpointTag.FromPosition(20200, 20150);
            _cache.CacheAndLockPartitionState("partition1", new PartitionStateCache.State("data1", _cachedAtCheckpointTag1), _cachedAtCheckpointTag1);
            _cache.CacheAndLockPartitionState("partition2", new PartitionStateCache.State("data2", _cachedAtCheckpointTag2), _cachedAtCheckpointTag2);
            _cache.CacheAndLockPartitionState("partition3", new PartitionStateCache.State("data3", _cachedAtCheckpointTag3), _cachedAtCheckpointTag3);
            _cache.Unlock(_cachedAtCheckpointTag2);
            // when
            _cache.Initialize();
        }