public ulong GetObjectOffset(ulong objectId)
 {
     var testTuple = new ObjectIdOffsetEntry(objectId, 0, 0, 0);
     var loc = _objectIdOffsetIndex.BinarySearch(testTuple);
     if (loc < 0)
     {
         throw new BrightstarInternalException("No offset for object id " + objectId);
     }
     return _objectIdOffsetIndex[loc].Offset;
 }
Пример #2
0
        public ulong GetObjectOffset(ulong objectId)
        {
            var testTuple = new ObjectIdOffsetEntry(objectId, 0, 0, 0);
            var loc       = _objectIdOffsetIndex.BinarySearch(testTuple);

            if (loc < 0)
            {
                throw new BrightstarInternalException("No offset for object id " + objectId);
            }
            return(_objectIdOffsetIndex[loc].Offset);
        }
Пример #3
0
        public void DeleteObjectOffset(ulong objectId)
        {
            var entry = new ObjectIdOffsetEntry(objectId, 0, 0, 0);
            var loc   = _objectIdOffsetIndex.BinarySearch(entry);

            if (loc < 0)
            {
                return;
            }
            _objectIdOffsetIndex.RemoveAt(loc);
            IsModified = true;
        }
Пример #4
0
        public void Read(BinaryReader dataStream)
        {
            var count = (int)SerializationUtils.ReadVarint(dataStream);

            for (int i = 0; i < count; i++)
            {
                var objectId = SerializationUtils.ReadVarint(dataStream);
                var offset   = SerializationUtils.ReadVarint(dataStream);
                var type     = SerializationUtils.ReadVarint(dataStream);
                var version  = SerializationUtils.ReadVarint(dataStream);
                var entry    = new ObjectIdOffsetEntry(objectId, offset, type, version);
                _objectIdOffsetIndex.Add(entry);
            }
        }
 public void SetObjectOffset(ulong objectId, ulong offset, ulong type, ulong version)
 {
     var entry = new ObjectIdOffsetEntry(objectId, offset, type, version);
     var loc = _objectIdOffsetIndex.BinarySearch(entry);
     if (loc < 0)
     {
         // doesn't exist
         _objectIdOffsetIndex.Insert(~loc, entry);
     } else
     {
         _objectIdOffsetIndex[loc] = entry;
     }
     IsModified = true;
 }
Пример #6
0
        public void SetObjectOffset(ulong objectId, ulong offset, ulong type, ulong version)
        {
            var entry = new ObjectIdOffsetEntry(objectId, offset, type, version);
            var loc   = _objectIdOffsetIndex.BinarySearch(entry);

            if (loc < 0)
            {
                // doesn't exist
                _objectIdOffsetIndex.Insert(~loc, entry);
            }
            else
            {
                _objectIdOffsetIndex[loc] = entry;
            }
            IsModified = true;
        }
 public void Read(BinaryReader dataStream)
 {
     var count = (int)SerializationUtils.ReadVarint(dataStream);
     for (int i=0;i < count; i++)
     {
         var objectId = SerializationUtils.ReadVarint(dataStream);
         var offset = SerializationUtils.ReadVarint(dataStream);
         var type = SerializationUtils.ReadVarint(dataStream);
         var version = SerializationUtils.ReadVarint(dataStream);
         var entry = new ObjectIdOffsetEntry(objectId, offset, type, version);
         _objectIdOffsetIndex.Add(entry);
     }
 }
 public void DeleteObjectOffset(ulong objectId)
 {
     var entry = new ObjectIdOffsetEntry(objectId, 0, 0, 0);
     var loc = _objectIdOffsetIndex.BinarySearch(entry);
     if (loc < 0) return;
     _objectIdOffsetIndex.RemoveAt(loc);
     IsModified = true;
 }