Esempio n. 1
0
        public OperationFetcher(IStateReplicator stateReplicator, OperationProcessorInfo copyOperationProcessor, OperationProcessorInfo replicationOperationProcessor, bool drainQueuesInParallel)
        {
            Requires.Argument("partition", stateReplicator).NotNull();
            Requires.Argument("copyOperationProcessor", copyOperationProcessor).NotNull();
            Requires.Argument("replicationOperationProcessor", replicationOperationProcessor).NotNull();

            if (copyOperationProcessor.Callback == null)
            {
                throw new ArgumentException("copyOperationProcessor.Callback cannot be null");
            }

            if (replicationOperationProcessor.Callback == null)
            {
                throw new ArgumentException("replicationOperationProcessor.Callback cannot be null");
            }

            this.copyOperationQueue = new OperationQueue(() => stateReplicator.GetCopyStream(), copyOperationProcessor)
            {
                Name = "CopyQueue"
            };
            this.replicationOperationQueue = new OperationQueue(() => stateReplicator.GetReplicationStream(), replicationOperationProcessor)
            {
                Name = "ReplicationQueue"
            };
            this.drainQueuesInParallel = drainQueuesInParallel;
            this.role = ReplicaRole.None;
        }
Esempio n. 2
0
            public OperationQueue(Func <IOperationStream> operationStreamGetter, OperationProcessorInfo info)
            {
                Requires.Argument("operationGetterFunc", operationStreamGetter).NotNull();
                Requires.Argument("info", info).NotNull();

                this.info = info;
                this.operationStreamGetter = operationStreamGetter;
            }