本文整理汇总了C#中Voron.Trees.Tree类的典型用法代码示例。如果您正苦于以下问题:C# Tree类的具体用法?C# Tree怎么用?C# Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tree类属于Voron.Trees命名空间,在下文中一共展示了Tree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Searcher
public Searcher(FullTextIndex index)
{
_index = index;
_tx = _index.StorageEnvironment.NewTransaction(TransactionFlags.Read);
_docs = _tx.ReadTree("Docs");
}
开发者ID:votrongdao,项目名称:Corax,代码行数:7,代码来源:Searcher.cs
示例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();
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:25,代码来源:PageSplitter.cs
示例3: StorageEnvironmentState
public StorageEnvironmentState(Tree freeSpaceRoot, Tree root, long nextPageNumber)
{
if (freeSpaceRoot != null)
FreeSpaceRoot = freeSpaceRoot.State;
if (root != null)
Root = root.State;
NextPageNumber = nextPageNumber;
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:8,代码来源:StorageEnvironmentState.cs
示例4: ParentPageAction
public ParentPageAction(Page parentPage, Page currentPage, Tree tree, Cursor cursor, Transaction tx)
{
_parentPage = parentPage;
_currentPage = currentPage;
_tree = tree;
_cursor = cursor;
_tx = tx;
}
开发者ID:IdanHaim,项目名称:ravendb,代码行数:8,代码来源:ParentPageAction.cs
示例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);
}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:10,代码来源:TreeIterator.cs
示例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;
}
开发者ID:votrongdao,项目名称:Corax,代码行数:12,代码来源:TermQuery.cs
示例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);
}
开发者ID:votrongdao,项目名称:Corax,代码行数:14,代码来源:PhraseQuery.cs
示例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;
}
开发者ID:paulcbetts,项目名称:ravendb,代码行数:16,代码来源:Tree.cs
示例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;
}
开发者ID:jesuslpm,项目名称:ravendb,代码行数:17,代码来源:Tree.cs
示例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;
}
开发者ID:cocytus,项目名称:ravendb,代码行数:14,代码来源:Deletes.cs
示例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);
}
开发者ID:randacc,项目名称:ravendb,代码行数:13,代码来源:StorageTest.cs
示例12: StorageEnvironmentState
public StorageEnvironmentState(Tree freeSpaceRoot, Tree root, long nextPageNumber)
{
FreeSpaceRoot = freeSpaceRoot;
Root = root;
NextPageNumber = nextPageNumber;
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:6,代码来源:StorageEnvironmentState.cs
示例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);
}
开发者ID:GorelH,项目名称:ravendb,代码行数:8,代码来源:Transaction.cs
示例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;
}
开发者ID:GorelH,项目名称:ravendb,代码行数:23,代码来源:Transaction.cs
示例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);
}
开发者ID:GorelH,项目名称:ravendb,代码行数:7,代码来源:Transaction.cs
示例16: UpdateRootsIfNeeded
internal void UpdateRootsIfNeeded(Tree root, Tree freeSpace)
{
//can only happen during initial transaction that creates Root and FreeSpaceRoot trees
if (State.Root == null && State.FreeSpaceRoot == null)
{
State.Root = root;
State.FreeSpaceRoot = freeSpace;
}
}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:9,代码来源:Transaction.cs
示例17: TreeRebalancer
public TreeRebalancer(Transaction tx, Tree tree, Cursor cursor)
{
_tx = tx;
_tree = tree;
_cursor = cursor;
}
开发者ID:VPashkov,项目名称:ravendb,代码行数:6,代码来源:TreeRebalancer.cs
示例18: ReadIsTopologyChanged
private static long ReadIsTopologyChanged(Tree metadata)
{
var readResult = metadata.Read("current-topology-index");
if (readResult == null)
return -1;
return readResult.Reader.ReadLittleEndianInt64();
}
开发者ID:Degot,项目名称:Rhino.Raft,代码行数:8,代码来源:PersistentState.cs
示例19: GetLastEntryNumber
private static long GetLastEntryNumber(Tree logs, Transaction tx)
{
long lastEntry;
var lastKey = logs.LastKeyOrDefault();
if (lastKey != null)
{
lastEntry = lastKey.CreateReader().ReadBigEndianInt64();
}
else
{
var metadata = tx.ReadTree(MetadataTreeName);
// maybe there is a snapshot?
var snapshotIndex = metadata.Read("snapshot-index");
if (snapshotIndex != null)
lastEntry = snapshotIndex.Reader.ReadLittleEndianInt64();
else
lastEntry = 0;
}
return lastEntry;
}
开发者ID:Degot,项目名称:Rhino.Raft,代码行数:20,代码来源:PersistentState.cs
示例20: AddOverflows
private OverflowsAddResult AddOverflows(Transaction tx, Tree tree, int treeNumber, Random r)
{
var minOverflowSize = AbstractPager.NodeMaxSize - Constants.PageHeaderSize + 1;
var entriesAdded = new List<string>();
var overflowsAdded = 0;
for (int j = 0; j < treeNumber; j++)
{
var overflowSize = r.Next(minOverflowSize, 10000);
string key = "overflow_" + j;
tree.Add(key, new MemoryStream(new byte[overflowSize]));
entriesAdded.Add(key);
overflowsAdded += tx.DataPager.GetNumberOfOverflowPages(overflowSize);
}
return new OverflowsAddResult
{
AddedEntries = entriesAdded,
NumberOfOverflowPages = overflowsAdded
};
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:22,代码来源:StorageReportGenerationTests.cs
注:本文中的Voron.Trees.Tree类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论