Пример #1
0
        public async Task <Stream> OpenReadAsync(string fullPath, CancellationToken cancellationToken)
        {
            GenericValidation.CheckBlobFullPath(fullPath);

            AdlsClient client = await GetAdlsClientAsync().ConfigureAwait(false);

            try
            {
                AdlsInputStream response = await client.GetReadStreamAsync(fullPath, cancellationToken).ConfigureAwait(false);

                return(response);
            }
            catch (AdlsException ex) when(ex.HttpStatus == HttpStatusCode.NotFound)
            {
                return(null);
            }
        }
        /// <summary>
        /// used for debugging
        /// </summary>
        /// <param name="context"></param>
        /// <param name="mockingStream"></param>
        public ParallelDatalakeFlatFileExtractor(PipelineContext context, AdlsInputStream mockingStream)
        {
            m_Context = context;
            int m_Buffersize = m_Context.ADLStreamBufferSize;

            m_Buffer1  = new byte[m_Buffersize];
            m_Buffer2  = new byte[m_Buffersize];
            m_Stream   = mockingStream;
            m_Syncroot = new object();
            //init buffer
            FillInactiveBuffer().Wait();
            m_PointerToActiveBuffer = m_Buffer1;
            m_Buffer1IsActive       = true;

            //start filling the second buffer
            m_TaskInProgress = FillInactiveBuffer();
        }
        public async Task <Stream> OpenReadAsync(string id, CancellationToken cancellationToken)
        {
            GenericValidation.CheckBlobId(id);

            AdlsClient client = await GetAdlsClient();

            try
            {
                AdlsInputStream response = await client.GetReadStreamAsync(id, cancellationToken);

                return(response);
            }
            catch (AdlsException ex) when(ex.HttpStatus == HttpStatusCode.NotFound)
            {
                return(null);
            }
        }
        public ParallelDatalakeFlatFileExtractor(PipelineContext context)
        {
            m_Context    = context;
            m_Buffersize = m_Context.ADLStreamBufferSize;
            m_Buffer1    = new byte[m_Buffersize];
            m_Buffer2    = new byte[m_Buffersize];
            AzureClient client = new AzureClient(context);
            var         adls   = client.GetDataLakeClient(m_Context.DataLakeAdress, m_Context.PromptAzureLogin);

            m_Stream   = adls.GetReadStream(m_Context.SourceFilePath, m_Buffersize);
            m_Syncroot = new object();
            //init buffer
            FillInactiveBuffer().Wait();
            m_PointerToActiveBuffer = m_Buffer1;
            m_Buffer1IsActive       = true;

            //start filling the second buffer
            m_TaskInProgress = FillInactiveBuffer();
        }