Beispiel #1
0
        private Int64 GetStartCheckpointForSlot(string slotName)
        {
            Int64 min = Int64.MaxValue;

            if (RebuildSettings.ShouldRebuild)
            {
                throw new JarvisFrameworkEngineException("Projection engine is not used anymore for rebuild. Rebuild is done with the specific RebuildProjectionEngine");
            }

            if (_projectionsBySlot.TryGetValue(slotName, out var projections))
            {
                foreach (var projection in projections)
                {
                    var  checkpointToken = _checkpointTracker.GetFullCheckpoint(projection);
                    long currentValue    = checkpointToken?.Current ?? 0L;

                    if (checkpointToken?.Current == null && checkpointToken?.Value > 0)
                    {
                        throw new JarvisFrameworkEngineException(
                                  $"Slot {slotName} for projection {projection.Info.CommonName} has current value equal to null and Value equal to {checkpointToken.Value}. This identify an interrupted rebuild, the slot MUST be rebuilded");
                    }

                    if (currentValue < min)
                    {
                        min = currentValue;
                    }
                }
            }
            return(min);
        }