public FrozenObjectInfo(Transaction trans, ObjectReference @ref, bool committed) : this(@ref, IsInstantiatedReference(@ref) ? @ref.VirtualAttributes(trans, committed ) : null) { }
private void Hc_init() { _hcPreceding = null; _hcSubsequent = null; _hcSize = 1; _hcHashcode = Hc_getCode(GetObject()); }
public virtual Db4objects.Db4o.Internal.ObjectReference Hc_remove(Db4objects.Db4o.Internal.ObjectReference findRef) { if (this == findRef) { return(Hc_remove()); } int cmp = Hc_compare(findRef); if (cmp <= 0) { if (_hcPreceding != null) { _hcPreceding = _hcPreceding.Hc_remove(findRef); } } if (cmp >= 0) { if (_hcSubsequent != null) { _hcSubsequent = _hcSubsequent.Hc_remove(findRef); } } Hc_calculateSize(); return(this); }
internal virtual void Analyze(Transaction trans) { _ref = trans.ReferenceForObject(_obj); if (_ref != null) { _classMetadata = _ref.ClassMetadata(); return; } IReflectClass claxx = _container.Reflector().ForObject(_obj); if (claxx == null) { NotStorable(_obj, claxx); return; } if (!DetectClassMetadata(trans, claxx)) { return; } if (IsValueType(_classMetadata)) { NotStorable(_obj, _classMetadata.ClassReflector(), " Value types can only be stored embedded in parent objects." ); } }
public virtual Db4objects.Db4o.Internal.ObjectReference Id_remove(Db4objects.Db4o.Internal.ObjectReference @ref) { int cmp = @ref._id - _id; if (cmp < 0) { if (_idPreceding != null) { _idPreceding = _idPreceding.Id_remove(@ref); } } else { if (cmp > 0) { if (_idSubsequent != null) { _idSubsequent = _idSubsequent.Id_remove(@ref); } } else { if (this == @ref) { return(Id_remove()); } return(this); } } Id_calculateSize(); return(this); }
private FrozenObjectInfo(ObjectReference @ref, VirtualAttributes virtualAttributes ) : this(@ref == null ? null : @ref.GetObject(), @ref == null ? -1 : @ref.GetID( ), virtualAttributes == null ? null : virtualAttributes.i_database, virtualAttributes == null ? -1 : virtualAttributes.i_uuid, virtualAttributes == null ? 0 : virtualAttributes .i_version) { }
public UnmarshallingContext(Transaction transaction, ByteArrayBuffer buffer, ObjectReference @ref, int addToIDTree, bool checkIDTree) : base(transaction, buffer, null, @ref ) { _addToIDTree = addToIDTree; _checkIDTree = checkIDTree; }
// do nothing private void HashCodeAdd(ObjectReference @ref) { if (_hashCodeTree == null) { _hashCodeTree = @ref; return; } _hashCodeTree = _hashCodeTree.Hc_add(@ref); }
private Db4objects.Db4o.Internal.ObjectReference Hc_rotateSmallestUp() { if (_hcPreceding != null) { _hcPreceding = _hcPreceding.Hc_rotateSmallestUp(); return(Hc_rotateRight()); } return(this); }
private Db4objects.Db4o.Internal.ObjectReference Id_rotateSmallestUp() { if (_idPreceding != null) { _idPreceding = _idPreceding.Id_rotateSmallestUp(); return(Id_rotateRight()); } return(this); }
/// <summary>HCTREE</summary> public virtual Db4objects.Db4o.Internal.ObjectReference Hc_add(Db4objects.Db4o.Internal.ObjectReference newRef) { if (newRef.GetObject() == null) { return(this); } newRef.Hc_init(); return(Hc_add1(newRef)); }
public override bool Delete(ObjectReference @ref, int id, int cascade) { if (!base.Delete(@ref, id, cascade)) { return false; } MsgD msg = Msg.TaDelete.GetWriterForInts(this, new int[] { id, cascade }); _client.WriteBatchedMessage(msg); return true; }
private int Hc_compare(Db4objects.Db4o.Internal.ObjectReference toRef) { int cmp = toRef._hcHashcode - _hcHashcode; if (cmp == 0) { cmp = toRef._id - _id; } return(cmp); }
private static object[] CreateReferences() { object[] references = new object[Ids.Length]; for (int i = 0; i < Ids.Length; i++) { ObjectReference @ref = new ObjectReference(Ids[i]); @ref.SetObject(Ids[i].ToString()); references[i] = @ref; } return references; }
public override void RemoveReference(ObjectReference @ref) { if (_newReferences.ReferenceForId(@ref.GetID()) != null) { _newReferences.RemoveReference(@ref); ReferenceCountChanged(-1); } if (_committedReferences.ReferenceForId(@ref.GetID()) != null) { _committedReferences.RemoveReference(@ref); ReferenceCountChanged(-1); } }
private void IdAdd(ObjectReference @ref) { if (DTrace.enabled) { DTrace.IdTreeAdd.Log(@ref.GetID()); } if (_idTree == null) { _idTree = @ref; return; } _idTree = _idTree.Id_add(@ref); }
public MarshallingContext(Db4objects.Db4o.Internal.Transaction trans, ObjectReference @ref, IUpdateDepth updateDepth, bool isNew) { // YapClass ID // Marshaller Version // number of fields _transaction = trans; _reference = @ref; _nullBitMap = new BitMap4(AspectCount()); _updateDepth = ClassMetadata().AdjustUpdateDepth(trans, updateDepth); _isNew = isNew; _writeBuffer = new MarshallingBuffer(); _currentBuffer = _writeBuffer; }
public virtual int PrefetchObjects(ClientObjectContainer container, Transaction trans , IIntIterator4 ids, object[] prefetched, int prefetchCount) { int count = 0; IList idsToGet = new ArrayList(); while (count < prefetchCount) { if (!ids.MoveNext()) { break; } int id = ids.CurrentInt(); if (id > 0) { object obj = trans.ObjectForIdFromCache(id); if (obj != null) { prefetched[count] = obj; } else { idsToGet.Add(Pair.Of(id, count)); } count++; } } if (idsToGet.Count > 0) { ByteArrayBuffer[] buffers = container.ReadObjectSlots(trans, IdArrayFor(idsToGet) ); for (int i = 0; i < buffers.Length; i++) { Pair pair = ((Pair)idsToGet[i]); int id = (((int)pair.first)); int position = (((int)pair.second)); object obj = trans.ObjectForIdFromCache(id); if (obj != null) { prefetched[position] = obj; } else { prefetched[position] = new ObjectReference(id).ReadPrefetch(trans, buffers[i], Const4 .AddToIdTree); } } } return count; }
private Db4objects.Db4o.Internal.ObjectReference Id_remove() { if (_idSubsequent != null && _idPreceding != null) { _idSubsequent = _idSubsequent.Id_rotateSmallestUp(); _idSubsequent._idPreceding = _idPreceding; _idSubsequent.Id_calculateSize(); return(_idSubsequent); } if (_idSubsequent != null) { return(_idSubsequent); } return(_idPreceding); }
private Db4objects.Db4o.Internal.ObjectReference Hc_remove() { if (_hcSubsequent != null && _hcPreceding != null) { _hcSubsequent = _hcSubsequent.Hc_rotateSmallestUp(); _hcSubsequent._hcPreceding = _hcPreceding; _hcSubsequent.Hc_calculateSize(); return(_hcSubsequent); } if (_hcSubsequent != null) { return(_hcSubsequent); } return(_hcPreceding); }
private Db4objects.Db4o.Internal.ObjectReference Id_rotateLeft() { Db4objects.Db4o.Internal.ObjectReference tree = _idSubsequent; _idSubsequent = tree._idPreceding; Id_calculateSize(); tree._idPreceding = this; if (tree._idSubsequent == null) { tree._idSize = _idSize + 1; } else { tree._idSize = _idSize + 1 + tree._idSubsequent._idSize; } return(tree); }
private Db4objects.Db4o.Internal.ObjectReference Hc_rotateRight() { Db4objects.Db4o.Internal.ObjectReference tree = _hcPreceding; _hcPreceding = tree._hcSubsequent; Hc_calculateSize(); tree._hcSubsequent = this; if (tree._hcPreceding == null) { tree._hcSize = 1 + _hcSize; } else { tree._hcSize = 1 + _hcSize + tree._hcPreceding._hcSize; } return(tree); }
internal override void Marshall(Transaction trans, ObjectReference @ref, IWriteBuffer buffer, bool isMigrating, bool isNew) { VirtualAttributes attr = @ref.VirtualAttributes(); if (!isMigrating) { attr.i_version = trans.Container().GenerateTimeStampId(); } if (attr == null) { buffer.WriteLong(0); } else { buffer.WriteLong(attr.i_version); } }
private Db4objects.Db4o.Internal.ObjectReference Id_add1(Db4objects.Db4o.Internal.ObjectReference newRef) { int cmp = newRef._id - _id; if (cmp < 0) { if (_idPreceding == null) { _idPreceding = newRef; _idSize++; } else { _idPreceding = _idPreceding.Id_add1(newRef); if (_idSubsequent == null) { return(Id_rotateRight()); } return(Id_balance()); } } else { if (cmp > 0) { if (_idSubsequent == null) { _idSubsequent = newRef; _idSize++; } else { _idSubsequent = _idSubsequent.Id_add1(newRef); if (_idPreceding == null) { return(Id_rotateLeft()); } return(Id_balance()); } } } return(this); }
private Db4objects.Db4o.Internal.ObjectReference Hc_find(int id, object obj) { int cmp = id - _hcHashcode; if (cmp < 0) { if (_hcPreceding != null) { return(_hcPreceding.Hc_find(id, obj)); } } else { if (cmp > 0) { if (_hcSubsequent != null) { return(_hcSubsequent.Hc_find(id, obj)); } } else { if (obj == GetObject()) { return(this); } if (_hcPreceding != null) { Db4objects.Db4o.Internal.ObjectReference inPreceding = _hcPreceding.Hc_find(id, obj ); if (inPreceding != null) { return(inPreceding); } } if (_hcSubsequent != null) { return(_hcSubsequent.Hc_find(id, obj)); } } } return(null); }
private object WriteAndRead(object obj) { var imaginativeID = 500; var @ref = new ObjectReference(ClassMetadataForObject(obj), imaginativeID ); @ref.SetObject(obj); var marshallingContext = new MarshallingContext(Trans(), @ref, Container ().UpdateDepthProvider().ForDepth(int.MaxValue), true); Handlers4.Write(@ref.ClassMetadata().TypeHandler(), marshallingContext, obj); var pointer = marshallingContext.AllocateSlot(); var buffer = marshallingContext.ToWriteBuffer(pointer); buffer.Seek(0); // String str = new String(buffer._buffer); // System.out.println(str); var unmarshallingContext = new UnmarshallingContext(Trans(), @ref , Const4.AddToIdTree, false); unmarshallingContext.Buffer(buffer); unmarshallingContext.ActivationDepth(new LegacyActivationDepth(5)); return unmarshallingContext.Read(); }
private Db4objects.Db4o.Internal.ObjectReference Hc_add1(Db4objects.Db4o.Internal.ObjectReference newRef) { int cmp = Hc_compare(newRef); if (cmp < 0) { if (_hcPreceding == null) { _hcPreceding = newRef; _hcSize++; } else { _hcPreceding = _hcPreceding.Hc_add1(newRef); if (_hcSubsequent == null) { return(Hc_rotateRight()); } return(Hc_balance()); } } else { if (_hcSubsequent == null) { _hcSubsequent = newRef; _hcSize++; } else { _hcSubsequent = _hcSubsequent.Hc_add1(newRef); if (_hcPreceding == null) { return(Hc_rotateLeft()); } return(Hc_balance()); } } return(this); }
internal virtual void Analyze(Transaction trans) { _ref = trans.ReferenceForObject(_obj); if (_ref != null) { _classMetadata = _ref.ClassMetadata(); return; } IReflectClass claxx = _container.Reflector().ForObject(_obj); if (claxx == null) { NotStorable(_obj, claxx); return; } if (!DetectClassMetadata(trans, claxx)) { return; } if (IsValueType(_classMetadata)) { NotStorable(_obj, _classMetadata.ClassReflector()); } }
private bool DetectClassMetadata(Transaction trans, IReflectClass claxx) { _classMetadata = _container.GetActiveClassMetadata(claxx); if (_classMetadata != null) { if (!_classMetadata.IsStorable()) { NotStorable(_obj, claxx); return(false); } return(true); } _classMetadata = _container.ProduceClassMetadata(claxx); if (_classMetadata == null || !_classMetadata.IsStorable()) { NotStorable(_obj, claxx); return(false); } // The following may return a reference if the object is held // in a static variable somewhere ( often: Enums) that gets // stored or associated on initialization of the ClassMetadata. _ref = trans.ReferenceForObject(_obj); return(true); }
private bool DetectClassMetadata(Transaction trans, IReflectClass claxx) { _classMetadata = _container.GetActiveClassMetadata(claxx); if (_classMetadata != null) { if (!_classMetadata.IsStorable()) { NotStorable(_obj, claxx); return false; } return true; } _classMetadata = _container.ProduceClassMetadata(claxx); if (_classMetadata == null || !_classMetadata.IsStorable()) { NotStorable(_obj, claxx); return false; } // The following may return a reference if the object is held // in a static variable somewhere ( often: Enums) that gets // stored or associated on initialization of the ClassMetadata. _ref = trans.ReferenceForObject(_obj); return true; }
private UnmarshallingContext DescendMarshallingContext(Transaction trans, ObjectReference @ref) { UnmarshallingContext context = new UnmarshallingContext(trans, @ref, Const4.AddToIdTree , false); context.ActivationDepth(ActivationDepthProvider().ActivationDepth(1, ActivationMode .Activate)); return context; }
public _IReferenceSource_33(ObjectReference reference) { this.reference = reference; }
private void ActivateForDeletionCallback(Transaction trans, ClassMetadata classMetadata , ObjectReference @ref, object obj) { if ([email protected]() && (CaresAboutDeleting(classMetadata) || CaresAboutDeleted(classMetadata ))) { // Activate Objects for Callbacks, because in C/S mode Objects are not activated on the Server // FIXME: [TA] review activation depth IActivationDepth depth = classMetadata.AdjustCollectionDepthToBorders(new FixedActivationDepth (1)); Activate(trans, obj, depth); } }
public abstract bool Delete4(Transaction ta, ObjectReference @ref, object obj, int a_cascade, bool userCall);
internal void Delete3(Transaction trans, ObjectReference @ref, object obj, int cascade , bool userCall) { // The passed reference can be null, when calling from Transaction. if (@ref == null || [email protected]()) { return; } // This check is performed twice, here and in delete2, intentionally. if (BreakDeleteForEnum(@ref, userCall)) { @ref.EndProcessing(); return; } if ([email protected]()) { @ref.EndProcessing(); return; } ClassMetadata yc = @ref.ClassMetadata(); // We have to end processing temporarily here, otherwise the can delete callback // can't do anything at all with this object. @ref.EndProcessing(); ActivateForDeletionCallback(trans, yc, @ref, obj); if (!ObjectCanDelete(trans, yc, @ref)) { return; } @ref.BeginProcessing(); if (DTrace.enabled) { DTrace.Delete.Log(@ref.GetID()); } if (Delete4(trans, @ref, obj, cascade, userCall)) { ObjectOnDelete(trans, yc, @ref); if (ConfigImpl.MessageLevel() > Const4.State) { Message(string.Empty + @ref.GetID() + " delete " + @ref.ClassMetadata().GetName() ); } } @ref.EndProcessing(); }
public HardObjectReference(ObjectReference @ref, object obj) { _reference = @ref; _object = obj; }
private void AssertReference(int id, ReferenceSystemTestCaseBase.Data data, ObjectReference @ref) { Assert.AreSame(@ref, _refSys.ReferenceForId(id)); Assert.AreSame(@ref, _refSys.ReferenceForObject(data)); }
/// <summary>IDTREE</summary> public virtual ObjectReference Id_add(ObjectReference newRef) { newRef.Id_init(); return(Id_add1(newRef)); }
public override void AddExistingReference(ObjectReference @ref) { _committedReferences.AddExistingReference(@ref); ReferenceCountChanged(1); }
private bool IsStruct(ObjectReference @ref) { return(@ref.ClassMetadata().IsStruct()); }
public DeleteInfo(int id, ObjectReference reference, int cascade) : base(id) { _reference = reference; _cascade = cascade; }
internal abstract void Marshall(Transaction trans, ObjectReference @ref, IWriteBuffer buffer, bool migrating, bool isNew);
private void Marshall(Transaction trans, ObjectReference @ref, IWriteBuffer buffer , bool isNew) { if (!trans.SupportsVirtualFields()) { MarshallIgnore(buffer); return; } ObjectContainerBase stream = trans.Container(); HandlerRegistry handlers = stream._handlers; bool migrating = false; if (stream._replicationCallState == Const4.New) { IDb4oReplicationReferenceProvider provider = handlers._replicationReferenceProvider; object parentObject = @ref.GetObject(); IDb4oReplicationReference replicationReference = provider.ReferenceFor(parentObject ); if (replicationReference != null) { migrating = true; VirtualAttributes va = @ref.ProduceVirtualAttributes(); va.i_version = replicationReference.Version(); va.i_uuid = replicationReference.LongPart(); va.i_database = replicationReference.SignaturePart(); } } if (@ref.VirtualAttributes() == null) { @ref.ProduceVirtualAttributes(); migrating = false; } Marshall(trans, @ref, buffer, migrating, isNew); }
public virtual object NewWeakReference(ObjectReference referent, object obj) { return Platform4.CreateActiveObjectReference(_queue, referent, obj); }
internal override void Marshall(Transaction trans, ObjectReference @ref, IWriteBuffer buffer, bool isMigrating, bool isNew) { }
private ObjectReference CreateRef(int id, ReferenceSystemTestCaseBase.Data data) { ObjectReference @ref = new ObjectReference(id); @ref.SetObject(data); return @ref; }
private static bool IsInstantiatedReference(ObjectReference @ref) { return(@ref != null && @ref.GetObject() != null); }
public override void AddNewReference(ObjectReference @ref) { _newReferences.AddNewReference(@ref); ReferenceCountChanged(1); }
public ObjectReferenceContext(Transaction transaction, IReadBuffer buffer, ObjectHeader objectHeader, Db4objects.Db4o.Internal.ObjectReference reference) : base(transaction , buffer, objectHeader) { _reference = reference; }
public object NewWeakReference(ObjectReference referent, object obj) { return obj; }
public virtual void AddNewReference(ObjectReference @ref) { ReferenceSystem().AddNewReference(@ref); }
public virtual void RemoveReference(ObjectReference reference) { RemoveReference(new _IReferenceSource_33(reference)); }
/// <summary>IDTREE</summary> public virtual Db4objects.Db4o.Internal.ObjectReference Id_add(Db4objects.Db4o.Internal.ObjectReference newRef) { newRef.Id_init(); return(Id_add1(newRef)); }
public sealed override bool Delete4(Transaction ta, ObjectReference yo, object obj , int a_cascade, bool userCall) { MsgD msg = Msg.Delete.GetWriterForInts(_transaction, new int[] { yo.GetID(), userCall ? 1 : 0 }); WriteBatchedMessage(msg); return true; }
private void Id_init() { _idPreceding = null; _idSubsequent = null; _idSize = 1; }
private ObjectReference NewObjectReference() { ObjectReference @ref = new ObjectReference(TestId); @ref.SetObject(new object()); return @ref; }
public virtual void SetObjectReference(ObjectReference objectReference) { }