public SampleApp(IPersistence store, string name, bool useSnapshots, bool quiet, bool fast) { _quiet = quiet; _name = name; _rooms = 32; _storeProfile = new ProfileDecorator(store); _streams = new StreamsFactory(_storeProfile); _aggregateFactory = new DefaultAggregateFactory(); var network = fast ? (INetworkSimulator) new NoNetworkLatencySimulator() : (INetworkSimulator) new ReliableNetworkSimulator(10, 50); _appProjections = new AppProjections(network, quiet); _poller = new PollingClient(_storeProfile, 0, _appProjections, this._loggerFactory); if (useSnapshots) { _cloneProfiler = new TaskProfilingInfo("Cloning state"); var inMemoryPersistence = new InMemoryPersistence(new InMemoryPersistenceOptions { CloneFunc = CloneSnapshot }); _snapshotProfile = new ProfileDecorator(inMemoryPersistence); _snapshots = new DefaultSnapshotStore(_snapshotProfile); } _unboundedOptions = new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded, BoundedCapacity = DataflowBlockOptions.Unbounded, EnsureOrdered = false, MaxMessagesPerTask = DataflowBlockOptions.Unbounded }; _boundedOptions = new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount * 8, BoundedCapacity = 500, EnsureOrdered = true }; if (store is MongoPersistence) { _unboundedOptions.MaxDegreeOfParallelism = Environment.ProcessorCount * 4; _unboundedOptions.BoundedCapacity = 2000; } }
private TutorialRuntime(IPersistence streamsPersistence, IPersistence snapshotsPersistence) { StreamsPersistence = streamsPersistence; SnapshotsPersistence = snapshotsPersistence; Configure(); Logger.LogInformation("Runtime Started"); // configure aggregate factory delegation to DI container _aggregateFactory = new AggregateFactory( aggregateType => (IAggregate)this._serviceProvider.GetService(aggregateType) ); _streamsFactory = new StreamsFactory(Instrument(streamsPersistence, "streams")); _snapshotStore = new DefaultSnapshotStore(Instrument(snapshotsPersistence, "snapshots")); }
public AppEngine() { var pathToDb = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "sample.db"); if (File.Exists(pathToDb)) { File.Delete(pathToDb); } var options = new SqlitePersistenceOptions(new NStore.Core.Logging.NStoreNullLoggerFactory()) { ConnectionString = $"Data Source={pathToDb}", Serializer = new TypeAsSchemaJsonSerializer() }; var persitence = new SqlitePersistence(options); _streams = new StreamsFactory(persitence); SQLitePCL.Batteries_V2.Init(); persitence.InitAsync(CancellationToken.None).GetAwaiter().GetResult(); }
public DomainRuntime( IPersistence persistence, IAggregateFactory aggregateFactory, ISnapshotStore snapshots, ChunkProcessor processor) { _persistence = persistence; _aggregateFactory = aggregateFactory; _snapshots = snapshots; _streamsFactory = new StreamsFactory(persistence); if (processor != null) { _pollingClient = new PollingClient( persistence, 0, // <----- TODO: read from state? new LambdaSubscription(processor), NStoreNullLoggerFactory.Instance ); _pollingClient.Start(); } }
public Repository(IAggregateFactory factory, IStreamsFactory streams, ISnapshotStore snapshots) { _factory = factory; _streams = streams; _snapshots = snapshots; }
public Repository(IAggregateFactory factory, IStreamsFactory streams) : this(factory, streams, (ISnapshotStore)null) { }
public OptimisticConcurrencyStreamTests() { _streams = new StreamsFactory(Store); }
public ReadOnlyStreamTests() { _streams = new StreamsFactory(Store); }
public StreamTests() { _streams = new StreamsFactory(Store); }
public TplRepository(IAggregateFactory factory, IStreamsFactory streams, ISnapshotStore snapshots) : base(factory, streams, snapshots) { }
public TplRepository(IAggregateFactory factory, IStreamsFactory streams) : base(factory, streams) { }
public TwitterViews(IPersistence persistence) { _streams = new StreamsFactory(persistence); }
public Repository(IAggregateFactory factory, IStreamsFactory streams) : this(factory, streams, null) { }