public override void Write(DynamicRecord record, PageCursor cursor, int recordSize) { if (record.InUse()) { long nextBlock = record.NextBlock; int highByteInFirstInteger = nextBlock == Record.NO_NEXT_BLOCK.intValue() ? 0 : (int)((nextBlock & 0xF00000000L) >> 8); highByteInFirstInteger |= Record.IN_USE.byteValue() << 28; highByteInFirstInteger |= (record.StartRecord ? 0 : 1) << 31; /* * First 4b * [x , ][ , ][ , ][ , ] 0: start record, 1: linked record * [ x, ][ , ][ , ][ , ] inUse * [ ,xxxx][ , ][ , ][ , ] high next block bits * [ , ][xxxx,xxxx][xxxx,xxxx][xxxx,xxxx] nr of bytes in the data field in this record * */ int firstInteger = record.Length; Debug.Assert(firstInteger < (1 << 24) - 1); firstInteger |= highByteInFirstInteger; cursor.PutInt(firstInteger); cursor.PutInt(( int )nextBlock); cursor.PutBytes(record.Data); } else { cursor.PutByte(Record.NOT_IN_USE.byteValue()); } }
private void PutFormatVersion(PageCursor cursor) { GenericLayout layout = Layout; int major = layout.MajorVersion(); cursor.PutInt(major); int minor = layout.MinorVersion(); cursor.PutInt(minor); }
public override void Write(IntRecord record, PageCursor cursor, int recordSize) { for (int i = 0; i < outerInstance.intsPerRecord; i++) { cursor.PutInt(record.Value); } }
internal static void SetKeyCount(PageCursor cursor, int count) { if (count < 0) { throw new System.ArgumentException("Invalid key count, " + count + ". On tree node " + cursor.CurrentPageId + "."); } cursor.PutInt(BytePosKeycount, count); }
private void PutData(PageCursor c) { GenericLayout layout = Layout; GenericKey key = layout.NewKey(); foreach (Value value in _values) { InitializeFromValue(key, value); c.PutInt(key.Size()); layout.WriteKey(c, key); } }
public override void Write(Record record, PageCursor cursor) { StandardRecord r = ( StandardRecord )record; sbyte[] pathBytes = r.File.Path.getBytes(StandardCharsets.UTF_8); sbyte fileByte = pathBytes[pathBytes.Length - 1]; cursor.PutByte(r.Type); cursor.PutByte(fileByte); cursor.PutShort(r.Fill1); cursor.PutInt(r.RecordId); cursor.PutLong(r.Fill2); }
public override void SetInt(long index, int offset, int value) { long pageId = pageId(index); offset += offset(index); try { using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW)) { cursor.Next(); cursor.PutInt(offset, value); CheckBounds(cursor); } } catch (IOException e) { throw new UncheckedIOException(e); } }
public override void Set6ByteLong(long index, int offset, long value) { long pageId = pageId(index); offset += offset(index); try { using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW)) { cursor.Next(); cursor.PutInt(offset, ( int )value); cursor.PutShort(offset + Integer.BYTES, ( short )(( long )(( ulong )value >> (sizeof(int) * 8)))); CheckBounds(cursor); } } catch (IOException e) { throw new UncheckedIOException(e); } }
internal static void Put(PageCursor cursor, long long0, long long1) { cursor.PutLong(long1); cursor.PutInt(( int )long0); }
internal static void SetGeneration(PageCursor cursor, long generation) { GenerationSafePointer.AssertGenerationOnWrite(generation); cursor.PutInt(BytePosGeneration, ( int )generation); }