コード例 #1
0
        private IList <DateTimeRangeArchive> ParseArchives(IList <string> archiveIds)
        {
            var archives = new List <DateTimeRangeArchive>();

            foreach (var archiveId in archiveIds)
            {
                var archive = DateTimeRangeArchive.TryParse(archiveId);
                if (archive != null)
                {
                    archives.Add(archive);
                }
            }
            return(archives);
        }
コード例 #2
0
        public Task Add(IList <IClientSpan> spans)
        {
            if (spans == null || spans.Count == 0)
            {
                return(0.AsTask());
            }

            var entities = new List <ClientSpanEntity>();

            foreach (var span in spans)
            {
                var spanEntity = new ClientSpanEntity();
                MyModelHelper.SetProperties(spanEntity, span);
                entities.Add(spanEntity);
            }

            var jsonLine = entities.ToJson(false);

            var now      = spans.Min(x => x.StartUtc);
            var archive  = DateTimeRangeArchive.Create(now);
            var filePath = CreateFilePath(archive.ArchiveId);

            return(_asyncFile.AppendAllText(filePath, jsonLine, true));
        }