示例#1
0
        /* F E T C H  P A R T I T I O N  F O R  D A T E */

        /*----------------------------------------------------------------------------
        *       %%Function: FetchPartitionForDateAsync
        *       %%Qualified: AzLog.AzLogModel.FetchPartitionForDateAsync
        *       %%Contact: rlittle
        *
        *   Fetch the partition for the given dttm (assumes that the hour is also
        *   filled in)
        *  ----------------------------------------------------------------------------*/
        public async Task <bool> FetchPartitionForDateAsync(AzLogModel azlm, DateTime dttm)
        {
            TableQuery <AzLogEntryEntity> tq =
                new TableQuery <AzLogEntryEntity>().Where(
                    TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal,
                                                       AzLogModel.SPartitionFromDate(dttm, dttm.Hour)));

            TableQuerySegment <AzLogEntryEntity> azleSegment = null;

            azlm.UpdatePart(dttm, dttm.AddHours(1.0), AzLogParts.GrfDatasourceForIDatasource(m_iDatasource), AzLogPartState.Pending);

            foreach (AzLogView azlv in azlm.Listeners)
            {
                azlv.BeginAsyncData();
            }

            while (azleSegment == null || azleSegment.ContinuationToken != null)
            {
                azleSegment = await m_azt.Table.ExecuteQuerySegmentedAsync(tq, azleSegment?.ContinuationToken);

                int iFirst, iLast;

                azlm.AddSegment(azleSegment, out iFirst, out iLast);

                azlm.UpdatePart(dttm, dttm.AddHours(1.0), AzLogParts.GrfDatasourceForIDatasource(m_iDatasource), AzLogPartState.Complete);
            }
            foreach (AzLogView azlv in azlm.Listeners)
            {
                azlv.CompleteAsyncData();
            }

            return(true);
        }
示例#2
0
        /* F E T C H  P A R T I T I O N  F O R  D A T E */

        /*----------------------------------------------------------------------------
        *       %%Function: FetchPartitionForDateAsync
        *       %%Qualified: AzLog.AzLogModel.FetchPartitionForDateAsync
        *       %%Contact: rlittle
        *
        *   for text files, its all or nothing (there's no query on top of the file)
        *   so when they ask for any data, they get all data. we will just remember
        *   internally if they have already been given all of our data
        *  ----------------------------------------------------------------------------*/
        public async Task <bool> FetchPartitionForDateAsync(AzLogModel azlm, DateTime dttm)
        {
            if (m_fDataLoaded || m_fDataLoading)
            {
                return(true);
            }

            m_fDataLoading = true;

            // since they asked for this dttm, at least tell them we're pending
            azlm.UpdatePart(dttm, dttm.AddHours(1.0), AzLogParts.GrfDatasourceForIDatasource(m_iDatasource), AzLogPartState.Pending);

            foreach (AzLogView azlv in azlm.Listeners)
            {
                azlv.BeginAsyncData();
            }

            await LoadCompleteModel(azlm);

            azlm.UpdatePart(dttm, dttm.AddHours(1.0), AzLogParts.GrfDatasourceForIDatasource(m_iDatasource), AzLogPartState.Complete);

            foreach (AzLogView azlv in azlm.Listeners)
            {
                azlv.CompleteAsyncData();
            }

            m_fDataLoaded  = true;
            m_fDataLoading = false;
            return(true);
        }
