예제 #1
0
        public static void ReadLastEtagsFromFile(string exportDirectory, DocumentsOperationContext context, SmugglerExporter smugglerExporter)
        {
            var etagFileLocation = Path.Combine(exportDirectory, IncrementalExportStateFile);

            if (File.Exists(etagFileLocation) == false)
            {
                return;
            }

            using (var fileStream = new FileStream(etagFileLocation, FileMode.Open))
            {
                var reader = context.ReadForMemory(fileStream, IncrementalExportStateFile);
                reader.TryGet("LastDocsEtag", out smugglerExporter.StartDocsEtag);
            }
        }
예제 #2
0
        public static long?ReadLastEtagsFromFile(string backupDirectory, DocumentsOperationContext context)
        {
            var etagFileLocation = Path.Combine(backupDirectory, IncrementalBackupStateFile);

            if (File.Exists(etagFileLocation) == false)
            {
                return(null);
            }

            using (var fileStream = new FileStream(etagFileLocation, FileMode.Open))
            {
                using (var reader = context.ReadForMemory(fileStream, IncrementalBackupStateFile))
                {
                    if (reader.TryGet("LastEtag", out long lastDocsEtag) == false)
                    {
                        return(null);
                    }

                    return(lastDocsEtag);
                }
            }
        }