public override int GetHashCode() { unchecked { return(((ShardName != null ? ShardName.GetHashCode() : 0) * 397) ^ Sequence.GetHashCode()); } }
protected AsyncProjectionShardBase(ShardName identifier, ISqlFragment[] eventFilters, DocumentStore store, AsyncOptions options) { Store = store; Name = identifier; EventFilters = eventFilters; Options = options; }
public override int GetHashCode() { unchecked { var hashCode = (ShardName != null ? ShardName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ SequenceFloor.GetHashCode(); hashCode = (hashCode * 397) ^ SequenceCeiling.GetHashCode(); return(hashCode); } }
public DeadLetterEvent(IEvent e, ShardName shardName, ApplyEventException ex) { ProjectionName = shardName.ProjectionName; ShardName = shardName.Key; Timestamp = DateTimeOffset.UtcNow; ExceptionMessage = ex.Message; EventSequence = e.Sequence; ExceptionType = ex.InnerException?.GetType().NameInCode(); }
/// <summary> /// Use to "wait" for an expected projection shard state /// </summary> /// <param name="name"></param> /// <param name="sequence"></param> /// <param name="timeout"></param> /// <returns></returns> public Task <ShardState> WaitForShardState(ShardName name, long sequence, TimeSpan?timeout = null) { if (_states.TryFind(name.Identity, out var state)) { if (state.Sequence >= sequence) { return(Task.FromResult(state)); } } return(WaitForShardState(new ShardState(name.Identity, sequence), timeout)); }
public async Task Load(ShardName projectionShardName, EventRange range, CancellationToken token) { using var session = (QuerySession)_store.QuerySession(); // There's an assumption here that this method is only called sequentially // and never at the same time on the same instance _statement.Range = range; try { range.Events = new List <IEvent>(await session.ExecuteHandlerAsync(_handler, token).ConfigureAwait(false)); } catch (Exception e) { throw new EventFetcherException(projectionShardName, e); } }
public async Task Load(ShardName projectionShardName, EventRange range, CancellationToken token) { if (_session == null) { reset(); } _cancellation.CancelAfter(5.Seconds()); // There's an assumption here that this method is only called sequentially // and never at the same time on the same instance _statement.Range = range; try { range.Events = await _session.ExecuteHandlerAsync(_handler, token); } catch (Exception e) { throw new EventFetcherException(projectionShardName, e); } }
public AsyncProjectionShard(string shardName, ProjectionSource source, ISqlFragment[] filters) { Name = new ShardName(source.ProjectionName, shardName); EventFilters = filters.Concat(new ISqlFragment[] { IsNotArchivedFilter.Instance }).ToArray(); Source = source; }
public ProjectionController(ShardName shardName, IProjectionUpdater updater, AsyncOptions options) { _shardName = shardName; _updater = updater; _options = options ?? new AsyncOptions(); }
/// <summary> /// Use to "wait" for an expected projection shard state /// </summary> /// <param name="name"></param> /// <param name="sequence"></param> /// <param name="timeout"></param> /// <returns></returns> public Task <ShardState> WaitForShardState(ShardName name, long sequence, TimeSpan?timeout = null) { return(WaitForShardState(new ShardState(name.Identity, sequence), timeout)); }
public EventFetcherException(ShardName name, Exception innerException) : base($"Failure while trying to load events for projection shard '{name}'", innerException) { }
public EventRange(ShardName shardName, long ceiling) { ShardName = shardName; SequenceCeiling = ceiling; }
public EventFetcherException(ShardName name, IMartenDatabase martenDatabase, Exception innerException) : base($"Failure while trying to load events for projection shard '{name}@{martenDatabase.Identifier}'", innerException) { }
public ShardState(ShardName shardName, long sequence) : this(shardName.Identity, sequence) { }
public AsyncProjectionShard(ProjectionSource source, ISqlFragment[] filters) { Name = new ShardName(source.ProjectionName); EventFilters = filters; Source = source; }
public ShardStartException(ShardName name, Exception innerException) : base($"Failure while trying to stop '{name.Identity}'", innerException) { }
public ProjectionController(ShardName shardName, IShardAgent agent, AsyncOptions options) { _shardName = shardName; _agent = agent; _options = options ?? new AsyncOptions(); }
public AsyncProjectionShard(ShardName identifier, IProjection projection, ISqlFragment[] eventFilters, DocumentStore store, AsyncOptions options) : base(identifier, eventFilters, store, options) { _projection = projection; }