Raven.Database.Smuggler.DataDumper.ExportAttachments C# (CSharp) Méthode

ExportAttachments() protected méthode

protected ExportAttachments ( Raven.Imports.Newtonsoft.Json.JsonTextWriter jsonWriter, Etag lastEtag ) : Task
jsonWriter Raven.Imports.Newtonsoft.Json.JsonTextWriter
lastEtag Etag
Résultat Task
		protected override async Task<Etag> ExportAttachments(JsonTextWriter jsonWriter, Etag lastEtag)
		{
			var totalCount = 0;
			while (true)
			{
				var array = GetAttachments(totalCount, lastEtag);
				if (array.Length == 0)
				{
					var databaseStatistics = await GetStats();
					if (lastEtag == null) lastEtag = Etag.Empty;
					if (lastEtag.CompareTo(databaseStatistics.LastAttachmentEtag) < 0)
					{
						lastEtag = EtagUtil.Increment(lastEtag, SmugglerOptions.BatchSize);
						ShowProgress("Got no results but didn't get to the last attachment etag, trying from: {0}", lastEtag);
						continue;
					}
					ShowProgress("Done with reading attachments, total: {0}", totalCount);
					return lastEtag;
				}
				totalCount += array.Length;
				ShowProgress("Reading batch of {0,3} attachments, read so far: {1,10:#,#;;0}", array.Length, totalCount);
				foreach (var item in array)
				{
					item.WriteTo(jsonWriter);
				}
				lastEtag = Etag.Parse(array.Last().Value<string>("Etag"));
			}
		}