Beispiel #1
0
        void Add(IProjection projection, Int64 defaultValue)
        {
            var id = projection.GetCommonName();
            var projectionSignature = projection.GetSignature();
            var projectionSlotName  = projection.GetSlotName();

            var checkPoint = _checkpoints.FindOneById(id) ??
                             new Checkpoint(id, defaultValue, projectionSignature);

            //Check if some projection is changed and rebuild is not active
            if (
                checkPoint.Signature != projectionSignature &&
                !RebuildSettings.ShouldRebuild)
            {
                _checkpointErrors.Add(String.Format("Projection {0} [slot {1}] has signature {2} but checkpoint on database has signature {3}.\n REBUILD NEEDED",
                                                    id, projectionSlotName, projectionSignature, checkPoint.Signature));
            }
            else
            {
                checkPoint.Signature = projectionSignature;
            }
            checkPoint.Slot   = projectionSlotName;
            checkPoint.Active = true;
            _checkpoints.Save(checkPoint, checkPoint.Id);
            _checkpointTracker[id] = checkPoint.Value;
            _projectionToSlot[id]  = checkPoint.Slot;
        }
        void Add(IProjection projection, string defaultValue)
        {
            var id         = projection.GetCommonName();
            var checkPoint = _checkpoints.FindOneById(id) ?? new Checkpoint(id, defaultValue);

            checkPoint.Signature = projection.GetSignature();
            checkPoint.Slot      = projection.GetSlotName();
            checkPoint.Active    = true;
            _checkpoints.Save(checkPoint);
            _checkpointTracker[id] = checkPoint.Value;
            _projectionToSlot[id]  = checkPoint.Slot;
        }
Beispiel #3
0
        public void RebuildEnded(IProjection projection, ProjectionMetrics.Meter meter)
        {
            var projectionName = projection.GetCommonName();

            _slotRebuildTracker[_projectionToSlot[projectionName]] = false;
            var checkpoint = _checkpoints.FindOneById(projectionName);

            checkpoint.RebuildStop = DateTime.UtcNow;
            if (checkpoint != null && checkpoint.RebuildStop.HasValue && checkpoint.RebuildStart.HasValue)
            {
                checkpoint.RebuildTotalSeconds = (long)(checkpoint.RebuildStop - checkpoint.RebuildStart).Value.TotalSeconds;
            }

            checkpoint.Events = meter.TotalEvents;
            checkpoint.RebuildActualSeconds = (double)meter.TotalElapsed / TimeSpan.TicksPerSecond;
            checkpoint.Details   = meter;
            checkpoint.Signature = projection.GetSignature();
            _checkpoints.Save(checkpoint, checkpoint.Id);
        }