public InMemoryStateStoreActor(IEnumerable <IDispatcher> dispatchers, long checkConfirmationExpirationInterval, long confirmationExpiration) { if (dispatchers == null) { throw new ArgumentNullException(nameof(dispatchers), "Dispatcher must not be null."); } _dispatchers = dispatchers.ToList(); _entryAdapterProvider = EntryAdapterProvider.Instance(Stage.World); _stateAdapterProvider = StateAdapterProvider.Instance(Stage.World); _entries = new List <IEntry>(); _entryReaders = new Dictionary <string, IStateStoreEntryReader>(); _store = new Dictionary <string, Dictionary <string, TRawState> >(); _dispatchables = new List <Dispatchable>(); _readAllResultCollector = new ReadAllResultCollector(); var dispatcherControlDelegate = new InMemoryDispatcherControlDelegate(_dispatchables); _dispatcherControl = Stage.ActorFor <IDispatcherControl>( () => new DispatcherControlActor( _dispatchers, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration)); }
public InMemoryStateStoreActor(IDispatcher <Dispatchable <TEntry, TRawState> > dispatcher, long checkConfirmationExpirationInterval, long confirmationExpiration) { if (dispatcher == null) { throw new ArgumentNullException(nameof(dispatcher), "Dispatcher must not be null."); } _dispatcher = dispatcher; _entryAdapterProvider = EntryAdapterProvider.Instance(Stage.World); _stateAdapterProvider = StateAdapterProvider.Instance(Stage.World); _entries = new List <TEntry>(); _entryReaders = new Dictionary <string, IStateStoreEntryReader <TEntry> >(); _store = new Dictionary <string, Dictionary <string, TRawState> >(); _dispatchables = new List <Dispatchable <TEntry, TRawState> >(); var dispatcherControlDelegate = new InMemoryDispatcherControlDelegate <TEntry, TRawState>(_dispatchables); _dispatcherControl = Stage.ActorFor <IDispatcherControl>( Definition.Has <DispatcherControlActor <TEntry, TRawState> >( Definition.Parameters( dispatcher, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration))); }
public InMemoryObjectStoreActor(IDispatcher <Dispatchable <TEntry, TState> > dispatcher, long checkConfirmationExpirationInterval, long confirmationExpiration) { _entryAdapterProvider = EntryAdapterProvider.Instance(Stage.World); _dispatcher = dispatcher; _entryReaders = new Dictionary <string, IObjectStoreEntryReader <IEntry <T> > >(); _storeDelegate = new InMemoryObjectStoreDelegate <TEntry, TState>(StateAdapterProvider.Instance(Stage.World)); _dispatcherControl = Stage.ActorFor <IDispatcherControl>( () => new DispatcherControlActor <TEntry, TState>(dispatcher, _storeDelegate, checkConfirmationExpirationInterval, confirmationExpiration)); }
public InMemoryEventJournalActorTest(ITestOutputHelper output) { var converter = new Converter(output); Console.SetOut(converter); _world = World.StartWithDefaults("test-journal"); _dispatcher = new MockDispatcher <string, TextEntry, TextState>(new MockConfirmDispatchedResultInterest()); _journal = Journal <string> .Using <InMemoryJournalActor <string, TextEntry, TextState>, TextEntry, TextState>(_world.Stage, _dispatcher); EntryAdapterProvider.Instance(_world).RegisterAdapter(new Test1SourceAdapter()); EntryAdapterProvider.Instance(_world).RegisterAdapter(new Test2SourceAdapter()); StateAdapterProvider.Instance(_world).RegisterAdapter(new SnapshotStateAdapter()); }
public InMemoryJournal(IEnumerable <IDispatcher> dispatchers, World world, long checkConfirmationExpirationInterval = 1000L, long confirmationExpiration = 1000L) { _dispatchers = dispatchers.ToList(); _entryAdapterProvider = EntryAdapterProvider.Instance(world); _stateAdapterProvider = StateAdapterProvider.Instance(world); _journal = new List <IEntry>(); _journalReaders = new Dictionary <string, IJournalReader>(1); _streamReaders = new Dictionary <string, IStreamReader>(1); _streamIndexes = new Dictionary <string, Dictionary <int, int> >(); _snapshots = new Dictionary <string, IState>(); _dispatchables = new List <Dispatchable>(); var dispatcherControlDelegate = new InMemoryDispatcherControlDelegate(_dispatchables); _dispatcherControl = world.Stage.ActorFor <IDispatcherControl>( () => new DispatcherControlActor( _dispatchers, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration)); }
public InMemoryJournal(IDispatcher <Dispatchable <TEntry, TState> > dispatcher, World world, long checkConfirmationExpirationInterval = 1000L, long confirmationExpiration = 1000L) { _dispatcher = dispatcher; _entryAdapterProvider = EntryAdapterProvider.Instance(world); _stateAdapterProvider = StateAdapterProvider.Instance(world); _journal = new List <TEntry>(); _journalReaders = new Dictionary <string, IJournalReader <TEntry> >(1); _streamReaders = new Dictionary <string, IStreamReader <T> >(1); _streamIndexes = new Dictionary <string, Dictionary <int, int> >(); _snapshots = new Dictionary <string, TState>(); _dispatchables = new List <Dispatchable <TEntry, TState> >(); var dispatcherControlDelegate = new InMemoryDispatcherControlDelegate <TEntry, TState>(_dispatchables); _dispatcherControl = world.Stage.ActorFor <IDispatcherControl>( Definition.Has <DispatcherControlActor <TEntry, TState> >( Definition.Parameters( dispatcher, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration))); }
/// <summary> /// Construct my default state and register me with the <see cref="World"/>. /// </summary> /// <param name="world">The World to which I am registered</param> public StatefulTypeRegistry(World world) { world.RegisterDynamic(InternalName, this); StateAdapterProvider.Instance(world); }