Esempio n. 1
0
        public void WriteBlock(Span <byte> memoryToFill)
        {
            var lastKey = new ReadOnlySpan <byte>();
            var span    = memoryToFill;

            do
            {
                var key   = _iterator.Current.Key;
                var value = _iterator.Current.Value;

                var lengthNeeded = (sizeof(int) * 2) + key.Length + value.Length;
                if (span.Length < lengthNeeded)
                {
                    span.Fill(0);
                    _moreToWrite = true;
                    return;
                }

                _count++;
                _filter.AddKey(key);
                BinaryPrimitives.WriteInt32LittleEndian(span, key.Length);
                span = span[sizeof(int)..];