示例#1
0
        private void RegisterAllocateIds()
        {
            TargetCaller <Master, IdAllocation> allocateIdTarget = (master, context, input, target) =>
            {
                IdType idType = IdType.values()[input.readByte()];
                return(master.allocateIds(context, idType));
            };
            ObjectSerializer <IdAllocation> allocateIdSerializer = (idAllocation, result) =>
            {
                IdRange idRange = idAllocation.IdRange;
                result.writeInt(idRange.DefragIds.length);
                foreach (long id in idRange.DefragIds)
                {
                    result.writeLong(id);
                }
                result.writeLong(idRange.RangeStart);
                result.writeInt(idRange.RangeLength);
                result.writeLong(idAllocation.HighestIdInUse);
                result.writeLong(idAllocation.DefragCount);
            };

            Register(HaRequestTypes_Type.AllocateIds, allocateIdTarget, allocateIdSerializer);
        }