public async Task <DynamicArray> GetRevisionsBinEntriesAsync(long etag, int?pageSize = null) { var command = new GetRevisionsBinEntryCommand(etag, pageSize); await RequestExecutor.ExecuteAsync(command, Context); return(new DynamicArray(command.Result.Results)); }
public async Task ImportRevisionDocumentsWithoutDocuments() { var file = Path.Combine(NewDataPath(forceCreateDir: true), Guid.NewGuid().ToString()); try { using (var store1 = GetDocumentStore(new Options { ModifyDatabaseName = s => $"{s}_store1" })) { using (var session = store1.OpenAsyncSession()) { await RevisionsHelper.SetupRevisions(Server.ServerStore, store1.Database); await session.StoreAsync(new Person { Name = "Name1" }); await session.StoreAsync(new Person { Name = "Name2" }); await session.StoreAsync(new Company { Name = "Hibernating Rhinos " }); await session.SaveChangesAsync(); } for (int i = 0; i < 2; i++) { using (var session = store1.OpenAsyncSession()) { var company = await session.LoadAsync <Company>("companies/1-A"); var person = await session.LoadAsync <Person>("people/1-A"); company.Name += " update " + i; person.Name += " update " + i; await session.StoreAsync(company); await session.StoreAsync(person); await session.SaveChangesAsync(); } } using (var session = store1.OpenAsyncSession()) { var person = await session.LoadAsync <Person>("people/2-A"); Assert.NotNull(person); session.Delete(person); await session.SaveChangesAsync(); } var operation = await store1.Smuggler.ExportAsync(new DatabaseSmugglerExportOptions { OperateOnTypes = DatabaseItemType.RevisionDocuments | DatabaseItemType.DatabaseRecord }, file); await operation.WaitForCompletionAsync(TimeSpan.FromMinutes(1)); var stats = await store1.Maintenance.SendAsync(new GetStatisticsOperation()); Assert.Equal(4, stats.CountOfDocuments); Assert.Equal(8, stats.CountOfRevisionDocuments); } using (var store2 = GetDocumentStore(new Options { ModifyDatabaseName = s => $"{s}_store2" })) { var operation = await store2.Smuggler.ImportAsync(new DatabaseSmugglerImportOptions(), file); await operation.WaitForCompletionAsync(TimeSpan.FromMinutes(1)); var stats = await store2.Maintenance.SendAsync(new GetStatisticsOperation()); Assert.Equal(0, stats.CountOfDocuments); Assert.Equal(10, stats.CountOfRevisionDocuments); using (Server.ServerStore.ContextPool.AllocateOperationContext(out JsonOperationContext context)) { var command = new GetRevisionsBinEntryCommand(long.MaxValue, 5); await store2.GetRequestExecutor().ExecuteAsync(command, context); Assert.Equal(3, command.Result.Results.Length); } } } finally { File.Delete(file); } }