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 Compact(InMemoryRavenConfiguration compactConfiguration) { using (var ps = new FileBasedPersistentSource(compactConfiguration.DataDirectory, "Raven", configuration.TransactionMode == TransactionMode.Safe)) using (var storage = new TableStorage(ps)) { storage.Compact(); } }