@Test public void createSnapshotStorageEngine() throws InterruptedException, ExecutionException { EventStorageEngine eventStorageEngine = testSubject.createEventStorageEngine( "DEMO"); eventStorageEngine.init(false); EventStorageEngine storageEngine = testSubject.createSnapshotStorageEngine( "DEMO"); storageEngine.init(false); List<CompletableFuture<Long>> futures = IntStream.range(0, 100) .mapToObj(index -> storageEngine .store(Collections.singletonList(newEvent("SNAPSHOT_AGGREGATE" + index, 0)))) .collect(Collectors.toList()); CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get(); storageEngine.close(false); EventStorageEngine storageEngine2 = testSubject.createSnapshotStorageEngine( "DEMO"); storageEngine2.init(true); assertEquals(0, (long) storageEngine2.getLastSequenceNumber("SNAPSHOT_AGGREGATE0").orElse(-1L)); storageEngine2.close(true); eventStorageEngine.close(true); }
@Override public EventStorageEngine createSnapshotStorageEngine(String context) { StandardIndexManager indexManager = new StandardIndexManager(context, embeddedDBProperties.getSnapshot(), EventType.SNAPSHOT, meterFactory); InputStreamEventStore second = new InputStreamEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), meterFactory); return new PrimaryEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), second, meterFactory); }
StandardEventStoreFactory implements EventStoreFactory { @Override public EventStorageEngine createSnapshotStorageEngine(String context) { StandardIndexManager indexManager = new StandardIndexManager(context, embeddedDBProperties.getSnapshot(), EventType.SNAPSHOT, meterFactory); InputStreamEventStore second = new InputStreamEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), meterFactory); return new PrimaryEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), second, meterFactory); } }
StandardEventStoreFactory implements EventStoreFactory { @Override public EventStorageEngine createSnapshotStorageEngine(String context) { StandardIndexManager indexManager = new StandardIndexManager(context, embeddedDBProperties.getSnapshot(), EventType.SNAPSHOT, meterFactory); InputStreamEventStore second = new InputStreamEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), meterFactory); return new PrimaryEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), second, meterFactory); } StandardEventStoreFactory(EmbeddedDBProperties embeddedDBProperties,
                                     EventTransformerFactory eventTransformerFactory,
                                     StorageTransactionManagerFactory storageTransactionManagerFactory,
                                     MeterFactory meterFactory); }
StandardEventStoreFactory implements EventStoreFactory { @Override public EventStorageEngine createSnapshotStorageEngine(String context) { StandardIndexManager indexManager = new StandardIndexManager(context, embeddedDBProperties.getSnapshot(), EventType.SNAPSHOT, meterFactory); InputStreamEventStore second = new InputStreamEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), meterFactory); return new PrimaryEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), second, meterFactory); } StandardEventStoreFactory(EmbeddedDBProperties embeddedDBProperties,
                                     EventTransformerFactory eventTransformerFactory,
                                     StorageTransactionManagerFactory storageTransactionManagerFactory,
                                     MeterFactory meterFactory); @Override EventStorageEngine createEventStorageEngine(String context); @Override EventStorageEngine createSnapshotStorageEngine(String context); }
StandardEventStoreFactory implements EventStoreFactory { @Override public EventStorageEngine createSnapshotStorageEngine(String context) { StandardIndexManager indexManager = new StandardIndexManager(context, embeddedDBProperties.getSnapshot(), EventType.SNAPSHOT, meterFactory); InputStreamEventStore second = new InputStreamEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), meterFactory); return new PrimaryEventStore(new EventTypeContext(context, EventType.SNAPSHOT), indexManager, eventTransformerFactory, embeddedDBProperties.getSnapshot(), second, meterFactory); } StandardEventStoreFactory(EmbeddedDBProperties embeddedDBProperties,
                                     EventTransformerFactory eventTransformerFactory,
                                     StorageTransactionManagerFactory storageTransactionManagerFactory,
                                     MeterFactory meterFactory); @Override EventStorageEngine createEventStorageEngine(String context); @Override EventStorageEngine createSnapshotStorageEngine(String context);  }