示例#1
0
 public InMemoryPersistence(INetworkSimulator networkSimulator, Func <object, object> cloneFunc)
 {
     _chunks                 = new Chunk[1024 * 1024];
     _cloneFunc              = cloneFunc ?? (o => o);
     _networkSimulator       = networkSimulator ?? new NoNetworkLatencySimulator();
     _emptyInMemoryPartition = new InMemoryPartition("::empty", _networkSimulator, Clone);
     _partitions.TryAdd(_emptyInMemoryPartition.Id, _emptyInMemoryPartition);
 }
示例#2
0
 public InMemoryPersistence(InMemoryPersistenceOptions options)
 {
     _chunks                 = new MemoryChunk[1024 * 1024];
     _options                = options;
     _cloneFunc              = _options.CloneFunc ?? (o => o);
     _networkSimulator       = _options.NetworkSimulator ?? new NoNetworkLatencySimulator();
     _emptyInMemoryPartition = new InMemoryPartition("::empty", _networkSimulator, Clone);
     _partitions.TryAdd(_emptyInMemoryPartition.Id, _emptyInMemoryPartition);
 }
示例#3
0
        public Projections(INetworkSimulator networkSimulator)
        {
            Rooms = new RoomsOnSaleProjection(
                new ColoredConsoleReporter("rooms on sale", ConsoleColor.Cyan),
                networkSimulator
                );

            Bookings = new ConfirmedBookingsProjection(
                new ColoredConsoleReporter("confirmed bookings", ConsoleColor.Cyan),
                networkSimulator
                );
            Setup();
        }
示例#4
0
        public AppProjections(INetworkSimulator network, bool quiet)
        {
            _quiet = quiet;
            Rooms  = new RoomsOnSaleProjection(
                _quiet ? NullReporter.Instance : new ColoredConsoleReporter("rooms on sale", ConsoleColor.Red),
                network
                );

            Bookings = new ConfirmedBookingsProjection(
                _quiet ? NullReporter.Instance : new ColoredConsoleReporter("confirmed bookings", ConsoleColor.Cyan),
                network
                );
            Setup();
        }
 public ConfirmedBookingsProjection(IReporter reporter, INetworkSimulator networkSimulator)
 {
     this._reporter    = reporter;
     _networkSimulator = networkSimulator;
 }
示例#6
0
 public InMemoryPersistence(INetworkSimulator networkSimulator)
     : this(networkSimulator, null)
 {
 }
示例#7
0
 public RoomsOnSaleProjection(IReporter reporter, INetworkSimulator networkSimulator)
 {
     _reporter         = reporter;
     _networkSimulator = networkSimulator;
 }
示例#8
0
 public InMemoryPartition(string partitionId, INetworkSimulator networkSimulator, Func <Chunk, Chunk> clone)
 {
     this.Id           = partitionId;
     _networkSimulator = networkSimulator;
     Clone             = clone;
 }
示例#9
0
 public InMemoryPersistence(INetworkSimulator networkSimulator)
     : this(new InMemoryPersistenceOptions(null, networkSimulator))
 {
 }
 public InMemoryPersistenceOptions(Func <object, object> cloneFunc, INetworkSimulator networkSimulator)
 {
     CloneFunc        = cloneFunc;
     NetworkSimulator = networkSimulator;
 }
示例#11
0
        private readonly INStoreLoggerFactory _loggerFactory = new ConsoleLoggerFactory(); // NStoreNullLoggerFactory.Instance;

        public ProjectionEngine(IPersistence persistence, INetworkSimulator networkSimulator)
        {
            _pollingClient = new PollingClient(persistence, 0, new Projections(networkSimulator), _loggerFactory);
        }