Beispiel #1
0
 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();
         }
 }
Beispiel #2
0
        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();
        }