Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventHorizonEventsWriter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams" />.</param>
 /// <param name="eventsToStreamsWriter">The <see cref="IWriteEventsToStreamCollection" />.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 /// <param name="logger">The <see cref="ILogger" />.</param>
 public EventHorizonEventsWriter(IStreams streams, IWriteEventsToStreamCollection eventsToStreamsWriter, IEventConverter eventConverter, ILogger logger)
 {
     _streams = streams;
     _eventsToStreamsWriter = eventsToStreamsWriter;
     _eventConverter        = eventConverter;
     _logger = logger;
 }
Exemple #2
0
    public static void should_have_stored_committed_events <TEvent>(
        this IEnumerable <CommittedEventSequence <TEvent> > batches,
        IStreams streams,
        IEventContentConverter event_content_converter)
        where TEvent : Dolittle.Runtime.Events.Store.CommittedEvent
    {
        var eventLog = streams.DefaultEventLog;

        foreach (var batch in batches)
        {
            var storedEvents = eventLog.FindSync(
                Builders <Event> .Filter.Gte(_ => _.EventLogSequenceNumber, batch.First().EventLogSequenceNumber.Value)
                & Builders <Event> .Filter.Lte(_ => _.EventLogSequenceNumber, batch.Last().EventLogSequenceNumber.Value)).ToList();
            switch (batch)
            {
            case CommittedEvents committedEvents:
                should_have_stored_committed_events(event_content_converter, committedEvents, storedEvents);
                break;

            case CommittedAggregateEvents committedAggregateEvents:
                should_have_stored_committed_events(event_content_converter, committedAggregateEvents, storedEvents);
                break;

            default:
                throw new Exception("Wrong committed events type");
            }
        }
    }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitWriter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams"/>.</param>
 /// <param name="streamWatcher">The <see cref="IStreamEventWatcher"/>.</param>
 /// <param name="commitConverter">The <see cref="IConvertCommitToEvents"/>.</param>
 public CommitWriter(IStreams streams, IStreamEventWatcher streamWatcher, IConvertCommitToEvents commitConverter, IUpdateAggregateVersionsAfterCommit aggregateVersions)
 {
     _streams           = streams;
     _streamWatcher     = streamWatcher;
     _commitConverter   = commitConverter;
     _aggregateVersions = aggregateVersions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventsToStreamsWriter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams"/>.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 /// <param name="streamWatcher">The <see cref="IStreamEventWatcher" />.</param>
 /// <param name="logger">An <see cref="ILogger"/>.</param>
 public EventsToStreamsWriter(IStreams streams, IEventConverter eventConverter, IStreamEventWatcher streamWatcher, ILogger logger)
 {
     _streams        = streams;
     _eventConverter = eventConverter;
     _streamWatcher  = streamWatcher;
     _logger         = logger;
 }
Exemple #5
0
        public virtual void     Init(NGConsoleWindow console, IStreams container)
        {
            this.console   = console;
            this.container = container;

            this.console.CheckNewLogConsume += this.ConsumeLog;
            this.console.PropagateNewLog    += this.AddLog;

            this.rowsDrawer.Init(this.console, this.console);
            this.rowsDrawer.RowDeleted     += this.DecrementCounts;
            this.rowsDrawer.LogContextMenu += this.FillContextMenu;
            this.rowsDrawer.Clear();

            this.groupFilters.FilterAltered += this.RefreshFilteredRows;

            this.totalCount     = 0;
            this.logCount       = 0;
            this.warningCount   = 0;
            this.errorCount     = 0;
            this.exceptionCount = 0;

            this.logContent       = new GUIContent(UtilityResources.InfoIcon, "Log");
            this.warningContent   = new GUIContent(UtilityResources.WarningIcon, "Warning");
            this.errorContent     = new GUIContent(UtilityResources.ErrorIcon, "Error");
            this.exceptionContent = new GUIContent(this.errorContent.image, "Exception");
            this.tabLabel         = new GUIContent();

            Texture2D pacman = new Texture2D(0, 0, TextureFormat.RGBA32, false);

            pacman.LoadImage(Convert.FromBase64String(StreamLog.PacMan));
            this.consumeLogContent = new GUIContent(pacman);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommittedEventsFetcher"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams"/>.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 /// <param name="aggregateRoots">The <see cref="IAggregateRoots" />.</param>
 public CommittedEventsFetcher(
     IStreams streams,
     IEventConverter eventConverter,
     IAggregateRoots aggregateRoots)
 {
     _streams        = streams;
     _eventConverter = eventConverter;
     _aggregateRoots = aggregateRoots;
 }
Exemple #7
0
        public override void    Init(NGConsoleWindow console, IStreams container)
        {
            base.Init(console, container);

#if !UNITY_2017_2_OR_NEWER
            EditorApplication.playmodeStateChanged += this.StartListening;
#else
            EditorApplication.playModeStateChanged += this.StartListening;
#endif

            this.RefreshFilteredRows();
        }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventStore"/> class.
 /// </summary>
 /// <param name="executionContextManager">The <see cref="IExecutionContextManager" />.</param>
 /// <param name="streams">The <see cref="IStreams"/>.</param>
 /// <param name="eventCommitter">The <see cref="IEventCommitter" />.</param>
 /// <param name="aggregateRoots">The <see cref="IAggregateRoots" />.</param>
 /// <param name="logger">An <see cref="ILogger"/>.</param>
 public EventStore(
     IExecutionContextManager executionContextManager,
     IStreams streams,
     IEventCommitter eventCommitter,
     IAggregateRoots aggregateRoots,
     ILogger logger)
 {
     _executionContextManager = executionContextManager;
     _streams        = streams;
     _eventCommitter = eventCommitter;
     _aggregateRoots = aggregateRoots;
     _logger         = logger;
 }
Exemple #9
0
        /// <summary>
        /// A special Init. Requires container to be a MainModule and an IStreams.
        /// </summary>
        /// <param name="console"></param>
        /// <param name="container">An instance of both MainModule and IStreams.</param>
        public override void    Init(NGConsoleWindow console, IStreams container)
        {
            base.Init(console, container);

            this.console.syncLogs.EndNewLog += this.UpdateAwareness;

            this.compileRows = new List <CompileRow>();
            this.rowsDrawer.SetRowGetter(this);
            this.restorer = new BgColorContentRestorer();

            this.console.UpdateTick += this.DetectCompile;

            this.OptionAltered += this.UpdateUnityConsoleOptions;
        }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventCommitter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams" />.</param>
 public EventCommitter(IStreams streams)
 {
     _streams = streams;
 }
Exemple #11
0
    public static void should_have_stored_committed_events <TEvent>(this CommittedEventSequence <TEvent> events, IStreams streams, IEventContentConverter event_content_converter)
        where TEvent : Dolittle.Runtime.Events.Store.CommittedEvent
    {
        var eventLog     = streams.DefaultEventLog;
        var storedEvents = eventLog.FindSync(Builders <Event> .Filter.Empty).ToList();

        switch (events)
        {
        case CommittedEvents committedEvents:
            should_have_stored_committed_events(event_content_converter, committedEvents, storedEvents);
            break;

        case CommittedAggregateEvents committedAggregateEvents:
            should_have_stored_committed_events(event_content_converter, committedAggregateEvents, storedEvents);
            break;

        default:
            throw new Exception("Wrong committed events type");
        }
    }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventFetchers"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams" />.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 public EventFetchers(IStreams streams, IEventConverter eventConverter)
 {
     _streams        = streams;
     _eventConverter = eventConverter;
 }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventsToStreamsWriter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams"/>.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 /// <param name="logger">An <see cref="ILogger"/>.</param>
 public EventsToStreamsWriter(IStreams streams, IEventConverter eventConverter, ILogger <EventsToStreamsWriter> logger)
 {
     _streams        = streams;
     _eventConverter = eventConverter;
     _logger         = logger;
 }
Exemple #14
0
        public override void    Init(NGConsoleWindow console, IStreams container)
        {
            base.Init(console, container);

            this.OptionAltered += this.UpdateUnityConsoleOptions;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StreamDefinitionRepository"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams" />.</param>
 public StreamDefinitionRepository(IStreams streams)
 {
     _streams = streams;
 }
 public StreamsController(IStreams stream)
 {
     _stream = stream;
 }