Example #1
0
            public IObjectInfo Decode(ByteArrayInputStream @is)
            {
                long id = PrimitiveCodec.ReadLong(@is);

                if (id == -1)
                {
                    return(null);
                }
                return(new LazyObjectReference(this._enclosing.Transaction(), (int)id));
            }
Example #2
0
            public void Encode(ByteArrayOutputStream os, IObjectInfo info)
            {
                PrimitiveCodec.WriteLong(os, info.GetInternalID());
                long sourceDatabaseId = ((FrozenObjectInfo)info).SourceDatabaseId(this._enclosing
                                                                                  .Transaction());

                PrimitiveCodec.WriteLong(os, sourceDatabaseId);
                PrimitiveCodec.WriteLong(os, ((FrozenObjectInfo)info).UuidLongPart());
                PrimitiveCodec.WriteLong(os, info.GetCommitTimestamp());
            }
Example #3
0
        public virtual bool ProcessAtClient()
        {
            ByteArrayInputStream @is = new ByteArrayInputStream(_payLoad._buffer);
            int dispatcherID         = PrimitiveCodec.ReadInt(@is);
            CallbackObjectInfoCollections callbackInfos = Decode(@is);

            Container().ThreadPool().Start(ReflectPlatform.SimpleName(GetType()) + ": calling commit callbacks thread"
                                           , new _IRunnable_111(this, callbackInfos, dispatcherID));
            return(true);
        }
Example #4
0
        private void EncodeObjectInfoCollection(ByteArrayOutputStream os, IObjectInfoCollection
                                                collection, MCommittedInfo.IObjectInfoEncoder encoder)
        {
            IEnumerator iter = collection.GetEnumerator();

            while (iter.MoveNext())
            {
                IObjectInfo obj = (IObjectInfo)iter.Current;
                encoder.Encode(os, obj);
            }
            PrimitiveCodec.WriteLong(os, -1);
        }
Example #5
0
        public virtual MCommittedInfo Encode(CallbackObjectInfoCollections callbackInfo,
                                             int dispatcherID)
        {
            ByteArrayOutputStream os = new ByteArrayOutputStream();

            PrimitiveCodec.WriteInt(os, dispatcherID);
            byte[]         bytes         = EncodeInfo(callbackInfo, os);
            MCommittedInfo committedInfo = (MCommittedInfo)GetWriterForLength(Transaction(),
                                                                              bytes.Length + Const4.IntLength);

            committedInfo._payLoad.Append(bytes);
            return(committedInfo);
        }
Example #6
0
            public IObjectInfo Decode(ByteArrayInputStream @is)
            {
                long id = PrimitiveCodec.ReadLong(@is);

                if (id == -1)
                {
                    return(null);
                }
                long         sourceDatabaseId = PrimitiveCodec.ReadLong(@is);
                Db4oDatabase sourceDatabase   = null;

                if (sourceDatabaseId > 0)
                {
                    sourceDatabase = (Db4oDatabase)this._enclosing.Container().GetByID(this._enclosing
                                                                                       .Transaction(), sourceDatabaseId);
                }
                long uuidLongPart = PrimitiveCodec.ReadLong(@is);
                long version      = PrimitiveCodec.ReadLong(@is);

                return(new FrozenObjectInfo(null, id, sourceDatabase, uuidLongPart, version));
            }
Example #7
0
 public void Encode(ByteArrayOutputStream os, IObjectInfo info)
 {
     PrimitiveCodec.WriteLong(os, info.GetInternalID());
 }
Example #8
0
 /// <exception cref="System.IO.IOException"></exception>
 protected virtual void WriteByteArray(ByteArrayOutputStream os, byte[] signaturePart
                                       )
 {
     PrimitiveCodec.WriteLong(os, signaturePart.Length);
     os.Write(signaturePart);
 }