/// <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); } }
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); }
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); } }
/// <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); }
//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); }
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); } }
//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); }
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); } }
//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); }
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); } }
//MIN-MAX public LTrieRow IterateForwardForMinimal() { this.CheckTableIsOperable(); LTrieRootNode readRootNode = new LTrieRootNode(this); Forward bw = new Forward(readRootNode); return bw.IterateForwardForMinimal(true); }
//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); } }
//Iterate public IEnumerable<LTrieRow> IterateForward() { this.CheckTableIsOperable(); LTrieRootNode readRootNode = new LTrieRootNode(this); Forward fw = new Forward(readRootNode); return fw.IterateForward(true); }