CalendarAggregator.FeedRegistry.SaveStatsToAzure C# (CSharp) Метод

SaveStatsToAzure() публичный Метод

public SaveStatsToAzure ( ) : ElmcityUtils.HttpResponse
Результат ElmcityUtils.HttpResponse
        public HttpResponse SaveStatsToAzure()
        {
            var entity = new Dictionary<string, object>();
            entity["PartitionKey"] = entity["RowKey"] = this.id;
            var events_loaded = 0;
            foreach (var feedurl in this.feeds.Keys)
            {
                if (this.stats.ContainsKey(feedurl))
                {
                    var ical_stats = this.stats[feedurl];
                    events_loaded += ical_stats.loaded;
                }
                else
                {
                    GenUtils.LogMsg("warning", "FeedRegistry.SaveStatsToAzure", "stats dict does not contain expected feedurl " + feedurl);
                }
            }
            entity["ical_events"] = events_loaded;
            return this.ts.MergeEntity("metadata", this.id, this.id, entity).http_response;
        }

Usage Example

Пример #1
0
        private void SerializeStatsAndIntermediateOutputs(FeedRegistry fr, EventStore es, iCalendar ical, NonIcalStats stats, SourceType type)
        {
            BlobStorageResponse bsr;
            HttpResponse tsr;

            if (BlobStorage.ExistsContainer(this.id) == false)
                bs.CreateContainer(this.id, is_public: true, headers: new Hashtable());

            if (type == SourceType.ical) // NonIcalStats is null in this case, and not used
            {
                bsr = fr.SerializeIcalStatsToJson();
                GenUtils.LogMsg("info", this.id + ": SerializeIcalStatsToJson",  bsr.HttpResponse.status.ToString());
                tsr = fr.SaveStatsToAzure();
                GenUtils.LogMsg("info", this.id + ": FeedRegistry.SaveStatsToAzure", tsr.status.ToString());
            }
            else
            {

                bsr = Utils.SerializeObjectToJson(stats, this.id, stats.blobname + ".json");
                GenUtils.LogMsg("info", this.id + ": Collector: SerializeObjectToJson: " + stats.blobname + ".json", bsr.HttpResponse.status.ToString());
                tsr = this.SaveStatsToAzure(type);
                GenUtils.LogMsg("info", this.id + ": Collector: SaveStatsToAzure", tsr.status.ToString());

            }

            bsr = this.SerializeIcalEventsToIcs(ical, type);
            GenUtils.LogMsg("info", this.id + ": SerializeIcalStatsToIcs: " + id + "_" + type.ToString() + ".ics", bsr.HttpResponse.status.ToString());

            bsr = es.Serialize();
            GenUtils.LogMsg("info", this.id + ": EventStore.Serialize: " + es.objfile, bsr.HttpResponse.status.ToString());
        }