Beispiel #1
0
        public IEnumerable <Triple> P(string p)
        {
            var ph     = KeySegments.GetNamePKeyPredicate(_name, p);
            var startS = KeyConfig.ConcatBytes(ph, KeyConfig.ByteZero);
            var endS   = KeyConfig.ConcatBytes(ph, KeyConfig.ByteOne);

            return(new RocksEnumerable(_db, startS, endS, (Iterator it) => { return it.Next(); }));
        }
Beispiel #2
0
        public IEnumerable <Triple> P(string p, Triple c)
        {
            if (c == null)
            {
                return(P(p));
            }
            var ph     = KeySegments.GetNamePKeyPredicate(_name, p);
            var startS = KeyConfig.ConcatBytes(ph, KeyConfig.ByteZero);
            var endS   = KeyConfig.ConcatBytes(ph, KeyConfig.ByteOne);

            var(_, pKey, _) = new KeySegments(_name, c).GetKeys();
            var continuation = KeyConfig.ConcatBytes(pKey, KeyConfig.ByteOne);

            if (KeyConfig.ByteCompare(continuation, startS) < 0)
            {
                throw new InvalidOperationException("Invalid continuation token. Before range");
            }
            else if (KeyConfig.ByteCompare(continuation, endS) > 0)
            {
                return(Enumerable.Empty <Triple>());
            }

            return(new RocksEnumerable(_db, continuation, endS, (Iterator it) => { return it.Next(); }));
        }