Exemplo n.º 1
0
        /// <inheritdoc />
        public EventHubContentLocationEventStore(
            EventHubContentLocationEventStoreConfiguration configuration,
            IContentLocationEventHandler eventHandler,
            string localMachineName,
            CentralStorage centralStorage,
            Interfaces.FileSystem.AbsolutePath workingDirectory)
            : base(configuration, nameof(EventHubContentLocationEventStore), eventHandler, centralStorage, workingDirectory)
        {
            Contract.Requires(configuration.MaxEventProcessingConcurrency >= 1);
            _configuration    = configuration;
            _localMachineName = localMachineName;

            if (configuration.MaxEventProcessingConcurrency > 1)
            {
                _eventProcessingBlocks =
                    Enumerable.Range(1, configuration.MaxEventProcessingConcurrency)
                    .Select(
                        _ =>
                {
                    var serializer = new ContentLocationEventDataSerializer(configuration.SelfCheckSerialization ? ValidationMode.Trace : ValidationMode.Off);
                    return(new ActionBlock <ProcessEventsInput>(
                               t => ProcessEventsCoreAsync(t, serializer),
                               new ExecutionDataflowBlockOptions()
                    {
                        MaxDegreeOfParallelism = 1,
                        BoundedCapacity = configuration.EventProcessingMaxQueueSize,
                    }));
                })
                    .ToArray();
            }
        }
Exemplo n.º 2
0
 /// <inheritdoc />
 public MemoryContentLocationEventStore(
     MemoryContentLocationEventStoreConfiguration configuration,
     IContentLocationEventHandler handler,
     CentralStorage centralStorage,
     Interfaces.FileSystem.AbsolutePath workingDirectory)
     : base(configuration, nameof(MemoryContentLocationEventStore), handler, centralStorage, workingDirectory)
 {
     _hub          = configuration.Hub;
     _hub.OnEvent += HubOnEvent;
 }
 /// <inheritdoc />
 public override bool IsImmutable(Interfaces.FileSystem.AbsolutePath dbFile)
 {
     return(false);
 }
 /// <inheritdoc />
 protected override BoolResult RestoreCheckpointCore(OperationContext context, Interfaces.FileSystem.AbsolutePath checkpointDirectory)
 {
     return(BoolResult.Success);
 }