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; }
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); }
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; }
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; }
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; }