Пример #1
0
        public IEnumerable<LTrieRow> IterateBackwardSkip(ulong skippingQuantity, ITrieRootNode readRootNode)
        {
            this.CheckTableIsOperable();

            if (readRootNode==null)
            {
                //Flashing changes on the disk before commit. In case if the same thread uses the same root node
                this.SaveGenerationMap();

                Backward bw = new Backward(rn);
                return bw.IterateBackwardSkip(skippingQuantity,false);

            }
            else
            {
                Backward bw = new Backward((LTrieRootNode)readRootNode);
                return bw.IterateBackwardSkip(skippingQuantity,true);
            }
        }
Пример #2
0
        public IEnumerable<LTrieRow> IterateBackwardStartFrom(byte[] key, bool includeStartKey, ITrieRootNode readRootNode)
        {
            this.CheckTableIsOperable();

            if (readRootNode==null)
            {
                //Flashing changes on the disk before commit. In case if the same thread uses the same root node
                this.SaveGenerationMap();

                Backward bw = new Backward(rn);
                return bw.IterateBackwardStartFrom(key, includeStartKey,false);

            }
            else
            {
                Backward bw = new Backward((LTrieRootNode)readRootNode);
                return bw.IterateBackwardStartFrom(key, includeStartKey,true);
            }
        }
Пример #3
0
        public LTrieRow IterateBackwardForMaximal(ITrieRootNode readRootNode)
        {
            this.CheckTableIsOperable();

            if (readRootNode==null)
            {
                //Flashing changes on the disk before commit. In case if the same thread uses the same root node
                this.SaveGenerationMap();

                Backward bw = new Backward(rn);
                return bw.IterateBackwardForMaximal(false);

            }
            else
            {
                Backward bw = new Backward((LTrieRootNode)readRootNode);
                return bw.IterateBackwardForMaximal(true);
            }
        }
Пример #4
0
        /// <summary>
        /// DBreeze compatible.
        /// Extension, which helps to READ-THREADS smartly utilize created before read-roots
        /// </summary>
        /// <param name="key"></param>
        /// <param name="readRootNode">if null then WRITE-ROOT NODE</param>
        /// <returns></returns>
        public LTrieRow GetKey(ref byte[] key, ITrieRootNode readRootNode)
        {
            this.CheckTableIsOperable();

            if (readRootNode==null)
            {
                //Flashing changes on the disk before commit. In case if the same thread uses the same root node
                this.SaveGenerationMap();

                return rn.GetKey(key,false);

            }
            else
            {
                return ((LTrieRootNode)readRootNode).GetKey(key,true);
            }
        }
Пример #5
0
        /// <summary>
        /// Can be used inside of DBreeze - concerns all read functions
        /// </summary>
        /// <param name="SYNCHRO_READ"></param>
        /// <returns></returns>
        public ulong Count(ITrieRootNode readRootNode)
        {
            this.CheckTableIsOperable();

            if (readRootNode==null)
            {
                //Flashing changes on the disk before commit. In case if the same thread uses the same root node
                this.SaveGenerationMap();

                return rn.RecordsCount;

            }
            else
            {
                //LTrieRootNode readRootNode = new LTrieRootNode(this);
                return ((LTrieRootNode)readRootNode).RecordsCount;
            }
        }
Пример #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="startKey"></param>
        /// <param name="readRootNode"></param>
        /// <returns></returns>
        public IEnumerable<LTrieRow> IterateForwardStartsWithClosestToPrefix(byte[] startKey, ITrieRootNode readRootNode)
        {
            this.CheckTableIsOperable();

            if (readRootNode == null)
            {
                //Flashing changes on the disk before commit. In case if the same thread uses the same root node
                this.SaveGenerationMap();

                Forward bw = new Forward(rn);
                return bw.IterateForwardStartsWithClosestToPrefix(startKey, false);

            }
            else
            {
                Forward bw = new Forward((LTrieRootNode)readRootNode);
                return bw.IterateForwardStartsWithClosestToPrefix(startKey, true);
            }
        }
Пример #7
0
        //bool SYNCHRO_READ
        public IEnumerable<LTrieRow> IterateForward(ITrieRootNode readRootNode)
        {
            this.CheckTableIsOperable();

            if (readRootNode == null)   //SYNCHRO_READ
            {
                //Flashing changes on the disk before commit. In case if the same thread uses the same root node
                this.SaveGenerationMap();

                Forward fw = new Forward(rn);
                return fw.IterateForward(false);

            }
            else
            {
                Forward fw = new Forward((LTrieRootNode)readRootNode);
                return fw.IterateForward(true);
            }
        }