public ObjectInfoHeader() : base()
		{
			this.position = -1;
			this.oid = null;
			this.objectVersion = 1;
			this.creationDate = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
		}
		public PendingReading(int id, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci, 
			NeoDatis.Odb.OID attributeOID) : base()
		{
			this.id = id;
			this.ci = ci;
			this.attributeOID = attributeOID;
		}
		public CIZoneInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci, NeoDatis.Odb.OID
			 first, NeoDatis.Odb.OID last, long nbObjects) : base()
		{
			this.first = first;
			this.last = last;
			this.nbObjects = nbObjects;
			this.ci = ci;
		}
		public InsertHistoryInfo(string type, NeoDatis.Odb.OID oid, long position, NeoDatis.Odb.OID
			 prev, NeoDatis.Odb.OID next) : base()
		{
			this.type = type;
			this.position = position;
			this.oid = oid;
			this.next = next;
			this.prev = prev;
		}
		public StoreMessageResponse(string baseId, string connectionId, NeoDatis.Odb.OID 
			oid, bool newObject, NeoDatis.Odb.OID[] clientIds, NeoDatis.Odb.OID[] serverIds)
			 : base(NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Command.Store, baseId, connectionId
			)
		{
			this.oid = oid;
			this.newObject = newObject;
			this.clientIds = clientIds;
			this.serverIds = serverIds;
		}
		public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
			 values)
		{
			System.Decimal n = (System.Decimal)values[attributeName];
			System.Decimal bd = NeoDatis.Odb.Impl.Core.Query.Values.ValuesUtil.Convert(n);
			if (minValue.CompareTo(bd) > 0)
			{
				oidOfMinValues = oid;
				minValue = bd;
			}
		}
		public FullIDInfo(long id, long position, byte idStatus, long blockId, string objectClassName
			, string objectToString, NeoDatis.Odb.OID prevOID, NeoDatis.Odb.OID nextOID)
		{
			this.id = id;
			this.position = position;
			this.blockId = blockId;
			this.objectClassName = objectClassName;
			this.objectToString = objectToString;
			this.idStatus = idStatus;
			this.prevOID = prevOID;
			this.nextOID = nextOID;
		}
		public ObjectInfoHeader(long position, NeoDatis.Odb.OID previousObjectOID, NeoDatis.Odb.OID
			 nextObjectOID, NeoDatis.Odb.OID classInfoId, long[] attributesIdentification, int
			[] attributeIds)
		{
			this.position = position;
			this.oid = null;
			this.previousObjectOID = previousObjectOID;
			this.nextObjectOID = nextObjectOID;
			this.classInfoId = classInfoId;
			this.attributesIdentification = attributesIdentification;
			this.attributeIds = attributeIds;
			this.objectVersion = 1;
			this.creationDate = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
		}
		/// <exception cref="System.Exception"></exception>
		public virtual void T1estC1()
		{
			test.DeleteBase("acid1");
			NeoDatis.Odb.ODB odb = test.Open("acid1");
			int size = 1;
			NeoDatis.Odb.OID[] oids = new NeoDatis.Odb.OID[size];
			for (int i = 0; i < size; i++)
			{
				oids[i] = odb.Store(GetInstance("f" + i));
			}
			for (int i = 0; i < size; i++)
			{
				odb.DeleteObjectWithId(oids[i]);
			}
		}
		public override void SetParent(NeoDatis.Btree.IBTreeNode node)
		{
			parent = node;
			if (parent != null)
			{
				if (parent.GetId() == null)
				{
					btree.GetPersister().SaveNode(parent);
				}
				parentOid = (NeoDatis.Odb.OID)parent.GetId();
			}
			else
			{
				parentOid = null;
			}
		}
		/// <param name="objectWriter">The object writer</param>
		/// <param name="objectReader">The object reader</param>
		/// <param name="currentBlockIdPosition">The position of the current block</param>
		/// <param name="currentBlockIdNumber">The number of the current block</param>
		/// <param name="currentMaxId">Maximum Database id</param>
		public DefaultIdManager(NeoDatis.Odb.Core.Layers.Layer3.IObjectWriter objectWriter
			, NeoDatis.Odb.Core.Layers.Layer3.IObjectReader objectReader, long currentBlockIdPosition
			, int currentBlockIdNumber, NeoDatis.Odb.OID currentMaxId)
		{
			this.provider = NeoDatis.Odb.OdbConfiguration.GetCoreProvider();
			this.objectWriter = objectWriter;
			this.objectReader = objectReader;
			this.session = objectWriter.GetSession();
			this.currentBlockIdPosition = currentBlockIdPosition;
			this.currentBlockIdNumber = currentBlockIdNumber;
			this.maxId = provider.GetObjectOID((long)currentBlockIdNumber * NeoDatis.Odb.OdbConfiguration
				.GetNB_IDS_PER_BLOCK(), 0);
			this.nextId = provider.GetObjectOID(currentMaxId.GetObjectId() + 1, 0);
			lastIds = new NeoDatis.Odb.OID[IdBufferSize];
			for (int i = 0; i < IdBufferSize; i++)
			{
				lastIds[i] = NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant.NullObjectId;
			}
			lastIdPositions = new long[IdBufferSize];
			lastIdIndex = 0;
		}
		public override void Ready()
		{
			if (!objectIsNative)
			{
				if (GetQuery() == null)
				{
					throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.ContainsQueryWithNoQuery
						);
				}
				NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = GetQuery().GetStorageEngine
					();
				if (engine == null)
				{
					throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.ContainsQueryWithNoStorageEngine
						);
				}
				// For non native object, we just need the oid of it
				oid = engine.GetObjectId(criterionValue, false);
				this.criterionValue = null;
			}
		}
		public virtual void SetClassInfoId(NeoDatis.Odb.OID classInfoId)
		{
			this.classInfoId = classInfoId;
		}
		public virtual void SetPreviousObjectOID(NeoDatis.Odb.OID previousObjectOID)
		{
			this.previousObjectOID = previousObjectOID;
		}
