Exemple #1
0
        public bool TryToAdvance(DateTime timestamp)
        {
            Check.Requires <InvalidOperationException>(timestamp > Timestamp);

            timestamp = EventID.GetTimestampDate(timestamp);

            if (Timestamp == timestamp)
            {
                if (Sequence >= EventID.MaxBatchSequence)
                {
                    return(false);
                }

                Sequence++;
            }
            else
            {
                this = new BatchID(timestamp);
            }

            return(true);
        }
Exemple #2
0
 public DefaultEventIDGenerator(EventID lastID, Clock clock)
 {
     _clock          = Check.NotNull(clock, nameof(clock));
     _currentBatchID = Check.NotNull(lastID, nameof(lastID)).BatchID;
 }