public void CanOpenAfterCompaction() { var memoryPersistentSource = new MemoryPersistentSource(); var tableStorage = new TableStorage(memoryPersistentSource); tableStorage.Initialze(); tableStorage.BeginTransaction(); tableStorage.Documents.Put(new JObject { {"key", "1"}, {"etag", Guid.NewGuid().ToByteArray()}, {"modified", DateTime.UtcNow}, {"id", 1}, {"entityName", "test"} }, new byte[512] ); tableStorage.Documents.Put(new JObject { {"key", "2"}, {"etag", Guid.NewGuid().ToByteArray()}, {"modified", DateTime.UtcNow}, {"id", 1}, {"entityName", "test"} }, new byte[512] ); tableStorage.Commit(); tableStorage.BeginTransaction(); tableStorage.Documents.Remove(new JObject { { "key", "1" } }); tableStorage.Commit(); tableStorage.Compact(); var remoteManagedStorageState = memoryPersistentSource.CreateRemoteAppDomainState(); new TableStorage(new MemoryPersistentSource(remoteManagedStorageState.Log)).Initialze(); }
public void CanOpenAfterCompaction() { var memoryPersistentSource = new MemoryPersistentSource(); var tableStorage = new TableStorage(memoryPersistentSource); tableStorage.Initialize(); tableStorage.BeginTransaction(); tableStorage.Documents.Put(new RavenJObject { { "key", "1" }, { "etag", Guid.NewGuid().ToByteArray() }, { "modified", SystemTime.UtcNow }, { "id", 1 }, { "entityName", "test" } }, new byte[512]); tableStorage.Documents.Put(new RavenJObject { { "key", "2" }, { "etag", Guid.NewGuid().ToByteArray() }, { "modified", SystemTime.UtcNow }, { "id", 1 }, { "entityName", "test" } }, new byte[512]); tableStorage.Commit(); tableStorage.BeginTransaction(); tableStorage.Documents.Remove(new RavenJObject { { "key", "1" } }); tableStorage.Commit(); tableStorage.Compact(); var remoteManagedStorageState = memoryPersistentSource.CreateRemoteAppDomainState(); new TableStorage(new MemoryPersistentSource(remoteManagedStorageState.Log)).Initialize(); }