public void TestCleanup() { target.Dispose(); target = null; _dataStorage.Dispose(); _dataStorage = null; }
public JellyDatabase(string connectionString) { _dataStorage = new IoFileManager(connectionString); _dataStorage.Initialise(); _addressSpaceManager = new AddressSpaceManager(_dataStorage); var addressSpaceIndexAgent = _addressSpaceManager.CreateVirtualAddressSpaceAgent(AddressSpaceIndex.IndexRootId); _addressSpaceIndex = new AddressSpaceIndex(addressSpaceIndexAgent); foreach (var metaData in _addressSpaceIndex.MetaData) { var database = IntialiseDatabase(metaData.KeyType, metaData.IndexId, metaData.DataId); _databases[metaData.DatabaseName] = database; } }
public void CreateBigFileTest() { Stopwatch sw = new Stopwatch(); byte[] data = CreateTestByteArray((1024 * 1024), 5); using (target = new AddressSpaceManager(_dataStorage)) { Guid id1 = Guid.NewGuid(); var agent1 = target.CreateVirtualAddressSpaceAgent(id1); sw.Start(); agent1.WriteData(ref data, 0, 0, data.Length); sw.Stop(); } }
public void FileBasedPersistence_SaveAndGetContiguousData() { using (target = new AddressSpaceManager(_dataStorage)) { var id1 = Guid.NewGuid(); var agent = target.CreateVirtualAddressSpaceAgent(id1); byte[] data = CreateTestByteArray(8, 1024); agent.WriteData(ref data, 0, 0, (8 * 1024)); byte[] retrieved = new byte[data.Length]; agent.ReadData(ref retrieved, 0, 0, retrieved.Length); for (int i = 0; i < data.Length; i++) { Assert.AreEqual(data[i], retrieved[i]); } } }
private void InitialiseFileBasedDatabase() { _dataStorage = new IoFileManager(_hostingConfig.ConnectionString); _dataStorage.Initialise(); var dataManager = new AddressSpaceManager(_dataStorage); var addressSpaceIndexAgent = dataManager.CreateVirtualAddressSpaceAgent(AddressSpaceIndex.IndexRootId); _addressSpaceIndex = new AddressSpaceIndex(addressSpaceIndexAgent); foreach (var metaData in _addressSpaceIndex.MetaData) { //var indexAgent = dataManager.CreateVirtualAddressSpaceAgent(metaData.IndexId); //var index = new Index(indexAgent); //var dataAgent = dataManager.CreateVirtualAddressSpaceAgent(metaData.DataId); //var database = new Database(index, dataAgent); //_databases[metaData.DatabaseName] = database; } }
public void FileBasedPersistence_SaveAndGetScatteredData() { using (target = new AddressSpaceManager(_dataStorage)) { Guid id1 = Guid.NewGuid(); Guid id2 = Guid.NewGuid(); var agent1 = target.CreateVirtualAddressSpaceAgent(id1); var agent2 = target.CreateVirtualAddressSpaceAgent(id2); byte[] data = CreateTestByteArray(8, 100); agent1.WriteData(ref data, 0, 0, 100); agent2.WriteData(ref data, 100, 0, 100); agent1.WriteData(ref data, 200, 100, 100); agent2.WriteData(ref data, 300, 100, 100); agent1.WriteData(ref data, 400, 200, 100); agent2.WriteData(ref data, 500, 200, 100); agent1.WriteData(ref data, 600, 300, 100); agent2.WriteData(ref data, 700, 300, 100); //agent1.SetData(id1, 0, 0, 100, data); //agent2.SetData(id2, 0, 100, 100, data); //agent1.SetData(id1, 100, 200, 100, data); //agent2.SetData(id2, 100, 300, 100, data); //agent1.SetData(id1, 200, 400, 100, data); //agent2.SetData(id2, 200, 500, 100, data); //agent1.SetData(id1, 300, 600, 100, data); //agent2.SetData(id2, 300, 700, 100, data); byte[] retrieved = new byte[4096]; agent1.ReadData(ref retrieved, 0, 0, 4096); int count = -2; for (int i = 0; i < retrieved.Length; i++) { if (i < 400) { if (i % 100 == 0) { count += 2; } Assert.AreEqual(count, retrieved[i]); } else { Assert.AreEqual(0, retrieved[i]); } } } }
public void FileBasedPersitence_SaveMultipleAddressSpacesWithOneFullOfdata() { using (target = new AddressSpaceManager(_dataStorage)) { Guid id1 = Guid.NewGuid(); Guid id2 = Guid.NewGuid(); var agent1 = target.CreateVirtualAddressSpaceAgent(id1); var agent2 = target.CreateVirtualAddressSpaceAgent(id2); byte[] data = CreateTestByteArray(8, 100); agent1.WriteData(ref data, 0, 0, data.Length); var retrieved = new byte[data.Length]; agent1.ReadData(ref retrieved, 0, 0, retrieved.Length); for (int i = 0; i < data.Length; i++) { Assert.AreEqual(data[i], retrieved[i]); } } }
public void FileBasedPersistence_CreateFilePersistence() { using (target = new AddressSpaceManager(_dataStorage)) { } }