コード例 #1
0
        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());
            }
        }
コード例 #2
0
 protected internal override void FillPageWithDefaultValue(PageCursor writeCursor, long ignoredDefaultValue, int pageSize)
 {
     for (int i = 0; i < EntriesPerPage; i++)
     {
         writeCursor.PutBytes(this._defaultValue);
     }
 }
コード例 #3
0
        internal static void Put(PageCursor cursor, sbyte[] byteArray, long long0, long long2)
        {
            // There are two variants of a text value, one is string, the other is char. Both are the same ValueGroup, i.e. TEXT
            // and should be treated the same, it's just that we need to know if it's a char so that we can materialize a CharValue for chars.
            // We put a special marker for char values, knowing that a char is exactly 2 bytes in storage.
            // This can be picked up by reader and set the right flag in state so that a CharValue can be materialized.
            short length = toNonNegativeShortExact(long0);

            cursor.PutShort(IsCharValueType(long2) ? ( short )(length | CHAR_TYPE_LENGTH_MARKER) : length);
            cursor.PutBytes(byteArray, 0, length);
        }
コード例 #4
0
 public override void Write(DynamicRecord record, PageCursor cursor, int recordSize)
 {
     if (record.InUse())
     {
         Debug.Assert(record.Length < (1 << 24) - 1);
         sbyte headerByte = ( sbyte )((record.InUse() ? IN_USE_BIT : 0) | (record.StartRecord ? START_RECORD_BIT : 0));
         cursor.PutByte(headerByte);
         cursor.PutShort(( short )record.Length);
         cursor.PutByte(( sbyte )(( int )(( uint )record.Length >> 16)));
         cursor.PutLong(record.NextBlock);
         cursor.PutBytes(record.Data);
     }
     else
     {
         MarkAsUnused(cursor);
     }
 }
コード例 #5
0
ファイル: StringLayout.cs プロジェクト: Neo4Net/Neo4Net
 public override void WriteKey(PageCursor cursor, StringIndexKey key)
 {
     cursor.PutLong(key.EntityId);
     cursor.PutBytes(key.Bytes, 0, key.BytesLengthConflict);
 }
コード例 #6
0
 public override void WriteValue(PageCursor cursor, RawBytes rawBytes)
 {
     cursor.PutBytes(rawBytes.Bytes);
 }