Esempio n. 1
0
        /// <summary>
        /// Discovers existed segments
        /// </summary>
        public static DiskQueueSegmentWrapper <T>[] DiscoverSegmentsWrapped <T>(this DiskQueueSegmentFactory <T> factory, string path)
        {
            Debug.Assert(factory != null);
            var discovered = factory.DiscoverSegments(path);

            if (discovered == null)
            {
                throw new InvalidOperationException("Existed segment discovery returned null");
            }

            DiskQueueSegmentWrapper <T>[] result = new DiskQueueSegmentWrapper <T> [discovered.Length];
            for (int i = 0; i < discovered.Length; i++)
            {
                result[i] = new DiskQueueSegmentWrapper <T>(discovered[i]);
            }

            return(result);
        }