예제 #1
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);
            }
        }
예제 #2
0
        public IEnumerable<LTrieRow> IterateBackwardStartsWithClosestToPrefix(byte[] initKey, bool useCache)
        {
            if(initKey.Length<1)
                return new List<LTrieRow>();

            Forward fw = new Forward(this._root);
            fw.IterateForwardStartsWith_Prefix_Helper(initKey, useCache);

            if (fw.PrefixDeep == -1)
                return new List<LTrieRow>();

            byte[] newKey = new byte[fw.PrefixDeep + 1];
            Buffer.BlockCopy(initKey, 0, newKey, 0, fw.PrefixDeep + 1);
            return this.IterateBackwardStartsWith(newKey, useCache);
        }
예제 #3
0
        public IEnumerable<LTrieRow> IterateForwardStartsWith(byte[] startKey, bool useCache)
        {
            this.CheckTableIsOperable();

            if (!useCache)
            {
                //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.IterateForwardStartsWith(startKey, false);

            }
            else
            {
                LTrieRootNode readRootNode = new LTrieRootNode(this);
                Forward bw = new Forward(readRootNode);
                return bw.IterateForwardStartsWith(startKey, true);
            }
        }
예제 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="startKey"></param>
        /// <returns></returns>
        public IEnumerable<LTrieRow> IterateForwardStartsWithClosestToPrefix(byte[] startKey)
        {
            this.CheckTableIsOperable();

            LTrieRootNode readRootNode = new LTrieRootNode(this);

            Forward bw = new Forward(readRootNode);
            return bw.IterateForwardStartsWithClosestToPrefix(startKey, true);
        }
예제 #5
0
        //Iterate  StartFrom
        public IEnumerable<LTrieRow> IterateForwardStartFrom(byte[] key, bool includeStartKey)
        {
            this.CheckTableIsOperable();

            LTrieRootNode readRootNode = new LTrieRootNode(this);
            Forward fw = new Forward(readRootNode);
            return fw.IterateForwardStartFrom(key, includeStartKey,true);
        }
예제 #6
0
        public IEnumerable<LTrieRow> IterateForwardStartFrom(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();

                Forward fw = new Forward(rn);
                return fw.IterateForwardStartFrom(key, includeStartKey,false);

            }
            else
            {
                Forward fw = new Forward((LTrieRootNode)readRootNode);
                return fw.IterateForwardStartFrom(key, includeStartKey,true);
            }
        }
예제 #7
0
        //SKIP FROM
        public IEnumerable<LTrieRow> IterateForwardSkipFrom(byte[] key, ulong skippingQuantity)
        {
            this.CheckTableIsOperable();

            LTrieRootNode readRootNode = new LTrieRootNode(this);

            Forward bw = new Forward(readRootNode);
            return bw.IterateForwardSkipFrom(key,skippingQuantity,true);
        }
예제 #8
0
        public IEnumerable<LTrieRow> IterateForwardSkipFrom(byte[] key, 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();

                Forward bw = new Forward(rn);
                return bw.IterateForwardSkipFrom(key, skippingQuantity,false);

            }
            else
            {

                Forward bw = new Forward((LTrieRootNode)readRootNode);
                return bw.IterateForwardSkipFrom(key, skippingQuantity,true);
            }
        }
예제 #9
0
        //Iterate From - To
        public IEnumerable<LTrieRow> IterateForwardFromTo(byte[] startKey, byte[] stopKey,bool includeStartKey, bool includeStopKey)
        {
            this.CheckTableIsOperable();

            LTrieRootNode readRootNode = new LTrieRootNode(this);

            Forward bw = new Forward(readRootNode);
            return bw.IterateForwardFromTo(startKey,stopKey,includeStartKey,includeStopKey,true);
        }
예제 #10
0
        public LTrieRow IterateForwardForMinimal(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.IterateForwardForMinimal(false);

            }
            else
            {
                Forward bw = new Forward((LTrieRootNode)readRootNode);
                return bw.IterateForwardForMinimal(true);
            }
        }
예제 #11
0
        //MIN-MAX
        public LTrieRow IterateForwardForMinimal()
        {
            this.CheckTableIsOperable();

            LTrieRootNode readRootNode = new LTrieRootNode(this);

            Forward bw = new Forward(readRootNode);
            return bw.IterateForwardForMinimal(true);
        }
예제 #12
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);
            }
        }
예제 #13
0
        //Iterate
        public IEnumerable<LTrieRow> IterateForward()
        {
            this.CheckTableIsOperable();

            LTrieRootNode readRootNode = new LTrieRootNode(this);

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