private byte[] ReadName(LatinStringIO sio, ByteArrayBuffer reader) { byte[] nameBytes = sio.Bytes(reader); reader.IncrementOffset(nameBytes.Length); nameBytes = Platform4.UpdateClassName(nameBytes); return(nameBytes); }
public override void CompleteInterruptedTransaction(int transactionId1, int transactionId2 ) { if (!File.Exists(LockFileName(_fileName))) { return; } if (!LockFileSignalsInterruptedTransaction()) { return; } var buffer = new ByteArrayBuffer(Const4.IntLength); OpenLogFile(); Read(_logFile, buffer); var length = buffer.ReadInt(); if (length > 0) { buffer = new ByteArrayBuffer(length); Read(_logFile, buffer); buffer.IncrementOffset(Const4.IntLength); ReadWriteSlotChanges(buffer); } DeleteLockFile(); CloseLogFile(); DeleteLogFile(); }
private byte[] ReadName(LatinStringIO sio, ByteArrayBuffer reader) { var nameBytes = sio.Bytes(reader); reader.IncrementOffset(nameBytes.Length); nameBytes = Platform4.UpdateClassName(nameBytes); return nameBytes; }
public override void ReadThis(Transaction a_trans, ByteArrayBuffer a_reader) { a_reader.IncrementOffset(1); // first byte is version, for possible future format changes _size = a_reader.ReadInt(); _nodeSize = a_reader.ReadInt(); _halfNodeSize = NodeSize() / 2; _root = ProduceNode(a_reader.ReadInt()); }
public override void WriteThis(Transaction trans, ByteArrayBuffer buffer) { int count = 0; int startOffset = buffer._offset; IContext context = trans.Context(); buffer.IncrementOffset(CountLeafAnd3LinkLength); if (_isLeaf) { for (int i = 0; i < _count; i++) { object obj = InternalKey(trans, i); if (obj != No4.Instance) { count++; KeyHandler().WriteIndexEntry(context, buffer, obj); } } } else { for (int i = 0; i < _count; i++) { if (ChildCanSupplyFirstKey(i)) { Db4objects.Db4o.Internal.Btree.BTreeNode child = (Db4objects.Db4o.Internal.Btree.BTreeNode )_children[i]; object childKey = child.FirstKey(trans); if (childKey != No4.Instance) { count++; KeyHandler().WriteIndexEntry(context, buffer, childKey); buffer.WriteIDOf(trans, child); } } else { count++; KeyHandler().WriteIndexEntry(context, buffer, Key(i)); buffer.WriteIDOf(trans, _children[i]); } } } int endOffset = buffer._offset; buffer._offset = startOffset; buffer.WriteInt(count); buffer.WriteByte(_isLeaf ? (byte)1 : (byte)0); buffer.WriteInt(_parentID); buffer.WriteInt(_previousID); buffer.WriteInt(_nextID); buffer._offset = endOffset; }
public virtual RawClassSpec ReadSpec(Transaction trans, ByteArrayBuffer reader) { var nameBytes = ReadName(trans, reader); var className = trans.Container().StringIO().Read(nameBytes); ReadMetaClassID(reader); // skip var ancestorID = reader.ReadInt(); reader.IncrementOffset(Const4.IntLength); // index ID var numFields = reader.ReadInt(); return new RawClassSpec(className, ancestorID, numFields); }
public virtual RawClassSpec ReadSpec(Transaction trans, ByteArrayBuffer reader) { var nameBytes = ReadName(trans, reader); var className = trans.Container().StringIO().Read(nameBytes); ReadMetaClassID(reader); // skip var ancestorID = reader.ReadInt(); reader.IncrementOffset(Const4.IntLength); // index ID var numFields = reader.ReadInt(); return(new RawClassSpec(className, ancestorID, numFields)); }
protected virtual void ReadBuffer(ByteArrayBuffer buffer, bool versionsAreConsistent ) { buffer.IncrementOffset(ChecksumLength); SystemData systemData = SystemData(); systemData.IdSystemSlot(ReadSlot(buffer, false)); systemData.InMemoryFreespaceSlot(ReadSlot(buffer, !versionsAreConsistent)); systemData.BTreeFreespaceId(buffer.ReadInt()); systemData.ConverterVersion(buffer.ReadInt()); systemData.UuidIndexId(buffer.ReadInt()); systemData.IdentityId(buffer.ReadInt()); systemData.LastTimeStampID(buffer.ReadLong()); systemData.FreespaceSystem(buffer.ReadByte()); }
private void Marshall(ByteArrayBuffer buffer, bool shuttingDown) { var checkSumOffset = buffer.Offset(); buffer.IncrementOffset(ChecksumLength); var checkSumBeginOffset = buffer.Offset(); WriteBuffer(buffer, shuttingDown); var checkSumEndOffSet = buffer.Offset(); var bytes = buffer._buffer; var length = checkSumEndOffSet - checkSumBeginOffset; var checkSum = CRC32.CheckSum(bytes, checkSumBeginOffset, length); buffer.Seek(checkSumOffset); buffer.WriteLong(checkSum); buffer.Seek(checkSumEndOffSet); }
public virtual void SkipMarshallerInfo(ByteArrayBuffer reader) { reader.IncrementOffset(1); }
public override void ReadThis(Transaction a_trans, ByteArrayBuffer a_reader) { a_reader.IncrementOffset(1); // first byte is version, for possible future format changes _size = a_reader.ReadInt(); _nodeSize = a_reader.ReadInt(); _halfNodeSize = NodeSize()/2; _root = ProduceNode(a_reader.ReadInt()); }
public override void WriteThis(Transaction trans, ByteArrayBuffer buffer) { var count = 0; var startOffset = buffer._offset; var context = trans.Context(); buffer.IncrementOffset(CountLeafAnd3LinkLength); if (_isLeaf) { for (var i = 0; i < _count; i++) { var obj = InternalKey(trans, i); if (obj != No4.Instance) { count++; KeyHandler().WriteIndexEntry(context, buffer, obj); } } } else { for (var i = 0; i < _count; i++) { if (ChildCanSupplyFirstKey(i)) { var child = (BTreeNode ) _children[i]; var childKey = child.FirstKey(trans); if (childKey != No4.Instance) { count++; KeyHandler().WriteIndexEntry(context, buffer, childKey); buffer.WriteIDOf(trans, child); } } else { count++; KeyHandler().WriteIndexEntry(context, buffer, Key(i)); buffer.WriteIDOf(trans, _children[i]); } } } var endOffset = buffer._offset; buffer._offset = startOffset; buffer.WriteInt(count); buffer.WriteByte(_isLeaf ? (byte) 1 : (byte) 0); buffer.WriteInt(_parentID); buffer.WriteInt(_previousID); buffer.WriteInt(_nextID); buffer._offset = endOffset; }
protected virtual void ReadBuffer(ByteArrayBuffer buffer, bool versionsAreConsistent ) { buffer.IncrementOffset(ChecksumLength); var systemData = SystemData(); systemData.IdSystemSlot(ReadSlot(buffer, false)); systemData.InMemoryFreespaceSlot(ReadSlot(buffer, !versionsAreConsistent)); systemData.BTreeFreespaceId(buffer.ReadInt()); systemData.ConverterVersion(buffer.ReadInt()); systemData.UuidIndexId(buffer.ReadInt()); systemData.IdentityId(buffer.ReadInt()); systemData.LastTimeStampID(buffer.ReadLong()); systemData.FreespaceSystem(buffer.ReadByte()); }