ActivityStreams.Persistence.DefaultActivityRepository.Load C# (CSharp) Method

Load() public method

FanIn
public Load ( ActivityStream stream, ActivityStreamOptions feedOptions ) : IEnumerable
stream ActivityStream
feedOptions ActivityStreamOptions
return IEnumerable
        public IEnumerable<Activity> Load(ActivityStream stream, ActivityStreamOptions feedOptions)
        {
            // At this point we have all the streams with their timestamp
            Dictionary<byte[], long> streamsToLoad = new StreamCrawler(streamStore).StreamsToLoad(stream, feedOptions.Paging.Timestamp);
            Dictionary<string, DateTime> debug = streamsToLoad.ToDictionary(key => Encoding.UTF8.GetString(key.Key), val => DateTime.FromFileTimeUtc(val.Value));

            feedOptions = feedOptions ?? ActivityStreamOptions.Default;

            var snapshot = GetSnapshot(streamsToLoad, feedOptions);

            SortedSet<Activity> buffer = new SortedSet<Activity>(Activity.ComparerDesc);

            //  Init
            foreach (var str in streamsToLoad)
            {
                var streamId = str.Key;
                FetchNextActivity(snapshot, streamId, buffer);
            }

            while (buffer.Count > 0)
            {
                Activity nextActivity = buffer.First();
                buffer.Remove(nextActivity);
                yield return nextActivity;

                FetchNextActivity(snapshot, nextActivity.StreamId, buffer);
            }
        }