public virtual void TestSize() { DeleteBase("writing.neodatis"); DeleteBase("writing"); DeleteBase("reserving.neodatis"); DeleteBase("reserving"); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine1 = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (NeoDatis.Odb.Test.ODBTest.Directory + "writing.neodatis", true, null, null)); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine2 = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (NeoDatis.Odb.Test.ODBTest.Directory + "reserving.neodatis", true, null, null)); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface writingFsi = engine1. GetObjectWriter().GetFsi(); NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface reservingFsi = engine2 .GetObjectWriter().GetFsi(); AssertEquals(writingFsi.GetLength(), reservingFsi.GetLength()); Write(writingFsi, false); Write(reservingFsi, true); AssertEquals(writingFsi.GetLength(), reservingFsi.GetLength()); engine1.Commit(); engine1.Close(); engine2.Commit(); engine2.Close(); DeleteBase("writing.neodatis"); DeleteBase("reserving.neodatis"); }
public virtual void Test1() { if (!isLocal) { return; } DeleteBase(FileName); NeoDatis.Odb.Core.Layers.Layer3.IBaseIdentification parameter = new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (NeoDatis.Odb.Test.ODBTest.Directory + FileName, true, null, null); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(parameter); NeoDatis.Odb.Test.VO.Login.Function function1 = new NeoDatis.Odb.Test.VO.Login.Function ("login"); engine.Store(function1); NeoDatis.Odb.Test.VO.Login.Function function2 = new NeoDatis.Odb.Test.VO.Login.Function ("login2"); engine.Store(function2); engine.Commit(); engine.Close(); engine = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetClientStorageEngine(parameter ); System.Collections.Generic.IList <long> l = engine.GetAllObjectIds(); AssertEquals(2, l.Count); engine.Close(); DeleteBase(FileName); }
/// <exception cref="System.Exception"></exception> public virtual void Commit() { storageEngine.Commit(); NeoDatis.Odb.OID oid = null; // release update mutexes System.Collections.IEnumerator iterator = oidsLockedForUpdate.Keys.GetEnumerator( ); while (iterator.MoveNext()) { oid = (NeoDatis.Odb.OID)iterator.Current; connectionManager.UnlockOidForConnection(oid, this); if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Release object lock for " + oid); } } oidsLockedForUpdate.Clear(); }
public virtual void AddBase(string baseIdentifier, string fileName, string user, string password) { NeoDatis.Odb.Core.Server.Layers.Layer3.ServerFileParameter fileParameter = new NeoDatis.Odb.Core.Server.Layers.Layer3.ServerFileParameter (baseIdentifier, fileName, true); NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = null; engine = NeoDatis.Odb.OdbConfiguration.GetCoreProvider().GetServerStorageEngine(fileParameter , user, password); engine.Commit(); bases.Add(baseIdentifier, engine); connectionManagers.Add(baseIdentifier, new NeoDatis.Odb.Core.Server.Connection.ConnectionManager (engine)); if (NeoDatis.Odb.OdbConfiguration.IsInfoEnabled(LogId)) { NeoDatis.Tool.DLogger.Info("ODBServer:Adding base : name=" + baseIdentifier + " (file=" + fileName + ") to server"); } }
/// <exception cref="System.Exception"></exception> public virtual void Close() { Persist(); engine.Commit(); engine.Close(); }
public virtual void Commit() { storageEngine.Commit(); }
public virtual void DefragmentTo(string newFileName) { long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); long totalNbObjects = 0; NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine newStorage = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClientStorageEngine(new NeoDatis.Odb.Core.Layers.Layer3.IOFileParameter (newFileName, true, baseIdentification.GetUserName(), baseIdentification.GetPassword ())); NeoDatis.Odb.Objects <object> defragObjects = null; int j = 0; NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = null; // User classes System.Collections.IEnumerator iterator = GetMetaModel().GetUserClasses().GetEnumerator (); while (iterator.MoveNext()) { ci = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator.Current; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Reading " + ci.GetCommitedZoneInfo().GetNbObjects() + " objects of type " + ci.GetFullClassName()); } defragObjects = GetObjects <object>(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (ci.GetFullClassName()), true, -1, -1); while (defragObjects.HasNext()) { newStorage.Store(defragObjects.Next()); totalNbObjects++; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { if (j % 10000 == 0) { NeoDatis.Tool.DLogger.Info("\n" + totalNbObjects + " objects saved."); } } j++; } } // System classes iterator = GetMetaModel().GetSystemClasses().GetEnumerator(); while (iterator.MoveNext()) { ci = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator.Current; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Reading " + ci.GetCommitedZoneInfo().GetNbObjects() + " objects of type " + ci.GetFullClassName()); } defragObjects = GetObjects <object>(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (ci.GetFullClassName()), true, -1, -1); while (defragObjects.HasNext()) { newStorage.Store(defragObjects.Next()); totalNbObjects++; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { if (j % 10000 == 0) { NeoDatis.Tool.DLogger.Info("\n" + totalNbObjects + " objects saved."); } } j++; } } newStorage.Commit(); newStorage.Close(); long time = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs() - start; if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Info("New storage " + newFileName + " created with " + totalNbObjects + " objects in " + time + " ms."); } }