public SimpleEventStore(IStoreSettings<IDbConnection> settings, IServiceBus serviceBus, ISerialize serializer, ISnapshotStore snapshotStore)
 {
     _settings = settings;
     _serviceBus = serviceBus;
     _serializer = serializer;
     _snapshotStore = snapshotStore;
 }
Пример #2
0
 public Pager(IFhirStore store, ISnapshotStore snapshotstore, ILocalhost localhost, Transfer transfer)
 {
     this.store = store;
     this.snapshotstore = snapshotstore;
     this.localhost = localhost;
     this.transfer = transfer;
 }
Пример #3
0
 public Pager(IFhirStore fhirStore, ISnapshotStore snapshotstore, ILocalhost localhost, Transfer transfer, List<ModelInfo.SearchParamDefinition> searchParameters)
 {
     this.fhirStore = fhirStore;
     this.snapshotstore = snapshotstore;
     this.localhost = localhost;
     this.transfer = transfer;
     this.searchParameters = searchParameters;
 }
Пример #4
0
 public SnapshotRepository(ISnapshotStore snapshotStore, ISnapshotStrategy <TAuthenticationToken> snapshotStrategy, IRepository <TAuthenticationToken> repository, IEventStore <TAuthenticationToken> eventStore, IAggregateFactory aggregateFactory)
 {
     SnapshotStore    = snapshotStore;
     SnapshotStrategy = snapshotStrategy;
     Repository       = repository;
     EventStore       = eventStore;
     AggregateFactory = aggregateFactory;
 }
 public SingleStreamCatchupCache(IConnectionStatusMonitor <IEventStoreConnection> connectionMonitor,
                                 SingleStreamCatchupCacheConfiguration <TAggregate> cacheConfiguration,
                                 IEventTypeProvider <TAggregate> eventTypeProvider,
                                 ILoggerFactory loggerFactory,
                                 ISnapshotStore <TAggregate>?snapshotStore = null,
                                 ISnapshotStrategy?snapshotStrategy        = null) : base(connectionMonitor, cacheConfiguration, eventTypeProvider, loggerFactory, snapshotStore, snapshotStrategy)
 {
 }
Пример #6
0
 public Pager(IFhirStore fhirStore, ISnapshotStore snapshotstore, ILocalhost localhost, Transfer transfer, List <ModelInfo.SearchParamDefinition> searchParameters)
 {
     this.fhirStore        = fhirStore;
     this.snapshotstore    = snapshotstore;
     this.localhost        = localhost;
     this.transfer         = transfer;
     this.searchParameters = searchParameters;
 }
Пример #7
0
 public EventSourcedRepository(IEventStore eventStore, ISnapshotStore snapshotStore, IMediator mediator, EventSourcingOptions eventSourcingOptions, ILogger <EventSourcedRepository <TAggregateRoot> > logger)
 {
     _eventStore           = eventStore;
     _snapshotStore        = snapshotStore;
     _mediator             = mediator;
     _eventSourcingOptions = eventSourcingOptions;
     _logger = logger;
 }
Пример #8
0
 public NUnitSnapper(ISnapshotStore snapshotStore, ISnapshotUpdateDecider snapshotUpdateDecider,
                     ISnapshotComparer snapshotComparer, SnapshotIdResolver snapshotIdResolver,
                     JsonSnapshotSanitiser snapshotSanitiser)
     : base(snapshotStore, snapshotUpdateDecider, snapshotComparer)
 {
     _snapshotIdResolver = snapshotIdResolver;
     _snapshotSanitiser  = snapshotSanitiser;
 }
Пример #9
0
 public NewSnapshottingAggregateRootRepositoryDecorator(IAggregateRootRepository aggregateRootRepository, IEventStore eventStore, IDomainEventSerializer domainEventSerializer, ISnapshotStore snapshotStore, TimeSpan preparationThreshold)
 {
     _aggregateRootRepository = aggregateRootRepository;
     _eventStore            = eventStore;
     _domainEventSerializer = domainEventSerializer;
     _snapshotStore         = snapshotStore;
     _preparationThreshold  = preparationThreshold;
 }
