예제 #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));
        }
예제 #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));
 }
예제 #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);
        }
예제 #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);
        }
예제 #5
0
 public ReadResult(ValueReader reader, ushort version)
 {
     Reader  = reader;
     Version = version;
 }
예제 #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);
        }
예제 #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;
        }
예제 #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);
 }
예제 #9
0
        public ReadResult(ValueReader reader, ushort version)
		{
            Reader = reader;
			Version = version;
		}
예제 #10
0
파일: Indexer.cs 프로젝트: votrongdao/Corax
        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);
                }
            }
        }