示例#1
0
        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));
        }
示例#2
0
        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 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));
        }
示例#4
0
        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)));
        }