Пример #10
0
 /// <summary>
 /// First time initialization and reconfig in case of restore
 /// </summary>
 /// <param name="model"></param>
 private void Configure(Model model)
 {
     _commandStore    = _config.CreateCommandStore();
     _snapshotStore   = _config.CreateSnapshotStore();
     _journalAppender = JournalAppender.Create(model.Revision + 1, _commandStore);
     _kernel          = _config.CreateKernel(model);
     _kernel.SetSynchronizer(_synchronizer);
 }
Пример #11
0
 public SnapshotRepository(ISnapshotStore snapshotStore, ISnapshotStrategy snapshotStrategy,
                           IRepository repository, IEventStore eventStore)
 {
     _snapshotStore    = snapshotStore ?? throw new ArgumentNullException(nameof(snapshotStore));
     _snapshotStrategy = snapshotStrategy ?? throw new ArgumentNullException(nameof(snapshotStrategy));
     _repository       = repository ?? throw new ArgumentNullException(nameof(repository));
     _eventStore       = eventStore ?? throw new ArgumentNullException(nameof(eventStore));
 }
 public EventStoreStatefulActorBuilder <TActor, TAggregate, TRegistry> WithReadOneStreamFromStartCache(
     string streamId,
     IEventTypeProvider <TAggregate> eventTypeProvider,
     Action <MultipleStreamsCatchupCacheConfiguration <TAggregate> > getMultipleStreamsCatchupCacheConfiguration = null,
     ISnapshotStore <TAggregate> snapshotStore = null,
     ISnapshotStrategy snapshotStrategy        = null)
 {
     return(WithReadManyStreamsFromStartCache(new[] { streamId }, eventTypeProvider, getMultipleStreamsCatchupCacheConfiguration, snapshotStore, snapshotStrategy));
 }
Пример #13
0
 public ProjectionPlayer(IEventStore eventStore, IProjectionStore projectionStore, IProjectionRepository projectionRepository, ISnapshotStore snapshotStore, EventTypeIndexForProjections index, IEventStorePlayer eventStorePlayer)
 {
     this.eventStore           = eventStore;
     this.projectionStore      = projectionStore;
     this.projectionRepository = projectionRepository;
     this.snapshotStore        = snapshotStore;
     this.index            = index;
     this.eventStorePlayer = eventStorePlayer;
 }
Пример #14
0
 public static Task DeleteAsync(
     this ISnapshotStore snapshots,
     string snapshotPartitionId,
     long fromVersionInclusive,
     long toVersionInclusive
     )
 {
     return(snapshots.DeleteAsync(snapshotPartitionId, fromVersionInclusive, toVersionInclusive, CancellationToken.None));
 }
Пример #15
0
 public Persistence(TKey ownerKey, Type ownerType,
                    IEventStore eventStore,
                    IEventDataFormatter eventDataFormatter,
                    ISnapshotStore <None, TKey> snapshotStore,
                    IStreamNameResolver streamNameResolver,
                    HandleEvent applyEvent)
     : base(ownerKey, ownerType, eventStore, eventDataFormatter, snapshotStore, streamNameResolver, PersistenceMode.EventSourcing, null, applyEvent)
 {
 }
Пример #16
0
 public ProjectionPlayer(IEventStoreFactory eventStoreFactory, IProjectionStore projectionStore, IProjectionRepository projectionRepository, ISnapshotStore snapshotStore, EventTypeIndexForProjections index, ITenantResolver tenantResolver)
 {
     this.eventStoreFactory    = eventStoreFactory;
     this.projectionStore      = projectionStore;
     this.projectionRepository = projectionRepository;
     this.snapshotStore        = snapshotStore;
     this.index          = index;
     this.tenantResolver = tenantResolver;
 }
Пример #17
0
 public static Task Remove(
     this ISnapshotStore snapshots,
     string aggregateId,
     long fromVersionInclusive,
     long toVersionInclusive
     )
 {
     return(snapshots.Remove(aggregateId, fromVersionInclusive, toVersionInclusive, CancellationToken.None));
 }
Пример #18
0
 public static Task <T> FindAsync <T>(
     this ISnapshotStore store,
     Guid id,
     int maxVersion = int.MaxValue,
     CancellationToken cancellationToken = default)
     where T : class, IAggregate
 {
     return(store.FindAsync <T, Guid>(id, maxVersion, cancellationToken));
 }
Пример #19
0
        public virtual async Task LoadAsync(
            IEventStore eventStore,
            ISnapshotStore snapshotStore,
            CancellationToken cancellationToken)
        {
            var domainEvents = await eventStore.LoadEventsAsync <TAggregate, TIdentity>(Id, cancellationToken).ConfigureAwait(false);

            ApplyEvents(domainEvents);
        }
