Exemplo n.º 1
0
        //private CollectorInfo()
        //{
        //    CID = new CollectorID(-1, string.Empty);
        //    DID = new DeviceID(-1, string.Empty);
        //    collectorType = ECollectorType.Unknown;
        //    isEnabled = true;
        //    frequencyInMinutes = collectorType.GetFrequencyInMinutes();
        //    SkipConfiguration = collectorType.GetSkipConfiguration();
        //    lastCollectionAttempt = lastCollectedAt = nextCollectionTime = null;
        //    successfullyCollected = true;
        //    isBeingCollected = false;
        //}

        public CollectorInfo(ECollectorType type)
        {
            CID                   = new CollectorID(-1, string.Empty);
            DID                   = new DeviceID(-1, string.Empty);
            collectorType         = type;
            isEnabled             = true;
            frequencyInMinutes    = collectorType.GetFrequencyInMinutes();
            SkipConfiguration     = collectorType.GetSkipConfiguration();
            lastCollectionAttempt = lastCollectedAt = nextCollectionTime = null;
            successfullyCollected = true;
            isBeingCollected      = false;
        }
Exemplo n.º 2
0
        private static void PruneCollector(CollectorInfo collector, SQLiteConnection conn)
        {
            Console.WriteLine($">>> Starting prune for {collector.name}");
            ECollectorType type = collector.collectorType;
            int            default_frequency = type.GetFrequencyInMinutes();
            TimeSpan       span = TimeSpan.FromMinutes(default_frequency);

            Stopwatch watch = Stopwatch.StartNew();

            List <long> doomed = GatherDoomedData(collector, span, out long saved_count, conn);

            Console.WriteLine($"Found {doomed.Count} records to delete, {saved_count} will be retained");
            Console.WriteLine($"Search took {watch.ElapsedMilliseconds} ms");

            watch.Restart();

            MeetTheirDemise(doomed, conn);

            Console.WriteLine($"<<< Completed prune for {collector.name}, it took {watch.ElapsedMilliseconds} ms");
        }