public async Task Reset() { await this._store.TryDeleteEntityAsync <ProjectionCheckpoint>(this.ProjectionName); await Task.WhenAll(this.ViewBuckets.Select(this._store.Container.ResetAsync)); this._checkpoint = new ProjectionCheckpoint(); }
public void Initialize(NuclearStorage storage) { Condition.Requires(storage, "storage").IsNotNull(); if (this._checkpoint == null) { this._checkpoint = storage.GetEntityOrThrow <ProjectionCheckpoint>(this.ProjectionName); } this._store = storage; }
public async Task ResetUnitialized(IDocumentStore documentStore) { Condition.WithExceptionOnFailure <InvalidOperationException>().Requires(this._store, "_store").IsNull("ProjectionInfo is initialized, but is being reset with different document store"); var storage = new NuclearStorage(documentStore); await storage.TryDeleteEntityAsync <ProjectionCheckpoint>(this.ProjectionName); await Task.WhenAll(this.ViewBuckets.Select(documentStore.ResetAsync)); this._checkpoint = new ProjectionCheckpoint(); }
public ProjectionInfo(IEnumerable <ViewInfo> views, object tempProjection, IDocumentStrategy strategy) { Condition.Requires(views, "views").IsNotNull(); Condition.Requires(tempProjection, "tempProjection").IsNotNull(); Condition.Requires(strategy, "strategy").IsNotNull(); this.ViewBuckets = views.Select(v => v.StoreBucket).ToArray(); var viewTypes = views.Select(v => v.EntityType); var projectionType = tempProjection.GetType(); this.Hash = new ProjectionHash(projectionType, viewTypes, strategy.GetType()); this.ProjectionName = projectionType.Name; this._checkpoint = new ProjectionCheckpoint(); this._tempProjection = tempProjection; }