Ejemplo n.º 1
0
        private IEnumerable <KeyValuePair <Bytes, byte[]> > All(bool forward)
        {
            var enumerator = DbAdapter.All(forward);
            var wrapped    = new WrappedRocksRbKeyValueEnumerator(enumerator, openIterators.Remove);

            openIterators.Add(wrapped);
            return(new RocksDbEnumerable(Name, wrapped));
        }
Ejemplo n.º 2
0
        private IKeyValueEnumerator <Bytes, byte[]> Range(Bytes from, Bytes to, bool forward)
        {
            if (KeyComparator.Invoke(from.Get, to.Get) > 0)
            {
                log.LogWarning("Returning empty iterator for fetch with invalid key range: from > to. "
                               + "This may be due to range arguments set in the wrong order, " +
                               "or serdes that don't preserve ordering when lexicographically comparing the serialized bytes. " +
                               "Note that the built-in numerical serdes do not follow this for negative numbers");
                return(new EmptyKeyValueEnumerator <Bytes, byte[]>());
            }

            CheckStateStoreOpen();

            var rocksEnumerator = DbAdapter.Range(from, to, forward);
            var wrapped         = new WrappedRocksRbKeyValueEnumerator(rocksEnumerator, openIterators.Remove);

            openIterators.Add(wrapped);
            return(wrapped);
        }