Пример #20
0
 public Persistence(TKey ownerKey, Type ownerType,
                    IEventStore eventStore,
                    IEventDataFormatter eventDataFormatter,
                    ISnapshotStore <object, TKey> snapshotStore,
                    IStreamNameResolver streamNameResolver,
                    Func <Envelope <IEvent>, Task> applyEvent)
     : base(ownerKey, ownerType, eventStore, eventDataFormatter, snapshotStore, streamNameResolver, PersistenceMode.EventSourcing, null, applyEvent)
 {
 }
Пример #21
0
        public void SetUp()
        {
            container         = new WindsorContainer();
            memoryPersistence = new InMemoryPersistence();
            sut = new Repository(new AggregateFactoryEx(container.Kernel), new StreamsFactory(memoryPersistence));

            var snapshotMemoryPersistence = new InMemoryPersistence();

            snapshotStore = new DefaultSnapshotStore(snapshotMemoryPersistence);
        }
Пример #22
0
        public DomainRepository(IEventStore store, IEventBus eventBus, ISnapshotStore snapshotStore = null, IAggregateRootCreationStrategy aggregateRootCreationStrategy = null)
        {
            Contract.Requires <ArgumentNullException>(store != null);
            Contract.Requires <ArgumentNullException>(eventBus != null);

            _store                = store;
            _eventBus             = eventBus;
            _snapshotStore        = snapshotStore;
            _aggregateRootCreator = aggregateRootCreationStrategy ?? new SimpleAggregateRootCreationStrategy();
        }
Пример #23
0
 protected CachedAggregateRepository(
     IEventStore <TAggregate, TKey> eventStore,
     ISnapshotStore <TAggregate, TKey> snapshotStore,
     IDistributedCache cache,
     DistributedCacheEntryOptions cacheOptions)
     : base(eventStore, snapshotStore)
 {
     _cache        = cache;
     _cacheOptions = cacheOptions;
 }
 public CachedGiftCardRepository(
     IEventStore <GiftCard, Guid> eventStore,
     ISnapshotStore <GiftCard, Guid> snapshotStore,
     IDistributedCache cache)
     : base(eventStore, snapshotStore, cache, new DistributedCacheEntryOptions
 {
     SlidingExpiration = TimeSpan.FromSeconds(10)
 })
 {
 }
        internal SubEntitySnapshotDenormalizer(BudgetModel budgetModel)
        {
            _budgetModel   = budgetModel ?? throw new ArgumentNullException(nameof(budgetModel));
            _snapshotStore = budgetModel?.BudgetStore?.SnapshotStore ?? throw new ArgumentException("Could not find snapshot store of budgetModel", nameof(budgetModel));

            _createEntityFromEvent    = CreateFromEventConstructor();
            _createEntityFromSnapshot = CreateFromSnapshotConstructor();

            RegisterForMessages();
        }
Пример #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventStoreRepository" /> class.
        /// </summary>
        /// <param name="identityMap">The identity map.</param>
        /// <param name="eventStore">The event store.</param>
        /// <param name="snapshotStore">The snapshot store.</param>
        public EventStoreRepository(IIdentityMap identityMap, IEventStore eventStore, ISnapshotStore snapshotStore)
        {
            Guard.Against.Null(() => identityMap);
            Guard.Against.Null(() => eventStore);
            Guard.Against.Null(() => snapshotStore);

            this.identityMap   = identityMap;
            this.eventStore    = eventStore;
            this.snapshotStore = snapshotStore;
        }
Пример #27
0
 public LmdbEventLog(string id, string prefix, ISnapshotStore snapshotStore = null) : base(id)
 {
     this.id            = id;
     this.prefix        = prefix;
     this.serialization = Context.System.Serialization;
     this.Settings      = new LmdbEventLogSettings(Context.System.Settings.Config);
     this.env           = LMDBEnvironment.Create(this.Settings.RootDir);
     this.db            = this.env.OpenDatabase(this.Settings.DbName, new DatabaseConfig(DbFlags.Create));
     this.SnapshotStore = snapshotStore ?? new LmdbSnapshotStore(this.serialization, this.env, this.db);
 }
