Exemplo n.º 1
0
        private UnaryPipe <TKey, TPayload, TPayload> GetPipe(ExtendLifetimeStreamable <TKey, TPayload> stream, IStreamObserver <TKey, TPayload> observer)
        {
            var lookupKey = CacheKey.Create(this.duration);

            var generatedPipeType = cachedPipes.GetOrAdd(lookupKey, key => ExtendLifetimeBaseTemplate.Generate(stream, this.duration));
            Func <PlanNode, IQueryObject, PlanNode> planNode = (PlanNode p, IQueryObject o) => new ExtendLifetimePlanNode(p, o, typeof(TKey), typeof(TPayload), true, generatedPipeType.Item2, this.duration < 0);

            var instance    = Activator.CreateInstance(generatedPipeType.Item1, stream, observer, planNode, (this.duration < 0) ? -this.duration : this.duration);
            var returnValue = (UnaryPipe <TKey, TPayload, TPayload>)instance;

            return(returnValue);
        }
Exemplo n.º 2
0
        protected override bool CanGenerateColumnar()
        {
            var typeOfTKey     = typeof(TKey);
            var typeOfTPayload = typeof(TPayload);

            if (typeOfTKey.GetPartitionType() != null)
            {
                return(false);
            }
            if (!typeOfTPayload.CanRepresentAsColumnar())
            {
                return(false);
            }

            var lookupKey = CacheKey.Create(this.duration);

            var generatedPipeType = cachedPipes.GetOrAdd(lookupKey, key => ExtendLifetimeBaseTemplate.Generate(this, this.duration));

            this.errorMessages = generatedPipeType.Item2;
            return(generatedPipeType.Item1 != null);
        }