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

        public void ControlWith(IDispatcherControl control)
        {
            _projectionControl = _projectionControlFactory(control);
            var protocols = ChildActorFor(new[] { typeof(IMultiConfirming), typeof(IProjectionControl) },
                                          Definition.Has(() =>
                                                         new MultiConfirmingProjectionControlActor(_projectionControlFactory(control), _multiConfirmationsExpiration)));

            _multiConfirming = protocols.Get <IMultiConfirming>(0);
            _multiConfirmingProjectionControl = protocols.Get <IProjectionControl>(1);
        }