本文整理汇总了C#中Voron.Trees.Tree类的典型用法代码示例。如果您正苦于以下问题:C# Tree类的具体用法?C# Tree怎么用?C# Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tree类属于Voron.Trees命名空间,在下文中一共展示了Tree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Searcher
public Searcher(FullTextIndex index)
{
_index = index;
_tx = _index.StorageEnvironment.NewTransaction(TransactionFlags.Read);
_docs = _tx.ReadTree("Docs");
}
示例2: PageSplitter
public PageSplitter(Transaction tx,
Tree tree,
SliceComparer cmp,
Slice newKey,
int len,
long pageNumber,
NodeFlags nodeType,
ushort nodeVersion,
Cursor cursor,
TreeMutableState treeState)
{
_tx = tx;
_tree = tree;
_cmp = cmp;
_newKey = newKey;
_len = len;
_pageNumber = pageNumber;
_nodeType = nodeType;
_nodeVersion = nodeVersion;
_cursor = cursor;
_treeState = treeState;
Page page = _cursor.Pages.First.Value;
_page = tx.ModifyPage(page.PageNumber, page);
_cursor.Pop();
}
示例3: StorageEnvironmentState
public StorageEnvironmentState(Tree freeSpaceRoot, Tree root, long nextPageNumber)
{
if (freeSpaceRoot != null)
FreeSpaceRoot = freeSpaceRoot.State;
if (root != null)
Root = root.State;
NextPageNumber = nextPageNumber;
}
示例4: ParentPageAction
public ParentPageAction(Page parentPage, Page currentPage, Tree tree, Cursor cursor, Transaction tx)
{
_parentPage = parentPage;
_currentPage = currentPage;
_tree = tree;
_cursor = cursor;
_tx = tx;
}
示例5: TreeIterator
public TreeIterator(Tree tree, Transaction tx)
{
_tree = tree;
_tx = tx;
if (tree.KeysPrefixing)
_currentInternalKey = new PrefixedSlice(SliceOptions.Key);
else
_currentInternalKey = new Slice(SliceOptions.Key);
}
示例6: Init
protected override void Init()
{
_fieldTree = Transaction.ReadTree("@fld_" + _field);
if (_fieldTree == null)
return;
var termFreqInDocs = _fieldTree.State.EntriesCount;
var numberOfDocs = Transaction.ReadTree("$metadata").Read(Transaction, "docs").Reader.ReadInt64();
var idf = Index.Conventions.Idf(termFreqInDocs, numberOfDocs);
_weight = idf*idf;
}
示例7: Init
protected override void Init()
{
base.Init();
_positionsTree = Transaction.ReadTree("TermPositions");
_docsTree = Transaction.ReadTree("Docs");
_fieldId = Index.GetFieldNumber(Field);
_prefix = new byte[FullTextIndex.FieldDocumentSize];
_prefixSlice = new Slice(_prefix);
_maxKey = new byte[FullTextIndex.FieldDocumentSize];
_maxKeySlice = new Slice(_maxKey);
}
示例8: Create
public static Tree Create(Transaction tx, SliceComparer cmp, TreeFlags flags = TreeFlags.None)
{
var newRootPage = NewPage(tx, PageFlags.Leaf, 1);
var tree = new Tree(cmp, newRootPage.PageNumber)
{
_state =
{
Depth = 1,
Flags = flags,
InWriteTransaction = true
}
};
tree.State.RecordNewPage(newRootPage, 1);
return tree;
}
示例9: Create
public static Tree Create(Transaction tx, bool keysPrefixing, TreeFlags flags = TreeFlags.None)
{
var newRootPage = NewPage(tx, keysPrefixing ? PageFlags.Leaf | PageFlags.KeysPrefixed : PageFlags.Leaf, 1);
var tree = new Tree(tx, newRootPage.PageNumber)
{
_state =
{
Depth = 1,
Flags = flags,
InWriteTransaction = true,
KeysPrefixing = keysPrefixing
}
};
tree.State.RecordNewPage(newRootPage, 1);
return tree;
}
示例10: Keys
public unsafe List<Slice> Keys(Tree t, Transaction tx)
{
var results = new List<Slice>();
using (var it = t.Iterate())
{
if (it.Seek(Slice.BeforeAllKeys) == false)
return results;
do
{
results.Add(it.CurrentKey);
} while (it.MoveNext());
}
return results;
}
示例11: RenderAndShow
protected void RenderAndShow(Transaction tx, Tree root, int showEntries = 25)
{
if (Debugger.IsAttached == false)
return;
var path = Path.Combine(Environment.CurrentDirectory, "test-tree.dot");
var rootPageNumber = tx.Environment.State.GetTree(tx,root.Name).State.RootPageNumber;
TreeDumper.Dump(tx, path, tx.GetReadOnlyPage(rootPageNumber), showEntries);
var output = Path.Combine(Environment.CurrentDirectory, "output.svg");
var p = Process.Start(DebugStuff.FindGraphviz() + @"\bin\dot.exe", "-Tsvg " + path + " -o " + output);
p.WaitForExit();
Process.Start(output);
}
示例12: StorageEnvironmentState
public StorageEnvironmentState(Tree freeSpaceRoot, Tree root, long nextPageNumber)
{
FreeSpaceRoot = freeSpaceRoot;
Root = root;
NextPageNumber = nextPageNumber;
}
示例13: TryRemoveMultiValueTree
internal bool TryRemoveMultiValueTree(Tree parentTree, MemorySlice key)
{
var keyToRemove = Tuple.Create(parentTree, key);
if (_multiValueTrees == null || !_multiValueTrees.ContainsKey(keyToRemove))
return false;
return _multiValueTrees.Remove(keyToRemove);
}
示例14: ModifyPage
internal Page ModifyPage(long num, Tree tree, Page page)
{
_env.AssertFlushingNotFailed();
page = page ?? GetReadOnlyPage(num);
if (page.Dirty)
return page;
if (_dirtyPages.Contains(num))
{
page.Dirty = true;
return page;
}
var newPage = AllocatePage(1, PageFlags.None, num); // allocate new page in a log file but with the same number
Memory.Copy(newPage.Base, page.Base, AbstractPager.PageSize);
newPage.LastSearchPosition = page.LastSearchPosition;
newPage.LastMatch = page.LastMatch;
tree.RecentlyFoundPages.Reset(num);
return newPage;
}
示例15: AddMultiValueTree
internal void AddMultiValueTree(Tree tree, MemorySlice key, Tree mvTree)
{
if (_multiValueTrees == null)
_multiValueTrees = new Dictionary<Tuple<Tree, MemorySlice>, Tree>(new TreeAndSliceComparer());
mvTree.IsMultiValueTree = true;
_multiValueTrees.Add(Tuple.Create(tree, key), mvTree);
}