Exemplo n.º 1
0
        public void AttachInputMessage(PqlMessage requestMessage, IDataEngine engine, IPqlClientSecurityContext authContext)
        {
            if (requestMessage == null)
            {
                throw new ArgumentNullException("requestMessage");
            }

            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

            if (authContext == null)
            {
                throw new ArgumentNullException("authContext");
            }

            AssertIsClean();

            ClauseEvaluationContext = new ClauseEvaluationContext();

            m_authContext             = authContext;
            m_requestMessage          = requestMessage;
            m_engine                  = engine;
            m_cancellationTokenSource = new CancellationTokenSource();

            // re-initialize the ring, for fault tolerance in case if previous processor fails to release items
            m_buffersRing = new DataRing <RequestExecutionBuffer>(m_buffersRingItems.Length, m_buffersRingItems.Length);
            foreach (var item in m_buffersRingItems)
            {
                // make all buffers available to producer
                m_buffersRing.AddTaskForProcessing(item, m_cancellationTokenSource.Token);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets security context on current thread's state.
        /// </summary>
        public static void Set(IPqlClientSecurityContext clientSecurityContext)
        {
            if (clientSecurityContext == null)
            {
                throw new ArgumentNullException("clientSecurityContext");
            }

            Context.Value = clientSecurityContext;
        }
        /// <summary>
        /// Sets security context on current thread's state.
        /// </summary>
        public static void Set(IPqlClientSecurityContext clientSecurityContext)
        {
            if (clientSecurityContext == null)
            {
                throw new ArgumentNullException("clientSecurityContext");
            }

            Context.Value = clientSecurityContext;
        }
        public void Attach(PqlMessage requestMessage, IDataEngine dataEngine, IPqlClientSecurityContext authContext)
        {
            if (dataEngine == null)
            {
                throw new ArgumentNullException("dataEngine");
            }

            if (authContext == null)
            {
                throw new ArgumentNullException("authContext");
            }

            m_executionContext.AssertIsClean();
            m_executionContext.AttachInputMessage(requestMessage, dataEngine, authContext);
        }
Exemplo n.º 5
0
        public void Cleanup()
        {
            m_authContext           = null;
            m_lastError             = null;
            m_requestMessage        = null;
            m_engine                = null;
            ResponseHeaders         = null;
            RecordsAffected         = 0;
            TotalRowsProduced       = 0;
            DriverOutputBuffer      = null;
            InputDataEnumerator     = null;
            ClauseEvaluationContext = null;
            OutputDataBuffer        = null;
            Completion              = null;
            ContainerDescriptor     = null;

            CacheInfo = null;
            Request.Clear();
            RequestBulk.Clear();
            RequestParameters.Clear();
            ParsedRequest.Clear();

            var cancellation = Interlocked.CompareExchange(ref m_cancellationTokenSource, null, m_cancellationTokenSource);

            if (cancellation != null)
            {
                cancellation.Cancel();
            }

            var ring = Interlocked.CompareExchange(ref m_buffersRing, null, m_buffersRing);

            if (ring != null)
            {
                ring.Dispose();
            }

            var items = m_buffersRingItems; // do not replace with null

            if (items != null)
            {
                foreach (var item in items)
                {
                    item.Cleanup();
                }
            }
        }
        public void Attach(PqlMessage requestMessage, IDataEngine dataEngine, IPqlClientSecurityContext authContext)
        {
            if (dataEngine == null)
            {
                throw new ArgumentNullException("dataEngine");
            }

            if (authContext == null)
            {
                throw new ArgumentNullException("authContext");
            }

            m_executionContext.AssertIsClean();
            m_executionContext.AttachInputMessage(requestMessage, dataEngine, authContext);
        }
 /// <summary>
 /// Writes <see cref="IPqlClientSecurityContext"/> to semicolon-separated string.
 /// </summary>
 public static string GetString(IPqlClientSecurityContext ctx)
 {
     return(string.Format("{0};{1};{2};{3}", ctx.ContextId, ctx.ApplicationName, ctx.TenantId, ctx.UserId));
 }
 /// <summary>
 /// Writes <see cref="IPqlClientSecurityContext"/> to semicolon-separated string.
 /// </summary>
 public static string GetString(IPqlClientSecurityContext ctx)
 {
     return string.Format("{0};{1};{2};{3}", ctx.ContextId, ctx.ApplicationName, ctx.TenantId, ctx.UserId);
 }
        public void Cleanup()
        {
            m_authContext = null;
            m_lastError = null;
            m_requestMessage = null;
            m_engine = null;
            ResponseHeaders = null;
            RecordsAffected = 0;
            TotalRowsProduced = 0;
            DriverOutputBuffer = null;
            InputDataEnumerator = null;
            ClauseEvaluationContext = null;
            OutputDataBuffer = null;
            Completion = null;
            ContainerDescriptor = null;

            CacheInfo = null;
            Request.Clear();
            RequestBulk.Clear();
            RequestParameters.Clear();
            ParsedRequest.Clear();

            var cancellation = Interlocked.CompareExchange(ref m_cancellationTokenSource, null, m_cancellationTokenSource);
            if (cancellation != null)
            {
                cancellation.Cancel();
            }

            var ring = Interlocked.CompareExchange(ref m_buffersRing, null, m_buffersRing);
            if (ring != null)
            {
                ring.Dispose();
            }

            var items = m_buffersRingItems; // do not replace with null
            if (items != null)
            {
                foreach (var item in items)
                {
                    item.Cleanup();
                }
            }
        }
        public void AttachInputMessage(PqlMessage requestMessage, IDataEngine engine, IPqlClientSecurityContext authContext)
        {
            if (requestMessage == null)
            {
                throw new ArgumentNullException("requestMessage");
            }

            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

            if (authContext == null)
            {
                throw new ArgumentNullException("authContext");
            }

            AssertIsClean();

            ClauseEvaluationContext = new ClauseEvaluationContext();

            m_authContext = authContext;
            m_requestMessage = requestMessage;
            m_engine = engine;
            m_cancellationTokenSource = new CancellationTokenSource();

            // re-initialize the ring, for fault tolerance in case if previous processor fails to release items
            m_buffersRing = new DataRing<RequestExecutionBuffer>(m_buffersRingItems.Length, m_buffersRingItems.Length);
            foreach (var item in m_buffersRingItems)
            {
                // make all buffers available to producer
                m_buffersRing.AddTaskForProcessing(item, m_cancellationTokenSource.Token);
            }
        }