public virtual void Put(Db4oDatabase db) { Db4oDatabase existing = (Db4oDatabase)_identities.Get(db.GetSignature()); if (existing == null) { _identities.Put(db.GetSignature(), db); } }
public FrozenObjectInfo(object @object, long id, Db4oDatabase sourceDatabase, long uuidLongPart, long commitTimestamp) { _sourceDatabase = sourceDatabase; _uuidLongPart = uuidLongPart; _id = id; _commitTimestamp = commitTimestamp; _object = @object; }
internal virtual Db4oDatabase Produce(byte[] signature, long creationTime) { Db4oDatabase db = (Db4oDatabase)_identities.Get(signature); if (db != null) { return db; } db = new Db4oDatabase(signature, creationTime); db.Bind(_stream.Transaction); _identities.Put(signature, db); return db; }
public Db4oReplicationReferenceImpl(object myObject, Db4oDatabase db, long longPart , long version) { SetObject(myObject); Ref_init(); Db4objects.Db4o.Internal.VirtualAttributes va = new Db4objects.Db4o.Internal.VirtualAttributes (); va.i_database = db; va.i_uuid = longPart; va.i_version = version; SetVirtualAttributes(va); }
public Db4oReplicationReferenceImpl(object obj, Db4oDatabase db, long longPart, long version) { if (obj == null) { throw new InvalidOperationException("obj may not be null"); } SetObject(obj); Ref_init(); Db4objects.Db4o.Internal.VirtualAttributes va = new Db4objects.Db4o.Internal.VirtualAttributes (); va.i_database = db; va.i_uuid = longPart; va.i_version = version; _version = version; SetVirtualAttributes(va); }
public override Db4oDatabase Identity() { if (i_db == null) { Write(Msg.Identity); ByteArrayBuffer reader = ExpectedBufferResponse(Msg.IdList); ShowInternalClasses(true); try { i_db = (Db4oDatabase)GetByID(SystemTransaction(), reader.ReadInt()); Activate(SystemTransaction(), i_db, new FixedActivationDepth(3)); } finally { ShowInternalClasses(false); } } return i_db; }
public ReplicationRecord(Db4oDatabase younger, Db4oDatabase older) { _youngerPeer = younger; _olderPeer = older; }
public static Db4objects.Drs.Db4o.ReplicationRecord QueryForReplicationRecord(ObjectContainerBase container, Transaction trans, Db4oDatabase younger, Db4oDatabase older) { container.ShowInternalClasses(true); try { IQuery q = container.Query(trans); q.Constrain(typeof(Db4objects.Drs.Db4o.ReplicationRecord)); q.Descend("_youngerPeer").Constrain(younger).Identity(); q.Descend("_olderPeer").Constrain(older).Identity(); IObjectSet objectSet = q.Execute(); if (objectSet.HasNext()) { Db4objects.Drs.Db4o.ReplicationRecord replicationRecord = (Db4objects.Drs.Db4o.ReplicationRecord )objectSet.Next(); container.Activate(replicationRecord, int.MaxValue); return replicationRecord; } return null; } finally { container.ShowInternalClasses(false); } }
public virtual bool IsOlderThan(Db4oDatabase peer) { if (peer == this) { throw new ArgumentException(); } if (i_uuid != peer.i_uuid) { return i_uuid < peer.i_uuid; } // the above logic has failed, both are the same // age but we still want to distinguish in some // way, to have an order in the ReplicationRecord // The following is arbitrary, it only needs to // be repeatable. // Let's distinguish by signature length if (i_signature.Length != peer.i_signature.Length) { return i_signature.Length < peer.i_signature.Length; } for (var i = 0; i < i_signature.Length; i++) { if (i_signature[i] != peer.i_signature[i]) { return i_signature[i] < peer.i_signature[i]; } } // This should never happen. // FIXME: Add a message and move to Messages. // throw new Exception(); }
public virtual void Identity(Db4oDatabase identityObject) { _identity = identityObject; }
public Db4oReplicationProviderSignature(Db4oDatabase delegate_) { _delegate = delegate_; }
public virtual void SetIdentity(Db4oDatabase identity) { lock (Lock()) { _systemData.Identity(identity); // The dirty TimeStampIdGenerator triggers writing of // the variable part of the systemdata. We need to // make it dirty here, so the new identity is persisted: _timeStampIdGenerator.Generate(); _fileHeader.WriteVariablePart(this); } }