Ejemplo n.º 1
0
        private int CompareData(ValueReader other, int len)
        {
            if (_buffer != null)
            {
                fixed(byte *a = _buffer)
                {
                    if (other._buffer != null)
                    {
                        fixed(byte *b = other._buffer)
                        {
                            return(Memory.Compare(a, b, len));
                        }
                    }
                    return(Memory.Compare(a, other._val, len));
                }
            }

            if (other._buffer != null)
            {
                fixed(byte *b = other._buffer)
                {
                    return(Memory.Compare(_val, b, len));
                }
            }

            return(Memory.Compare(_val, other._val, len));
        }
Ejemplo n.º 2
0
 private int CompareData(ValueReader other, int len)
 {
     if (_buffer != null)
     {
         fixed(byte *a = _buffer)
         {
             if (other._buffer != null)
             {
                 fixed(byte *b = other._buffer)
                 {
                     return(NativeMethods.memcmp(a, b, len));
                 }
             }
             return(NativeMethods.memcmp(a, other._val, len));
         }
     }
     if (other._buffer != null)
     {
         fixed(byte *b = other._buffer)
         {
             return(NativeMethods.memcmp(_val, b, len));
         }
     }
     return(NativeMethods.memcmp(_val, other._val, len));
 }
Ejemplo n.º 3
0
        public int CompareTo(ValueReader other)
        {
            int r = CompareData(other, Math.Min(Length, other.Length));

            if (r != 0)
            {
                return(r);
            }
            return(Length - other.Length);
        }
Ejemplo n.º 4
0
        public int CompareTo(ValueReader other)
        {
            int size = Math.Min(Length, other.Length);

            int r = Memory.CompareInline(_val, other._val, size);

            if (r != 0)
            {
                return(r);
            }

            return(Length - other.Length);
        }
Ejemplo n.º 5
0
 public ReadResult(ValueReader reader, ushort version)
 {
     Reader  = reader;
     Version = version;
 }
Ejemplo n.º 6
0
        private int CompareData(ValueReader other, int len)
        {
            if (_buffer != null)
            {
                fixed (byte* a = _buffer)
                {
                    if (other._buffer != null)
                    {
                        fixed (byte* b = other._buffer)
                        {
                            return Memory.Compare(a, b, len);
                        }
                    }
                    return Memory.Compare(a, other._val, len);
                }
            }

            if (other._buffer != null)
            {
                fixed (byte* b = other._buffer)
                {
                    return Memory.Compare(_val, b, len);
                }
            }

            return Memory.Compare(_val, other._val, len);
        }
Ejemplo n.º 7
0
        public int CompareTo(ValueReader other)
        {
            int r = CompareData(other, Math.Min(Length, other.Length));
            if (r != 0)
                return r;

            return Length - other.Length;
        }
Ejemplo n.º 8
0
 private int CompareData(ValueReader other, int len)
 {
     if (_buffer != null)
     {
         fixed (byte* a = _buffer)
         {
             if (other._buffer != null)
             {
                 fixed (byte* b = other._buffer)
                 {
                     return NativeMethods.memcmp(a, b, len);
                 }
             }
             return NativeMethods.memcmp(a, other._val, len);
         }
     }
     if (other._buffer != null)
     {
         fixed (byte* b = other._buffer)
         {
             return NativeMethods.memcmp(_val, b, len);
         }
     }
     return NativeMethods.memcmp(_val, other._val, len);
 }
Ejemplo n.º 9
0
        public ReadResult(ValueReader reader, ushort version)
		{
            Reader = reader;
			Version = version;
		}
Ejemplo n.º 10
0
        private void DeleteTermsForIndexEntry(SnapshotReader snapshot, ValueReader reader, long id, int fieldId)
        {
            var termBuffer = _bufferPool.Take(reader.Length);
            _usedBuffers.Add(termBuffer);
            reader.Read(termBuffer, 0, reader.Length);
            var termSlice = new Slice(termBuffer, (ushort) reader.Length);

            var tree = GetTreeName(fieldId);
            using (var termIt = snapshot.MultiRead(tree, termSlice))
            {
                var currentFieldDocument = _bufferPool.Take(FullTextIndex.FieldDocumentSize);
                try
                {
                    if (termIt.Seek(new Slice(currentFieldDocument)) == false)
                        return;
                    do
                    {
                        termIt.CurrentKey.CopyTo(currentFieldDocument);

                        if (EndianBitConverter.Big.ToInt64(currentFieldDocument, 0) != id)
                            break;

                        var valueBuffer = _bufferPool.Take(termIt.CurrentKey.Size);
                        _usedBuffers.Add(valueBuffer);
                        termIt.CurrentKey.CopyTo(valueBuffer);
                        _writeBatch.MultiDelete(termSlice, new Slice(valueBuffer), tree);
                    } while (termIt.MoveNext());
                }
                finally
                {
                    _bufferPool.Return(currentFieldDocument);
                }
            }
        }