public PostprocessorsManager( ILogSourcesManager logSources, Telemetry.ITelemetryCollector telemetry, ISynchronizationContext modelSyncContext, ISynchronizationContext threadPoolSyncContext, IHeartBeatTimer heartbeat, Progress.IProgressAggregator progressAggregator, Settings.IGlobalSettingsAccessor settingsAccessor, IOutputDataDeserializer outputDataDeserializer, ITraceSourceFactory traceSourceFactory ) { this.logSources = logSources; this.telemetry = telemetry; this.progressAggregator = progressAggregator; this.settingsAccessor = settingsAccessor; this.modelSyncContext = modelSyncContext; this.threadPoolSyncContext = threadPoolSyncContext; this.heartbeat = heartbeat; this.outputDataDeserializer = outputDataDeserializer; this.tracer = traceSourceFactory.CreateTraceSource("App", "ppm"); this.updater = new AsyncInvokeHelper(modelSyncContext, Refresh); logSources.OnLogSourceAdded += (sender, args) => updater.Invoke(); logSources.OnLogSourceRemoved += (sender, args) => updater.Invoke(); logSources.OnLogSourceAnnotationChanged += (sender, args) => updater.Invoke(); logSources.OnLogSourceStatsChanged += (object sender, LogSourceStatsEventArgs e) => { if ((e.Flags & LogProviderStatsFlag.ContentsEtag) != 0) { updater.Invoke(); } }; Refresh(); }
private Fsm.State AssertOriginalFsm(Fsm.FiniteStateMachine fsm, ISynchronizationContext context) { Assert.AreSame(fsm, this.fsm); Assert.AreEqual(3, fsm.States.Count); Assert.AreEqual(4, fsm.Transitions.Count); var s1 = fsm.States.Where(s => s.IsStartState).FirstOrDefault(); var s2 = fsm.States.Where(s => !s.IsStartState && !s.IsEndState).FirstOrDefault(); var s3 = fsm.States.Where(s => s.IsEndState); Assert.IsNotNull(s1); Assert.IsNotNull(s2); Assert.IsNotNull(s3); var t1 = s1.Transitions.FirstOrDefault(t => t.Input == "a"); var t2 = s2.Transitions.FirstOrDefault(t => t.Input == "a"); var t3 = s2.Transitions.FirstOrDefault(t => t.Input == "b"); var t4 = s1.Transitions.FirstOrDefault(t => t.Input == "b"); Assert.IsNotNull(t1); Assert.IsNotNull(t2); Assert.IsNotNull(t3); Assert.IsNotNull(t4); return(s1); }
public PreprocessingStepsFactory( Workspaces.IWorkspacesManager workspacesManager, AppLaunch.ILaunchUrlParser appLaunch, ISynchronizationContext invoke, IExtensionsRegistry extentions, Progress.IProgressAggregator progressAggregator, Persistence.IWebContentCache cache, ICredentialsCache credCache, ILogProviderFactoryRegistry logProviderFactoryRegistry, WebViewTools.IWebViewTools webBrowserDownloader, ILogsDownloaderConfig logsDownloaderConfig, RegularExpressions.IRegexFactory regexFactory ) { this.workspacesManager = workspacesManager; this.appLaunch = appLaunch; this.invoke = invoke; this.extentions = extentions; this.progressAggregator = progressAggregator; this.cache = cache; this.credCache = credCache; this.logProviderFactoryRegistry = logProviderFactoryRegistry; this.webViewTools = webBrowserDownloader; this.logsDownloaderConfig = logsDownloaderConfig; this.regexFactory = regexFactory; }
public SynchronizationInitializer(IStatesRepository statesRepository, IChainDataServicesManager chainDataServicesManager, ILoggerService loggerService, IHashCalculationsRepository hashCalculationsRepository) { _synchronizationContext = statesRepository.GetInstance <ISynchronizationContext>(); _chainDataService = chainDataServicesManager.GetChainDataService(PacketType.Synchronization); _logger = loggerService.GetLogger(typeof(SynchronizationInitializer).Name); _hashCalculation = hashCalculationsRepository.Create(Globals.DEFAULT_HASH); }
public NotificationHook(ICollection <TDepLeft> lefts, ICollection <TDepRight> rights, ISynchronizationContext context, SynchronizationMultipleDependency <TLeft, TRight, TDepLeft, TDepRight> parent) { Lefts = lefts; Rights = rights; Context = context; Parent = parent; }
public LogSourcesPreprocessingManager( ISynchronizationContext invokeSynchronize, IFormatAutodetect formatAutodetect, IExtensionsRegistry extensions, IPreprocessingManagerExtension builtinStepsExtension, Telemetry.ITelemetryCollector telemetry, ITempFilesManager tempFilesManager, ILogSourcesManager logSourcesManager, IShutdown shutdown, ITraceSourceFactory traceSourceFactory, IChangeNotification changeNotification ) { this.traceSourceFactory = traceSourceFactory; this.trace = traceSourceFactory.CreateTraceSource("PreprocessingManager", "prepr"); this.invokeSynchronize = invokeSynchronize; this.formatAutodetect = formatAutodetect; this.providerYieldedCallback = prov => logSourcesManager.Create(prov.Factory, prov.ConnectionParams).Visible = !prov.IsHiddenLog; this.extensions = extensions; this.telemetry = telemetry; this.tempFilesManager = tempFilesManager; this.logSourcesManager = logSourcesManager; this.changeNotification = changeNotification; extensions.Register(builtinStepsExtension); shutdown.Cleanup += (sender, e) => { shutdown.AddCleanupTask(this.DeleteAllPreprocessings()); }; }
ProgressAggregator(ProgressAggregator parent) { this.parent = parent; this.invoker = parent.invoker; this.root = parent.root; parent.Add(this); }
public PostprocessorOutputRecord( ILogSourcePostprocessor metadata, LogSourceRecord logSourceRecord, Action scheduleRefresh, Action fireChangeNotification, LJTraceSource trace, IHeartBeatTimer heartbeat, ISynchronizationContext modelSyncContext, ISynchronizationContext threadPoolSyncContext, Telemetry.ITelemetryCollector telemetry, IOutputDataDeserializer outputDataDeserializer) { this.metadata = metadata; this.logSourceRecord = logSourceRecord; state = new LoadingState(new PostprocessorOutputRecordState.Context() { owner = this, scheduleRefresh = scheduleRefresh, fireChangeNotification = fireChangeNotification, tracer = trace, telemetry = telemetry, heartbeat = heartbeat, modelSyncContext = modelSyncContext, threadPoolSyncContext = threadPoolSyncContext, outputDataDeserializer = outputDataDeserializer }, null, null); }
public Presenter( IView view, ITempFilesManager tempFilesManager, ITraceSourceFactory traceSourceFactory, RegularExpressions.IRegexFactory regexFactory, LogViewer.IPresenterFactory logViewerPresenterFactory, ISynchronizationContext synchronizationContext, LogMedia.IFileSystem fileSystem ) { this.view = view; this.view.SetEventsHandler(this); this.tempFilesManager = tempFilesManager; this.traceSourceFactory = traceSourceFactory; this.regexFactory = regexFactory; this.synchronizationContext = synchronizationContext; this.fileSystem = fileSystem; this.threads = new ModelThreads(); this.logSourceThreads = new LogSourceThreads( LJTraceSource.EmptyTracer, threads, null); this.model = new Presenters.LogViewer.DummyModel(); this.logPresenter = logViewerPresenterFactory.CreateIsolatedPresenter(model, view.LogViewer); logPresenter.ShowTime = true; logPresenter.EmptyViewMessageAllowed = false; }
public TransactionsRegistryHandler(IStatesRepository statesRepository, IServerCommunicationServicesRegistry communicationServicesRegistry, IRawPacketProvidersFactory rawPacketProvidersFactory, IRegistryMemPool registryMemPool, IConfigurationService configurationService, IHashCalculationsRepository hashCalculationRepository, ISerializersFactory signatureSupportSerializersFactory, ILoggerService loggerService) { _registrationBlocks = new BlockingCollection <ITransactionRegistryBlock>(); _registryGroupState = statesRepository.GetInstance <IRegistryGroupState>(); _synchronizationContext = statesRepository.GetInstance <ISynchronizationContext>(); _nodeContext = statesRepository.GetInstance <INodeContext>(); _communicationServicesRegistry = communicationServicesRegistry; _rawPacketProvidersFactory = rawPacketProvidersFactory; _registryMemPool = registryMemPool; _configurationService = configurationService; _signatureSupportSerializersFactory = signatureSupportSerializersFactory; _defaulHashCalculation = hashCalculationRepository.Create(Globals.DEFAULT_HASH); _powCalculation = hashCalculationRepository.Create(Globals.POW_TYPE); _logger = loggerService.GetLogger(nameof(TransactionsRegistryHandler)); TransformBlock <RegistryShortBlock, RegistryConfidenceBlock> produceConfidenceBlock = new TransformBlock <RegistryShortBlock, RegistryConfidenceBlock>((Func <RegistryShortBlock, RegistryConfidenceBlock>)GetConfidence); ActionBlock <RegistryConfidenceBlock> sendConfidenceBlock = new ActionBlock <RegistryConfidenceBlock>((Action <RegistryConfidenceBlock>)SendConfidence); produceConfidenceBlock.LinkTo(sendConfidenceBlock); _transactionsRegistryConfidenceFlow = produceConfidenceBlock; ActionBlock <RegistryConfirmationBlock> confirmationProcessingBlock = new ActionBlock <RegistryConfirmationBlock>((Action <RegistryConfirmationBlock>)ProcessConfirmationBlock); _confirmationBlockFlow = confirmationProcessingBlock; }
protected IDisposable PerformOneWay(TLeft left, TRight right, ISynchronizationContext context) { IDisposable dependency = null; switch (context.Direction) { case SynchronizationDirection.LeftToRight: case SynchronizationDirection.LeftToRightForced: var leftEx1 = leftFunc.Observe(left); leftEx1.Successors.SetDummy(); rightSetter(right, leftEx1.Value); dependency = new PropertySynchronization <TValue>(leftEx1, val => rightSetter(right, val)); break; case SynchronizationDirection.RightToLeft: case SynchronizationDirection.RightToLeftForced: var rightEx2 = rightFunc.Observe(right); rightEx2.Successors.SetDummy(); leftSetter(left, rightEx2.Value); dependency = new PropertySynchronization <TValue>(rightEx2, val => leftSetter(left, val)); break; case SynchronizationDirection.LeftWins: case SynchronizationDirection.RightWins: TValue leftVal; TValue rightVal; if (context.Direction == SynchronizationDirection.LeftWins) { var leftEx4 = leftFunc.Observe(left); leftEx4.Successors.SetDummy(); leftVal = leftEx4.Value; rightVal = rightGetter(right); dependency = new PropertySynchronization <TValue>(leftEx4, val => rightSetter(right, val)); } else { var rightEx4 = rightFunc.Observe(right); rightEx4.Successors.SetDummy(); leftVal = leftGetter(left); rightVal = rightEx4.Value; dependency = new PropertySynchronization <TValue>(rightEx4, val => leftSetter(left, val)); } var test = context.Direction == SynchronizationDirection.LeftWins ? typeof(TValue).IsValueType || leftVal != null : !(typeof(TValue).IsValueType || rightVal != null); if (test) { rightSetter(right, leftVal); } else { leftSetter(left, rightVal); } break; default: throw new InvalidOperationException(); } return(dependency); }
public TransactionRegistryMemPool(ILoggerService loggerService, IIdentityKeyProvidersRegistry identityKeyProvidersRegistry, ICryptoService cryptoService, IStatesRepository statesRepository, ITransactionsRegistryHelper transactionsRegistryHelper, IHashCalculationsRepository hashCalculationsRepository) { _oldValue = 0; //_timer = new Timer(1000); //_timer.Elapsed += (s, e) => //{ // if (_synchronizationContext.LastBlockDescriptor != null && _transactionRegisterBlocksOrdered.ContainsKey(_synchronizationContext.LastBlockDescriptor.BlockHeight)) // { // _logger.Info($"MemPoolCount total = {_transactionRegisterBlocksOrdered[_synchronizationContext.LastBlockDescriptor.BlockHeight].Count}; delta = {_transactionRegisterBlocksOrdered[_synchronizationContext.LastBlockDescriptor.BlockHeight].Count - _oldValue}"); // _oldValue = _transactionRegisterBlocksOrdered[_synchronizationContext.LastBlockDescriptor.BlockHeight].Count; // } //}; //_timer.Start(); _transactionHashKey = identityKeyProvidersRegistry.GetTransactionsIdenityKeyProvider(); _logger = loggerService.GetLogger(nameof(TransactionRegistryMemPool)); _transactionsIndicies = new Dictionary <ulong, int>(); _transactionRegisterBlocksOrdered = new Dictionary <ulong, SortedDictionary <int, ITransactionRegistryBlock> >(); _transactionKeyBySourceKeys = new Dictionary <ulong, Dictionary <ITransactionSourceKey, List <IKey> > >(); _transactionsShortBlocks = new Dictionary <ulong, Dictionary <ulong, HashSet <RegistryShortBlock> > >(); _transactionOrderByTransactionKey = new Dictionary <ulong, Dictionary <IKey, int> >(); _transactionSourceKeyByTransactionKey = new Dictionary <ulong, Dictionary <IKey, ITransactionSourceKey> >(); _cryptoService = cryptoService; _transactionsRegistryHelper = transactionsRegistryHelper; _synchronizationContext = statesRepository.GetInstance <ISynchronizationContext>(); _hashCalculation = hashCalculationsRepository.Create(Globals.DEFAULT_HASH); }
public Factory( IAlertPopup alerts, IFileDialogs fileDialogs, Help.IPresenter help, ILogProviderFactoryRegistry registry, IFormatDefinitionsRepository repo, IUserDefinedFormatsManager userDefinedFormatsManager, ITempFilesManager tempFilesManager, ITraceSourceFactory traceSourceFactory, RegularExpressions.IRegexFactory regexFactory, LogViewer.IPresenterFactory logViewerPresenterFactory, IViewsFactory viewFactories, ISynchronizationContext synchronizationContext, FieldsProcessor.IFactory fieldsProcessorFactory ) { this.viewFactories = viewFactories; this.alerts = alerts; this.registry = registry; this.fileDialogs = fileDialogs; this.userDefinedFormatsManager = userDefinedFormatsManager; this.help = help; this.repo = repo; this.tempFilesManager = tempFilesManager; this.logViewerPresenterFactory = logViewerPresenterFactory; this.traceSourceFactory = traceSourceFactory; this.regexFactory = regexFactory; this.synchronizationContext = synchronizationContext; this.fieldsProcessorFactory = fieldsProcessorFactory; }
public Factory( ITempFilesManager tempFiles, ITraceSourceFactory traceSourceFactory, MultiInstance.IInstancesCounter mutualExecutionCounter, IShutdown shutdown, ISynchronizationContext synchronizationContext, Persistence.IFirstStartDetector firstStartDetector, Telemetry.ITelemetryCollector telemetry, Persistence.IStorageManager storage, IChangeNotification changeNotification, string autoUpdateUrl, string pluginsIndexUrl ) { this.tempFiles = tempFiles; this.traceSourceFactory = traceSourceFactory; this.shutdown = shutdown; this.synchronizationContext = synchronizationContext; this.mutualExecutionCounter = mutualExecutionCounter; this.firstStartDetector = firstStartDetector; this.telemetry = telemetry; this.storage = storage; this.changeNotification = changeNotification; this.autoUpdateUrl = autoUpdateUrl; this.pluginsIndexUrl = pluginsIndexUrl; }
///------------------------------------------------------------------------------------------------- /// <summary> /// Constructor. /// </summary> /// <exception cref="Exception"> /// Thrown when an exception error condition occurs. /// </exception> /// <param name="source"> /// Source for the. /// </param> /// <param name="schemaRelationship"> /// The schema relationship. /// </param> /// <param name="opposite"> /// (Optional) true to opposite. /// </param> /// <param name="readOnly"> /// (Optional) true to read only. /// </param> ///------------------------------------------------------------------------------------------------- public ObservableModelElementList(IModelElement source, ISchemaRelationship schemaRelationship, bool opposite = false, bool readOnly = false) : base(source, schemaRelationship, opposite, readOnly) { Contract.Requires(source, "source"); Contract.Requires(schemaRelationship, "schemaRelationship"); _synchronizationContext = source.DomainModel.Services.Resolve <ISynchronizationContext>(); if (_synchronizationContext == null) { throw new Exception("No synchronizationContext founded. You can define a synchronization context in the store with store.Register<ISynchronizationContext>."); } var query = DomainModel.Events.RelationshipAdded; var query2 = DomainModel.Events.RelationshipRemoved; var query3 = DomainModel.Events.PropertyChanged; relationshipAddedSubscription = query.Subscribe(a => Notify( Source != null ? a.Event.EndId : a.Event.StartId, Source != null ? a.Event.StartId : a.Event.EndId, a.Event.SchemaId, NotifyCollectionChangedAction.Add)); relationshipRemovedSubscription = query2.Subscribe(a => Notify( Source != null ? a.Event.EndId : a.Event.StartId, Source != null ? a.Event.StartId : a.Event.EndId, a.Event.SchemaId, NotifyCollectionChangedAction.Remove)); propertyChangedSubscription = query3.Subscribe(a => NotifyPropertyChanged( a.Event.Id, a.Event.SchemaId)); }
public TransactionsRegistryService(IStatesRepository statesRepository, IPredicatesRepository predicatesRepository, IRegistryMemPool registryMemPool, IIdentityKeyProvidersRegistry identityKeyProvidersRegistry, ICryptoService cryptoService, IConfigurationService configurationService, IServerCommunicationServicesRegistry serverCommunicationServicesRegistry, IPerformanceCountersRepository performanceCountersRepository, ISerializersFactory signatureSupportSerializersFactory, ITransactionsRegistryHelper transactionsRegistryHelper, IHashCalculationsRepository hashCalculationsRepository, ILoggerService loggerService) { _synchronizationContext = statesRepository.GetInstance <ISynchronizationContext>(); _registryGroupState = statesRepository.GetInstance <IRegistryGroupState>(); _isBlockProducerPredicate = predicatesRepository.GetInstance("IsBlockProducer"); _transactionHashKey = identityKeyProvidersRegistry.GetTransactionsIdenityKeyProvider(); _cryptoService = cryptoService; _configurationService = configurationService; _serverCommunicationServicesRegistry = serverCommunicationServicesRegistry; _signatureSupportSerializersFactory = signatureSupportSerializersFactory; _transactionsRegistryHelper = transactionsRegistryHelper; _powCalculation = hashCalculationsRepository.Create(Globals.POW_TYPE); _hashCalculation = hashCalculationsRepository.Create(Globals.DEFAULT_HASH); _logger = loggerService.GetLogger(nameof(TransactionsRegistryService)); TransformBlock <IRegistryMemPool, SortedList <ushort, ITransactionRegistryBlock> > deduplicateAndOrderTransactionRegisterBlocksBlock = new TransformBlock <IRegistryMemPool, SortedList <ushort, ITransactionRegistryBlock> >((Func <IRegistryMemPool, SortedList <ushort, ITransactionRegistryBlock> >)DeduplicateAndOrderTransactionRegisterBlocks); TransformBlock <SortedList <ushort, ITransactionRegistryBlock>, RegistryFullBlock> produceTransactionsFullBlock = new TransformBlock <SortedList <ushort, ITransactionRegistryBlock>, RegistryFullBlock>((Func <SortedList <ushort, ITransactionRegistryBlock>, RegistryFullBlock>)ProduceTransactionsFullBlock); ActionBlock <Tuple <RegistryFullBlock, RegistryShortBlock> > sendTransactionsBlocks = new ActionBlock <Tuple <RegistryFullBlock, RegistryShortBlock> >((Action <Tuple <RegistryFullBlock, RegistryShortBlock> >)SendTransactionsBlocks); TransformBlock <RegistryFullBlock, Tuple <RegistryFullBlock, RegistryShortBlock> > produceTransactionsShortBlock = new TransformBlock <RegistryFullBlock, Tuple <RegistryFullBlock, RegistryShortBlock> >((Func <RegistryFullBlock, Tuple <RegistryFullBlock, RegistryShortBlock> >)ProduceTransactionsShortBlock); deduplicateAndOrderTransactionRegisterBlocksBlock.LinkTo(produceTransactionsFullBlock); produceTransactionsFullBlock.LinkTo(produceTransactionsShortBlock); produceTransactionsShortBlock.LinkTo(sendTransactionsBlocks); _transactionsRegistryProducingFlow = deduplicateAndOrderTransactionRegisterBlocksBlock; _registryMemPool = registryMemPool; _nodeCountersService = performanceCountersRepository.GetInstance <NodeCountersService>(); }
internal void Handle(YieldInstruction yieldInstruction, ISynchronizationContext context, CoroutineWrapper wrapper) { Log("Handle yield instruction"); var yieldWrapper = YieldInstructionWrapper.Create(yieldInstruction, context, wrapper); unityThread.Post(StartYieldWrapper, this, yieldWrapper); }
public override bool ShouldCorrespond(TOld left, TNew right, ISynchronizationContext context) { if (left.IsIdentified && right.IsIdentified) { return(left.ToIdentifierString() == right.ToIdentifierString()); } return(false); }
/// <summary> /// Calls the asynchronous action <paramref name="asyncAction"/> in the /// synchronization context and returns the Task that is complete when passed /// action has completed. /// </summary> public static Task InvokeAndAwait(this ISynchronizationContext sync, Func <Task> asyncAction) { return(InvokeAndAwait(sync, async() => { await asyncAction(); return 0; })); }
public Helper(TimeGapsDetector owner) { this.owner = owner; this.invoke = owner.modelSynchronizationContext; this.trace = owner.traceSourceFactory.CreateTraceSource("GapsDetector", string.Format("{0}.h{1}", owner.trace.Prefix, ++owner.lastHelperId)); this.source = owner.source; }
public static YieldInstructionWrapper Create(YieldInstruction instruction, ISynchronizationContext originalContext, CoroutineWrapper coroutineWrapper) { var yieldWrapper = Get(); yieldWrapper.instruction = instruction; yieldWrapper.originalContext = originalContext; yieldWrapper.coroutineWrapper = coroutineWrapper; return(yieldWrapper); }
private void AddCorrespondingToRights(ICollection <TDepRight> rights, ISynchronizationContext context, TDepLeft item) { var comp = context.CallTransformation(childRule.LeftToRight, new object[] { item }, null) as SynchronizationComputation <TDepLeft, TDepRight>; comp.DoWhenOutputIsAvailable((inp, outp) => { rights.Add(outp); }); }
public PreprocessingCredentialsCache( NSWindow parentWindow, Persistence.IStorageEntry credentialsCacheStorage, ISynchronizationContext uiInvoke) { this.credentialsCacheStorage = credentialsCacheStorage; this.parentWindow = parentWindow; this.uiInvoke = uiInvoke; }
public MissingItemInconsistency(ISynchronizationContext context, TransformationRuleBase <TSource, TTarget> rule, ICollection <TSource> sourceCollection, ICollection <TTarget> targetCollection, TSource source, bool isLeftMissing) { this.Context = context; this.Rule = rule; this.SourceCollection = sourceCollection; this.TargetCollection = targetCollection; this.Source = source; this.IsLeftMissing = isLeftMissing; }
private void AddCorrespondingToTargets(ICollection <TTargetDep> targets, ISynchronizationContext context, TSourceDep item) { var comp = context.CallTransformation(childRule, new object[] { item }, null) as SynchronizationComputation <TSourceDep, TTargetDep>; comp.DoWhenOutputIsAvailable((inp, outp) => { targets.Add(outp); }); }
public SynchronizationReceivingHandler(IStatesRepository statesRepository, IServerCommunicationServicesRegistry communicationServicesRegistry, IRawPacketProvidersFactory rawPacketProvidersFactory, IChainDataServicesManager chainDataServicesManager, IHashCalculationsRepository hashCalculationsRepository) { _synchronizationContext = statesRepository.GetInstance <ISynchronizationContext>(); _neighborhoodState = statesRepository.GetInstance <INeighborhoodState>(); _synchronizationBlocks = new BlockingCollection <SynchronizationConfirmedBlock>(); _communicationServicesRegistry = communicationServicesRegistry; _rawPacketProvidersFactory = rawPacketProvidersFactory; _chainDataService = chainDataServicesManager.GetChainDataService(PacketType.Synchronization); _hashCalculation = hashCalculationsRepository.Create(Globals.DEFAULT_HASH); }
public SyncManagerImpl(ISynchronizationContext synchronizationContext, IChainDataServicesManager chainDataServicesManager, IHashCalculationsRepository hashCalculationsRepository, ILogger logger) { _synchronizationContext = synchronizationContext; _logger = logger; _syncChainDataService = chainDataServicesManager.GetChainDataService(PacketType.Synchronization); _registryChainDataService = chainDataServicesManager.GetChainDataService(PacketType.Registry); _transactionalDataService = chainDataServicesManager.GetChainDataService(PacketType.Transactional); _utxoConfidentialDataService = chainDataServicesManager.GetChainDataService(PacketType.UtxoConfidential); _hashCalculation = hashCalculationsRepository.Create(Globals.DEFAULT_HASH); }
public Presenter( ILogSourcesManager sourcesManager, Preprocessing.IManager preprocessingManager, ISynchronizationContext sync, IHeartBeatTimer heartbeat, IPresentersFacade presentersFacade, StatusReports.IPresenter statusReports ) { this.preprocessingManager = preprocessingManager; this.presentersFacade = presentersFacade; this.statusReports = statusReports; this.updateInvokeHelper = new AsyncInvokeHelper(sync, Update); sourcesManager.OnLogSourceStatsChanged += (sender, e) => { bool?logSourceNeedsFixing = null; if ((e.Flags & LogProviderStatsFlag.FirstMessageWithTimeConstraintViolation) != 0 || (e.Flags & LogProviderStatsFlag.Error) != 0) { var badMsg = ((ILogSource)sender).Provider.Stats.FirstMessageWithTimeConstraintViolation; var failedWithBoundaryDates = ((ILogSource)sender).Provider.Stats.Error is BadBoundaryDatesException; logSourceNeedsFixing = badMsg != null || failedWithBoundaryDates; } if (logSourceNeedsFixing != null) { bool updated; if (logSourceNeedsFixing.Value) { updated = logSourcesRequiringReordering.Add((ILogSource)sender); } else { updated = logSourcesRequiringReordering.Remove((ILogSource)sender); } if (updated) { updateFlag.Invalidate(); } } }; sourcesManager.OnLogSourceRemoved += (sender, e) => { updateFlag.Invalidate(); }; heartbeat.OnTimer += (sender, e) => { if (e.IsNormalUpdate && updateFlag.Validate()) { Update(); } }; }
public static CoroutineWrapper StartCoroutine(CoroutineHost host, ISynchronizationContext context, IEnumerator coroutine) { var wrapper = Get(); wrapper.host = host; wrapper.stack.Push(coroutine); wrapper.ContinueOn(context); return(wrapper); }
public InteractionModule(ILoggerService loggerService, IConfigurationService configurationService, IStatesRepository statesRepository, IChainDataServicesManager chainDataServicesManager, IIdentityKeyProvidersRegistry identityKeyProvidersRegistry, IHashCalculationsRepository hashCalculationsRepository) : base(loggerService) { _synchronizationContext = statesRepository.GetInstance <ISynchronizationContext>(); _configurationService = configurationService; _chainDataServicesManager = chainDataServicesManager; _identityKeyProvidersRegistry = identityKeyProvidersRegistry; _hashCalculationsRepository = hashCalculationsRepository; }
public SynchronizationContextProvider(IUIThread uiThread) { _context = new SynchronizationContextDelegate(SynchronizationContext.Current); _threadId = uiThread.ManagedThreadId; }
private Fsm.State AssertJoinedFsm(Fsm.FiniteStateMachine fsm, ISynchronizationContext context) { Assert.AreSame(fsm, this.fsm); Assert.AreEqual(4, fsm.States.Count); Assert.AreEqual(5, fsm.Transitions.Count); var s1 = fsm.States.FirstOrDefault(s => s.Name == "s1"); var s2 = fsm.States.FirstOrDefault(s => s.Name == "s2"); var s3 = fsm.States.FirstOrDefault(s => s.Name == "s3"); var s4 = fsm.States.FirstOrDefault(s => s.Name == "s4"); Assert.IsNotNull(s1); Assert.IsNotNull(s2); Assert.IsNotNull(s3); Assert.IsNotNull(s4); return s1; }
private Pn.Place AssertOriginalPetriNet(Pn.PetriNet pn, ISynchronizationContext context, Fsm.State s1) { Assert.AreSame(pn, this.pn); Assert.AreEqual(3, pn.Places.Count); Assert.AreEqual(2, pn.Transitions.Count); var place = pn.Places.FirstOrDefault(p => p.Id == "s1"); Assert.IsNotNull(place); Assert.AreEqual(2, place.Outgoing.Count); Assert.AreEqual(0, place.Incoming.Count); if (s1 != null) { Assert.AreSame(place, context.Trace.ResolveIn(fsm2pn.SynchronizationRule<FSM2PN.StateToPlace>().LeftToRight, s1)); } return place; }
public SynchronizationContextProvider() { _context = new SynchronizationContextDelegate(SynchronizationContext.Current); }
private Pn.Place AssertFsmLikePetriNet(Pn.PetriNet pn, ISynchronizationContext context, Fsm.State s1) { Assert.AreSame(pn, this.pn); Assert.AreEqual(3, pn.Places.Count); Assert.AreEqual(5, pn.Transitions.Count); var s1Place = context.Trace.ResolveIn(fsm2pn.SynchronizationRule<FSM2PN.StateToPlace>().LeftToRight, s1); Assert.IsNotNull(s1Place); Assert.AreEqual(2, s1Place.Outgoing.Count); Assert.AreEqual(2, s1Place.Incoming.Count); Assert.AreEqual("s1", s1Place.Id); return s1Place; }
private Fsm.State AssertOriginalFsm(Fsm.FiniteStateMachine fsm, ISynchronizationContext context) { Assert.AreSame(fsm, this.fsm); Assert.AreEqual(3, fsm.States.Count); Assert.AreEqual(4, fsm.Transitions.Count); var s1 = fsm.States.Where(s => s.IsStartState).FirstOrDefault(); var s2 = fsm.States.Where(s => !s.IsStartState && !s.IsEndState).FirstOrDefault(); var s3 = fsm.States.Where(s => s.IsEndState); Assert.IsNotNull(s1); Assert.IsNotNull(s2); Assert.IsNotNull(s3); var t1 = s1.Transitions.FirstOrDefault(t => t.Input == "a"); var t2 = s2.Transitions.FirstOrDefault(t => t.Input == "a"); var t3 = s2.Transitions.FirstOrDefault(t => t.Input == "b"); var t4 = s1.Transitions.FirstOrDefault(t => t.Input == "b"); Assert.IsNotNull(t1); Assert.IsNotNull(t2); Assert.IsNotNull(t3); Assert.IsNotNull(t4); return s1; }