示例#3
0
        /* F E T C H  P A R T I T I O N  F O R  D A T E */

        /*----------------------------------------------------------------------------
        *       %%Function: FetchPartitionForDateAsync
        *       %%Qualified: AzLog.AzLogModel.FetchPartitionForDateAsync
        *       %%Contact: rlittle
        *
        *   Fetch the partition for the given dttm (assumes that the hour is also
        *   filled in)
        *  ----------------------------------------------------------------------------*/
        public async Task <bool> FetchPartitionForDateAsync(AzLogModel azlm, DateTime dttm)
        {
            List <Uri> pluri = GetBlobList(dttm);

            azlm.UpdatePart(dttm, dttm.AddHours(1.0), AzLogParts.GrfDatasourceForIDatasource(m_iDatasource), AzLogPartState.Pending);

            foreach (AzLogView azlv in azlm.Listeners)
            {
                azlv.BeginAsyncData();
            }

            foreach (Uri uri in pluri)
            {
                ICloudBlob icb       = m_azcc.BlobClient.GetBlobReferenceFromServer(uri);
                string     sTempFile = TCore.Util.Filename.SBuildTempFilename(null, null);

                icb.DownloadToFile(sTempFile, FileMode.Create);
                // at this point, we have the file
            }

            // now we can download the blobs -- create CloudBlob for each URI, then DownloadToFile...
            // need to do this async....
#if no
            TableQuery <AzLogEntryEntity> tq =
                new TableQuery <AzLogEntryEntity>().Where(
                    TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal,
                                                       AzLogModel.SPartitionFromDate(dttm, dttm.Hour)));

            TableQuerySegment <AzLogEntryEntity> azleSegment = null;
            azlm.UpdatePart(dttm, dttm.AddHours(1.0), AzLogParts.GrfDatasourceForIDatasource(m_iDatasource), AzLogPartState.Pending);

            foreach (AzLogView azlv in azlm.Listeners)
            {
                azlv.BeginAsyncData();
            }

            while (azleSegment == null || azleSegment.ContinuationToken != null)
            {
                azleSegment = await m_azc.Container.ExecuteQuerySegmentedAsync(tq, azleSegment?.ContinuationToken);

                int iFirst, iLast;

                azlm.AddSegment(azleSegment, out iFirst, out iLast);

                azlm.UpdatePart(dttm, dttm.AddHours(1.0), AzLogParts.GrfDatasourceForIDatasource(m_iDatasource), AzLogPartState.Complete);
            }
            foreach (AzLogView azlv in azlm.Listeners)
            {
                azlv.CompleteAsyncData();
            }
#endif
            return(true);
        }
示例#4
0
        public void AddTestDataPartition(DateTime dttmPartition, Int64[] rgTickCount, string [] rgs)
        {
            AzLogEntries azles = new AzLogEntries();

            for (int i = 0; i < rgTickCount.Length; i++)
            {
                Int64  nTickCount = rgTickCount[i];
                string s          = rgs == null ? "msg" : rgs[i];

                AzLogEntry azle = AzLogEntry.Create(dttmPartition.ToString("yyyyMMddHH"), Guid.NewGuid(), nTickCount, "testdata", "Informational",
                                                    1, "2", 3, 4, s);

                m_azles.AddLogEntry(azle);
            }

            azles.UpdatePart(dttmPartition, dttmPartition.AddHours(1), AzLogParts.GrfDatasourceForIDatasource(1), AzLogPartState.Complete);
        }
示例#5
0
        /* F E T C H  P A R T I T I O N S  F O R  D A T E  R A N G E */

        /*----------------------------------------------------------------------------
        *       %%Function: FFetchPartitionsForDateRange
        *       %%Qualified: AzLog.AzLogModel.FFetchPartitionsForDateRange
        *       %%Contact: rlittle
        *
        *   Fetch all the partitions in the given range.
        *  ----------------------------------------------------------------------------*/
        public bool FFetchPartitionsForDateRange(DateTime dttmMin, DateTime dttmMac)
        {
            DateTime dttm = dttmMin;

            while (dttm < dttmMac)
            {
                // if its complete or pending, don't query it again...
                if (m_azles.GetPartState(dttm) != AzLogPartState.Complete && m_azles.GetPartState(dttm) != AzLogPartState.Pending)
                {
                    for (int i = 0; i < m_pliazldsSources.Count; i++)
                    {
                        IAzLogDatasource iazlds = m_pliazldsSources[i];
#if NOMORE // the marking of Pending happens in the FetchPartitionForDateAsync
                        // if this ever comes back, then we will have to get the correct IDataSource.
                        m_azles.UpdatePart(dttmMin, dttmMin.AddHours(1), AzLogParts.GrfDatasourceForIDatasource(1), AzLogPartState.Pending);
#endif
                        iazlds.FetchPartitionForDateAsync(this, dttm);
                    }
                }
                dttm = dttm.AddHours(1);
            }
            return(true);
        }