/// <summary> /// Construct my default state. /// </summary> /// <param name="streamName">the string unique identity of this entity</param> protected Sourced(string?streamName) { StreamName = streamName != null ? streamName : Address.IdString; _currentVersion = 0; _journalInfo = Info(); _interest = SelfAs <IAppendResultInterest>(); }
public FeedTest(ITestOutputHelper output) { var converter = new Converter(output); Console.SetOut(converter); _world = World.StartWithDefaults("feed-test"); _dispatcher = new MockJournalDispatcher(); _journal = _world.ActorFor <IJournal <string> >(() => new InMemoryJournalActor <string>(_dispatcher)); _entryReader = _journal.JournalReader("feed-test-reader").Await <IJournalReader>(); _consumer = new MockFeedConsumer(); _interest = NoOpInterest(); }
public void AppendWith <TSource, TSnapshotState>(string streamName, int streamVersion, TSource source, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : ISource { if (!actor.IsStopped) { Action <IJournal <T> > cons1922720892 = __ => __.AppendWith(streamName, streamVersion, source, snapshot, interest, @object); if (mailbox.IsPreallocated) { mailbox.Send(actor, cons1922720892, null, AppendWithRepresentation5); } else { mailbox.Send(new LocalMessage <IJournal <T> >(actor, cons1922720892, AppendWithRepresentation5)); } } else { actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, AppendWithRepresentation5)); } }
public void AppendAll <TSource>(string streamName, int fromStreamVersion, IEnumerable <ISource> sources, IAppendResultInterest interest, object @object) where TSource : ISource { if (!actor.IsStopped) { Action <IJournal <T> > cons1438749561 = __ => __.AppendAll <TSource>(streamName, fromStreamVersion, sources, interest, @object); if (mailbox.IsPreallocated) { mailbox.Send(actor, cons1438749561, null, AppendAllRepresentation7); } else { mailbox.Send(new LocalMessage <IJournal <T> >(actor, cons1438749561, AppendAllRepresentation7)); } } else { actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, AppendAllRepresentation7)); } }
public void Append <TSource>(string streamName, int streamVersion, TSource source, Metadata metadata, IAppendResultInterest interest, object @object) where TSource : ISource { if (!actor.IsStopped) { Action <IJournal <T> > cons397294566 = __ => __.Append(streamName, streamVersion, source, metadata, interest, @object); if (mailbox.IsPreallocated) { mailbox.Send(actor, cons397294566, null, AppendRepresentation4); } else { mailbox.Send(new LocalMessage <IJournal <T> >(actor, cons397294566, AppendRepresentation4)); } } else { actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, AppendRepresentation4)); } }
public JournalProjectionDispatcherTest(ITestOutputHelper output) { var converter = new Converter(output); Console.SetOut(converter); _world = World.StartWithDefaults("test-journal-projections"); _accessHolder = new AccessHolder(); var descriptions = new List <ProjectToDescription> { ProjectToDescription <OneHappenedProjectionActor> .With <OneHappened>(() => new OneHappenedProjectionActor(_accessHolder)), ProjectToDescription <TwoHappenedProjectionActor> .With <TwoHappened>(() => new TwoHappenedProjectionActor(_accessHolder)), ProjectToDescription <AllHappenedProjectionActor> .With <OneHappened>(() => new AllHappenedProjectionActor(_accessHolder)) .AndWith <TwoHappened>() .AndWith <ThreeHappened>() }; var dispatcherProtocols = _world.Stage.ActorFor( new[] { typeof(IDispatcher), typeof(IProjectionDispatcher) }, Definition.Has(() => new TextProjectionDispatcherActor(descriptions))); var dispatchers = Protocols.Two <IDispatcher, IProjectionDispatcher>(dispatcherProtocols); var dispatcher = dispatchers._1; _journal = Journal <string> .Using <InMemoryJournalActor <string> >(_world.Stage, dispatcher); EntryAdapterProvider.Instance(_world).RegisterAdapter(new OneHappenedAdapter()); EntryAdapterProvider.Instance(_world).RegisterAdapter(new TwoHappenedAdapter()); EntryAdapterProvider.Instance(_world).RegisterAdapter(new ThreeHappenedAdapter()); _appendInterest = _world.Stage.ActorFor <IAppendResultInterest>(() => new JournalAppendResultInterest()); }
public void AppendAllWith <TSource, TSnapshotState>(string streamName, int fromStreamVersion, IEnumerable <TSource> sources, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : Source { throw new NotImplementedException(); }
public override void AppendAll <TSource>(string streamName, int fromStreamVersion, IEnumerable <ISource> sources, Metadata metadata, IAppendResultInterest interest, object @object) { var sourcesForEntries = sources.ToList(); var entries = _entryAdapterProvider.AsEntries <TSource, IEntry <T> >(sourcesForEntries, fromStreamVersion, metadata); var dispatchableEntries = entries.ToList(); Insert(streamName, fromStreamVersion, dispatchableEntries); Dispatch(streamName, fromStreamVersion, dispatchableEntries, null); interest.AppendAllResultedIn(Success.Of <StorageException, Result>(Result.Success), streamName, fromStreamVersion, sourcesForEntries, Optional.Empty <object>(), @object); }
public override void AppendWith <TSource, TSnapshotState>(string streamName, int streamVersion, TSource source, Metadata metadata, TSnapshotState snapshot, IAppendResultInterest interest, object @object) { var entry = _entryAdapterProvider.AsEntry <TSource, IEntry>(source, streamVersion, metadata); Insert(streamName, streamVersion, entry); IState?raw; Optional <TSnapshotState> snapshotResult; if (snapshot != null) { raw = _stateAdapterProvider.AsRaw <TSnapshotState, IState>(streamName, snapshot, streamVersion); _snapshots.Add(streamName, raw); snapshotResult = Optional.Of(snapshot); } else { raw = null; snapshotResult = Optional.Empty <TSnapshotState>(); } Dispatch(streamName, streamVersion, new List <IEntry> { entry }, raw); interest.AppendResultedIn(Success.Of <StorageException, Result>(Result.Success), streamName, streamVersion, source, snapshotResult, @object); }
public override void Append <TSource>(string streamName, int streamVersion, TSource source, Metadata metadata, IAppendResultInterest interest, object @object) { var entry = _entryAdapterProvider.AsEntry <TSource, IEntry>(source, streamVersion, metadata); Insert(streamName, streamVersion, entry); Dispatch(streamName, streamVersion, new List <IEntry> { entry }, null); interest.AppendResultedIn(Success.Of <StorageException, Result>(Result.Success), streamName, streamVersion, source, Optional.Empty <object>(), @object); }
public override void AppendAllWith <TSource, TSnapshotState>(string streamName, int fromStreamVersion, IEnumerable <ISource> sources, Metadata metadata, TSnapshotState snapshot, IAppendResultInterest interest, object @object) { var sourcesForEntries = sources.ToList(); var entries = _entryAdapterProvider.AsEntries <TSource, IEntry <T> >(sourcesForEntries, fromStreamVersion, metadata); var dispatchableEntries = entries.ToList(); Insert(streamName, fromStreamVersion, dispatchableEntries); IState?raw; Optional <TSnapshotState> snapshotResult; if (snapshot != null) { raw = _stateAdapterProvider.AsRaw <TSnapshotState, IState>(streamName, snapshot, fromStreamVersion); _snapshots.Add(streamName, raw); snapshotResult = Optional.Of(snapshot); } else { raw = null; snapshotResult = Optional.Empty <TSnapshotState>(); } Dispatch(streamName, fromStreamVersion, dispatchableEntries, raw); interest.AppendAllResultedIn(Success.Of <StorageException, Result>(Result.Success), streamName, fromStreamVersion, sourcesForEntries, snapshotResult, @object); }
public virtual void Append <TSource>(string streamName, int streamVersion, TSource source, IAppendResultInterest interest, object @object) where TSource : ISource => Append(streamName, streamVersion, source, Metadata.NullMetadata(), interest, @object);
public void AppendAll <TSource>(string streamName, int fromStreamVersion, IEnumerable <ISource> sources, Metadata metadata, IAppendResultInterest interest, object @object) where TSource : ISource { throw new NotImplementedException(); }
public abstract void AppendAllWith <TSource, TSnapshotState>(string streamName, int fromStreamVersion, IEnumerable <ISource> sources, Metadata metadata, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : ISource;
public virtual void AppendAllWith <TSource, TSnapshotState>(string streamName, int fromStreamVersion, IEnumerable <ISource> sources, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : ISource => AppendAllWith <TSource, TSnapshotState>(streamName, fromStreamVersion, sources, Metadata.NullMetadata(), snapshot, interest, @object);
public abstract void AppendWith <TSource, TSnapshotState>(string streamName, int streamVersion, TSource source, Metadata metadata, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : ISource;
public virtual void AppendWith <TSource, TSnapshotState>(string streamName, int streamVersion, TSource source, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : ISource => AppendWith(streamName, streamVersion, source, Metadata.NullMetadata(), snapshot, interest, @object);
public abstract void Append <TSource>(string streamName, int streamVersion, TSource source, Metadata metadata, IAppendResultInterest interest, object @object) where TSource : ISource;
public void AppendWith <TSource, TSnapshotState>(string streamName, int streamVersion, TSource source, Metadata metadata, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : Source { throw new NotImplementedException(); }
public void Append <TSource>(string streamName, int streamVersion, TSource source, Metadata metadata, IAppendResultInterest interest, object @object) where TSource : ISource { throw new NotImplementedException(); }
public void AppendAllWith <TSource, TSnapshotState>(string streamName, int fromStreamVersion, IEnumerable <ISource> sources, Metadata metadata, TSnapshotState snapshot, IAppendResultInterest interest, object @object) where TSource : ISource { if (!actor.IsStopped) { Action <IJournal <T> > cons2042766341 = __ => __.AppendAllWith <TSource, TSnapshotState>(streamName, fromStreamVersion, sources, metadata, snapshot, interest, @object); if (mailbox.IsPreallocated) { mailbox.Send(actor, cons2042766341, null, AppendAllWithRepresentation10); } else { mailbox.Send(new LocalMessage <IJournal <T> >(actor, cons2042766341, AppendAllWithRepresentation10)); } } else { actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, AppendAllWithRepresentation10)); } }