Пример #28
0
 public PopulateGrainIndexes(
     IGrainFactory grainFactory,
     ISnapshotStore <AppState, Guid> statesForApps,
     ISnapshotStore <RuleState, Guid> statesForRules,
     ISnapshotStore <SchemaState, Guid> statesForSchemas)
 {
     this.grainFactory     = grainFactory;
     this.statesForApps    = statesForApps;
     this.statesForRules   = statesForRules;
     this.statesForSchemas = statesForSchemas;
 }
        internal NoCreateEntitySnapshotDenormalizer(BudgetModel budgetModel,
                                                    NoCreateEntityRepository <TEntity, TSnapshot> repository)
        {
            _budgetModel   = budgetModel ?? throw new ArgumentNullException(nameof(budgetModel));
            _repository    = repository ?? throw new ArgumentNullException(nameof(repository));
            _snapshotStore = budgetModel?.BudgetStore?.SnapshotStore ?? throw new ArgumentException("Could not find snapshot store of budgetModel", nameof(budgetModel));

            _createEntityFromSnapshot = CreateFromSnapshotConstructor();

            RegisterForMessages();
        }
        public ShapshotAggregateRepository(IEventStoreAdapter eventStore, ISnapshotStore snapshotStore, int interval)
            : base(eventStore)
        {
            Argument.IsNotNull(eventStore, nameof(eventStore));
            Argument.IsNotNull(snapshotStore, nameof(snapshotStore));
            Argument.NotNegative(interval, nameof(interval));

            _eventStore    = eventStore;
            _snapshotStore = snapshotStore;
            _interval      = interval;
        }
Пример #31
0
 public JoesUnitOfWork(Guid commandId, IDomainRepository domainRepository, IStoreEvents eventStore, ISnapshotStore snapshotStore, IEventBus eventBus, ISnapshottingPolicy snapshottingPolicy)
     : base(commandId)
 {
     _eventStream        = new UncommittedEventStream(commandId);
     _commitId           = commandId;
     _eventStore         = eventStore;
     _domainRepository   = domainRepository;
     _snapshotStore      = snapshotStore;
     _eventBus           = eventBus;
     _snapshottingPolicy = snapshottingPolicy;
 }
Пример #32
0
 public Repository(
     IEventStore eventStore,
     ISnapshotStore snapshopStore,
     IBus bus,
     ILogger logger)
 {
     this.eventStore    = eventStore ?? throw new ArgumentNullException("eventStore");
     this.snapshopStore = snapshopStore ?? throw new ArgumentNullException("snapshopStore");
     this.bus           = bus ?? throw new ArgumentNullException("bus");
     this.logger        = logger ?? throw new ArgumentNullException("logger");
 }
Пример #33
0
 private Persistence(IEventStore eventStore, ISnapshotStore snapshotStore, string actorId, Action <Event> applyEvent = null,
                     Action <Snapshot> applySnapshot = null, ISnapshotStrategy snapshotStrategy = null, Func <object> getState = null)
 {
     _eventStore       = eventStore;
     _snapshotStore    = snapshotStore;
     _actorId          = actorId;
     _applyEvent       = applyEvent;
     _applySnapshot    = applySnapshot;
     _getState         = getState;
     _snapshotStrategy = snapshotStrategy ?? new NoSnapshots();
 }
Пример #34
0
 public JoesUnitOfWork(Guid commandId, IDomainRepository domainRepository, IStoreEvents eventStore, ISnapshotStore snapshotStore, IEventBus eventBus, ISnapshottingPolicy snapshottingPolicy)
     : base(commandId)
 {
     _eventStream = new UncommittedEventStream(commandId);
     _commitId = commandId;
     _eventStore = eventStore;
     _domainRepository = domainRepository;
     _snapshotStore = snapshotStore;
     _eventBus = eventBus;
     _snapshottingPolicy = snapshottingPolicy;
 }
