public BTree(Transaction trans, BTreeConfiguration config, int id, IIndexable4 keyHandler , int treeNodeSize) : base(config._idSystem) { _config = config; if (null == keyHandler) { throw new ArgumentNullException(); } _nodeSize = treeNodeSize; _nodeCache = CacheFactory.NewLRUIntCache(config._cacheSize); _halfNodeSize = _nodeSize / 2; _nodeSize = _halfNodeSize * 2; _keyHandler = keyHandler; SetID(id); if (IsNew()) { SetStateDirty(); _root = new BTreeNode(this, 0, true, 0, 0, 0); _root.Write(trans.SystemTransaction()); AddNode(_root); Write(trans.SystemTransaction()); } else { SetStateDeactivated(); } }
protected BTree NewBTree(Transaction systemTrans, int id) { ObjectContainerBase stream = systemTrans.Container(); IIndexable4 indexHandler = IndexHandler(stream); if (indexHandler == null) { return(null); } return(new BTree(systemTrans, id, new FieldIndexKeyHandler(indexHandler))); }
private BTreePointer FirstBTreePointer() { // We don't want nulls included so we have to search for null and use the resulting pointer if we find one. IIndexable4 keyHandler = Btree().KeyHandler(); if (keyHandler is ICanExcludeNullInQueries) { ICanExcludeNullInQueries canExcludeNullInQueries = (ICanExcludeNullInQueries)keyHandler; if (canExcludeNullInQueries.ExcludeNull()) { BTreeNodeSearchResult searchLeaf = Btree().SearchLeafByObject(Transaction(), null , SearchTarget.Highest); BTreePointer pointer = searchLeaf.FirstValidPointer(); if (pointer != null) { return(pointer); } } } return(Btree().FirstPointer(Transaction())); }
public static void DefragIndex(DefragmentContextImpl context, IIndexable4 keyHandler ) { // count int count = context.ReadInt(); // leafByte byte leafByte = context.ReadByte(); bool isLeaf = (leafByte == 1); context.CopyID(); // parent ID context.CopyID(); // previous ID context.CopyID(); // next ID for (int i = 0; i < count; i++) { keyHandler.DefragIndexEntry(context); if (!isLeaf) { context.CopyID(); } } }
public FieldIndexKeyHandler(IIndexable4 delegate_) { _parentIdHandler = new IDHandler(); _valueHandler = delegate_; }
public BTree(Transaction trans, int id, IIndexable4 keyHandler, int nodeSize) : this (trans, BTreeConfiguration.Default, id, keyHandler, nodeSize) { }
public BTree(Transaction trans, BTreeConfiguration config, int id, IIndexable4 keyHandler ) : this(trans, config, id, keyHandler, Config(trans).BTreeNodeSize()) { }
public BTree(Transaction trans, BTreeConfiguration config, IIndexable4 keyHandler ) : this(trans, config, 0, keyHandler) { }
/// <exception cref="System.Exception"></exception> protected override void Db4oSetupBeforeStore() { _handler = new DoubleHandler(); }