Beispiel #15
0
        public virtual void Test7()
		{
			DeleteBase("getid.neodatis");
			int size = isLocal ? 10001 : 1000;
			NeoDatis.Odb.ODB odb = Open("getid.neodatis");
			NeoDatis.Odb.OID[] oids = new NeoDatis.Odb.OID[size];
			for (int i = 0; i < size; i++)
			{
				oids[i] = odb.Store(GetInstance(i));
			}
			odb.Close();
			odb = Open("getid.neodatis");
			long t1 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			for (int i = 0; i < size; i++)
			{
				NeoDatis.Odb.Test.VO.Login.User u = (NeoDatis.Odb.Test.VO.Login.User)odb.GetObjectFromId
					(oids[i]);
				AssertEquals("kiko" + i, u.GetName());
			}
			long t2 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			odb.Close();
			DeleteBase("getid.neodatis");
			long time = t2 - t1;
			double timeForEachGet = (double)time / (double)size;
			double acceptableTime = isLocal ? 0.086 : 1.6;
			// 0.1561843815618438
			Println("time for each get = " + timeForEachGet + " - Total time for " + size + " objects = "
				 + time);
			if (testPerformance && timeForEachGet > acceptableTime)
			{
				// ms
				Println("time for each get = " + timeForEachGet + " - Total time for " + size + " objects = "
					 + time);
				Fail("Getting " + size + " complex objects by oid lasted more than " + acceptableTime
					 + "ms : " + timeForEachGet);
			}
		}