Пример #35
0
        public FhirService(Infrastructure infrastructure)
        {
            this.localhost = infrastructure.Localhost;
            this.store = infrastructure.Store;
            this.snapshotstore = infrastructure.SnapshotStore;
            this.generator = infrastructure.Generator;
            this.index = infrastructure.Index;
            this.listener = infrastructure.ServiceListener;

            transfer = new Transfer(generator, localhost);
            pager = new Pager(store, snapshotstore, localhost, transfer);
        }
 public EventSourcingAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ISnapshotter snapshotter,
     ITypeCodeProvider aggregateRootTypeCodeProvider)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _eventStore = eventStore;
     _snapshotStore = snapshotStore;
     _snapshotter = snapshotter;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
 }
 /// <summary>Parameterized constructor.
 /// </summary>
 /// <param name="aggregateRootFactory"></param>
 /// <param name="eventStreamConvertService"></param>
 /// <param name="eventSourcingService"></param>
 /// <param name="eventStore"></param>
 /// <param name="snapshotStore"></param>
 /// <param name="aggregateRootTypeCodeProvider"></param>
 public EventSourcingAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     IEventStreamConvertService eventStreamConvertService,
     IEventSourcingService eventSourcingService,
     IEventStore eventStore,
     ISnapshotStore snapshotStore,
     IAggregateRootTypeCodeProvider aggregateRootTypeCodeProvider)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _eventStreamConvertService = eventStreamConvertService;
     _eventSourcingService = eventSourcingService;
     _eventStore = eventStore;
     _snapshotStore = snapshotStore;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
 }
Пример #38
0
        public FhirService(ILocalhost localhost, IFhirStore fhirStore, ISnapshotStore snapshotStore, IGenerator keyGenerator,
            IFhirIndex fhirIndex, IServiceListener serviceListener, IFhirResponseFactory responseFactory, IndexService indexService)
        {
            this.localhost = localhost;
            this.fhirStore = fhirStore;
            this.snapshotstore = snapshotStore;
            this.keyGenerator = keyGenerator;
            this.fhirIndex = fhirIndex;
            this.serviceListener = serviceListener;
            this.responseFactory = responseFactory;
            _indexService = indexService;

            transfer = new Transfer(this.keyGenerator, localhost);
            pager = new Pager(this.fhirStore, snapshotstore, localhost, transfer, ModelInfo.SearchParameters);
            //TODO: Use FhirModel instead of ModelInfo for the searchparameters.
        }
Пример #39
0
        public UnitOfWork(Guid commandId, IDomainRepository domainRepository, IEventStore eventStore, ISnapshotStore snapshotStore, IEventBus eventBus, ISnapshottingPolicy snapshottingPolicy) : base(commandId)
        {
            Contract.Requires<ArgumentNullException>(domainRepository != null);
            Contract.Requires<ArgumentNullException>(snapshotStore != null);
            Contract.Requires<ArgumentNullException>(eventStore != null);
            Contract.Requires<ArgumentNullException>(eventBus != null);
            Contract.Requires<ArgumentNullException>(snapshottingPolicy != null);

            _repository = domainRepository;
            _snapshottingPolicy = snapshottingPolicy;
            _eventBus = eventBus;
            _snapshotStore = snapshotStore;
            _eventStore = eventStore;
            _eventStream = new UncommittedEventStream(commandId);
            _dirtyInstances = new Queue<AggregateRoot>();
        }
Пример #40
0
 /// <summary>
 /// Parameterized constructor.
 /// </summary>
 public EventSourcedRepository(IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ISnapshotPolicy snapshotPolicy,
     IMemoryCache cache,
     IEventBus eventBus,
     IAggregateRootFactory aggregateFactory,
     IBinarySerializer binarySerializer)
 {
     this._eventStore = eventStore;
     this._snapshotStore = snapshotStore;
     this._snapshotPolicy = snapshotPolicy;
     this._cache = cache;
     this._eventBus = eventBus;
     this._aggregateFactory = aggregateFactory;
     this._binarySerializer = binarySerializer;
     //this._textSerializer = textSerializer;
     this._logger = LogManager.GetLogger("ThinkNet");
 }
Пример #41
0
 public ModelLoader(EngineConfiguration config, ICommandStore commandStore = null, ISnapshotStore snapshotStore = null)
 {
     _commandStore = commandStore ?? config.CreateCommandStore();
     _snapshotStore = snapshotStore ?? config.CreateSnapshotStore();
 }
Пример #42
0
 public MetaModelRepository(IEventStore store, IEventBus eventBus, ISnapshotStore snapshotStore = null, IAggregateRootCreationStrategy aggregateRootCreationStrategy = null)
     : base(new BranchableEventStoreAdapter(store), eventBus, snapshotStore, aggregateRootCreationStrategy)
 {
 }