예제 #1
0
        public ImmutableKeyValue Parse(ReadOnlySpan <byte> data, KeyValueParserConfig config)
        {
            _conditions = config?.Conditions ?? KeyValueParserConfig.GetDefaultConditions();

            _values      = data;
            _valuesIndex = 0;
            _db          = new KVDatabase.Builder(config?.Pool ?? MemoryPool <byte> .Default, data.Length / 8);
            ref DbRow topRow = ref _db.AppendRow();
예제 #2
0
        public ImmutableKeyValue Parse(ReadOnlySpan <byte> data, MemoryPool <byte> pool)
        {
            _values      = data;
            _valuesIndex = 0;
            _db          = new KVDatabase.Builder(pool ?? MemoryPool <byte> .Default, data.Length / 4);

            if (_values[_valuesIndex] != 0) // it started with a null
            {
                throw new InvalidDataException();
            }

            _valuesIndex++;

            ref DbRow topRow = ref _db.AppendRow();