Beispiel #16
0
        public virtual void Test6()
		{
			DeleteBase("getid.neodatis");
			int size = isLocal ? 20001 : 2001;
			NeoDatis.Odb.ODB odb = Open("getid.neodatis");
			NeoDatis.Odb.OID[] oids = new NeoDatis.Odb.OID[size];
			for (int i = 0; i < size; i++)
			{
				oids[i] = odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("function " + i));
			}
			odb.Close();
			odb = Open("getid.neodatis");
			long t1 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			for (int i = 0; i < size; i++)
			{
				NeoDatis.Odb.Test.VO.Login.Function f = (NeoDatis.Odb.Test.VO.Login.Function)odb.
					GetObjectFromId(oids[i]);
				AssertEquals("function " + i, f.GetName());
				if (i % 3000 == 0)
				{
					Println(i + "/" + size);
				}
			}
			long t2 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			odb.Close();
			DeleteBase("getid.neodatis");
			long time = t2 - t1;
			double timeForEachGet = (double)time / (double)size;
			double acceptableTime = isLocal ? 0.022 : 0.5;
			// 0.04294785260736963
			Println("time for each get = " + time + "/" + size + " = " + timeForEachGet);
			if (testPerformance && timeForEachGet > acceptableTime)
			{
				// ms
				Fail("Getting " + size + " simple objects by oid lasted more than " + acceptableTime
					 + "ms : " + timeForEachGet);
			}
		}
Beispiel #17
0
		public IdInfo(NeoDatis.Odb.OID oid, long position, byte status) : base()
		{
			this.oid = oid;
			this.position = position;
			this.status = status;
		}
		public virtual void SetId(NeoDatis.Odb.OID id)
		{
			this.id = id;
		}
		private long AssociateIdToObject(byte idType, byte idStatus, long objectPosition)
		{
			long idPosition = objectWriter.AssociateIdToObject(idType, idStatus, currentBlockIdPosition
				, nextId, objectPosition, false);
			nextId = provider.GetObjectOID(nextId.GetObjectId() + 1, 0);
			return idPosition;
		}
		public virtual void SetPreviousClassOID(NeoDatis.Odb.OID previousClassOID)
		{
			this.previousClassOID = previousClassOID;
		}
		public virtual void SetNextClassOID(NeoDatis.Odb.OID nextClassOID)
		{
			this.nextClassOID = nextClassOID;
		}
Beispiel #22
0
		public virtual void SetOidOfObjectToQuery(NeoDatis.Odb.OID oidOfObjectToQuery)
		{
			this.oidOfObjectToQuery = oidOfObjectToQuery;
		}
		public ObjectReference(NeoDatis.Odb.OID id) : base(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
			.NonNativeId)
		{
			this.id = id;
		}
Beispiel #24
0
		public virtual void SetOid(NeoDatis.Odb.OID oid)
		{
			this.oid = oid;
		}
		public ObjectReference(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi
			) : base(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NonNativeId)
		{
			this.id = null;
			this.nnoi = nnoi;
		}
Beispiel #26
0
		public ClassWithOid(string name, NeoDatis.Odb.OID oid) : base()
		{
			this.name = name;
			this.oid = oid;
		}
		public GetObjectHeaderFromIdMessage(string baseId, string connectionId, NeoDatis.Odb.OID
			 oid) : base(NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Command.GetObjectHeaderFromId
			, baseId, connectionId)
		{
			this.oid = oid;
		}
		private void ShiftBlock()
		{
			long currentBlockPosition = this.currentBlockIdPosition;
			// the block has reached the end, , must create a new id block
			long newBlockPosition = CreateNewBlock();
			// Mark the current block as full
			MarkBlockAsFull(currentBlockPosition, newBlockPosition);
			this.currentBlockIdNumber++;
			this.currentBlockIdPosition = newBlockPosition;
			this.maxId = provider.GetObjectOID((long)currentBlockIdNumber * NeoDatis.Odb.OdbConfiguration
				.GetNB_IDS_PER_BLOCK(), 0);
		}
		public ClassInfo()
		{
			this.original = new CommittedCIZoneInfo(this
				, null, null, 0);
			this.committed = new CommittedCIZoneInfo(this
				, null, null, 0);
			this.uncommitted = new CIZoneInfo(this, null
				, null, 0);
			this.previousClassOID = null;
			this.nextClassOID = null;
			this.blockSize = -1;
			this.position = -1;
			this.maxAttributeId = -1;
			this.classCategory = CategoryUserClass;
			this.history = new NeoDatis.Tool.Wrappers.List.OdbArrayList<object>();
		}
		public DeleteObjectMessageResponse(string baseId, string connectionId, NeoDatis.Odb.OID
			 oid) : base(NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Command.Store, baseId
			, connectionId)
		{
			this.oid = oid;
		}