Exemplo n.º 1
0
        List <ReplayAction> IDestinationMailbox.GetActions(string replaySyncState, int maxNumberOfActions)
        {
            MrsTracer.Provider.Function("StorageDestinationMailbox.GetActions", new object[0]);
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            IActionsSource         actionsSource = new StorageActionsSource((MailboxSession)base.StoreSession);
            StorageActionWatermark storageActionWatermark;

            if ((storageActionWatermark = StorageActionWatermark.Deserialize(replaySyncState)) == null)
            {
                storageActionWatermark = new StorageActionWatermark
                {
                    TimeStamp = DateTime.UtcNow.AddHours(-1.0)
                };
            }
            IActionWatermark    watermark = storageActionWatermark;
            List <ReplayAction> list      = new List <ReplayAction>(maxNumberOfActions);

            foreach (ReplayAction item in actionsSource.ReadActions(watermark))
            {
                if (list.Count == maxNumberOfActions)
                {
                    break;
                }
                list.Add(item);
            }
            return(list);
        }
Exemplo n.º 2
0
        IEnumerable <ReplayAction> IActionsSource.ReadActions(IActionWatermark watermark)
        {
            MrsTracer.Provider.Function("StorageActionsSource.ReadActions", new object[0]);
            IActivityLog        activityLog = ActivityLogFactory.Current.Bind(this.mailboxSession);
            List <ReplayAction> actionsIndescendingOrder = new List <ReplayAction>(100);

            foreach (Activity activity in activityLog.Query())
            {
                if (activity.ClientId.LoggedViaServerSideInstrumentation)
                {
                    IActionWatermark actionWatermark = new StorageActionWatermark(activity);
                    if (watermark != null && watermark.CompareTo(actionWatermark) >= 0)
                    {
                        break;
                    }
                    ReplayAction replayAction = this.TryConvertToAction(activity, actionWatermark);
                    if (replayAction != null)
                    {
                        actionsIndescendingOrder.Add(replayAction);
                    }
                }
            }
            for (int index = actionsIndescendingOrder.Count - 1; index >= 0; index--)
            {
                yield return(actionsIndescendingOrder[index]);
            }
            yield break;
        }