コード例 #1
0
ファイル: TestODBLazyBTree.cs プロジェクト: ekicyou/pasta
        /// <exception cref="System.Exception"></exception>
        public virtual void Test1a()
        {
            if (!isLocal)
            {
                return;
            }
            string baseName = GetBaseName();

            // Configuration.setInPlaceUpdate(true);
            NeoDatis.Btree.IBTreePersister persister = GetPersister(baseName);
            NeoDatis.Btree.IBTree          tree      = new NeoDatis.Odb.Impl.Core.Btree.ODBBTreeMultiple("test1a"
                                                                                                         , 2, persister);
            for (int i = 0; i < Size; i++)
            {
                tree.Insert(i + 1, "value " + (i + 1));
            }
            // println(new BTreeDisplay().build(tree,true).toString());
            persister.Close();
            persister = GetPersister(baseName);
            tree      = persister.LoadBTree(tree.GetId());
            // println(new BTreeDisplay().build(tree,true).toString());
            AssertEquals(Size, tree.GetSize());
            System.Collections.IEnumerator iterator = tree.Iterator(NeoDatis.Odb.Core.OrderByConstants
                                                                    .OrderByAsc);
            int j = 0;

            while (iterator.MoveNext())
            {
                object o = iterator.Current;
                AssertEquals("value " + (j + 1), o);
                j++;
                if (j == Size)
                {
                    AssertEquals("value " + Size, o);
                }
            }
            persister.Close();
            DeleteBase(baseName);
        }
コード例 #2
0
 public BTreeMultipleValuesPerKey(string name, int degree, NeoDatis.Btree.IBTreePersister
                                  persister) : base(name, degree, persister)
 {
 }
コード例 #3
0
ファイル: TestODBLazyBTree.cs プロジェクト: ekicyou/pasta
        /// <exception cref="System.Exception"></exception>
        public virtual void Test2a()
        {
            if (!isLocal)
            {
                return;
            }
            string baseName = GetBaseName();

            NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.ResetNbUpdates();
            // LogUtil.allOn(true);
            DeleteBase(baseName);
            NeoDatis.Btree.IBTreePersister            persister = GetPersister(baseName);
            NeoDatis.Btree.IBTreeMultipleValuesPerKey tree      = new NeoDatis.Odb.Impl.Core.Btree.ODBBTreeMultiple
                                                                      ("test2a", 20, persister);
            long start0 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            for (int i = 0; i < Size; i++)
            {
                tree.Insert(i + 1, "value " + (i + 1));
            }
            // println("Commiting");
            persister.Close();
            long end0 = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();

            // println("insert of "+SIZE+" elements in BTREE = " +
            // (end0-start0)+"ms");
            // println("end Commiting");
            // println("updates : IP="+ObjectWriter.getNbInPlaceUpdates()+" , N="+ObjectWriter.getNbNormalUpdates());
            // ODB odb = open(baseName);
            // odb.getObjects(LazyNode.class);
            // odb.close();
            persister = GetPersister(baseName);
            // println("reloading btree");
            tree = (NeoDatis.Btree.IBTreeMultipleValuesPerKey)persister.LoadBTree(tree.GetId(
                                                                                      ));
            // println("end reloading btree , size="+tree.size());
            AssertEquals(Size, tree.GetSize());
            long totalSearchTime = 0;
            long oneSearchTime   = 0;
            long minSearchTime   = 10000;
            long maxSearchTime   = -1;

            for (int i = 0; i < Size; i++)
            {
                long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
                System.Collections.IList o = tree.Search(i + 1);
                long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
                AssertEquals("value " + (i + 1), o[0]);
                oneSearchTime = (end - start);
                // println("Search time for "+o+" = "+oneSearchTime);
                if (oneSearchTime > maxSearchTime)
                {
                    maxSearchTime = oneSearchTime;
                }
                if (oneSearchTime < minSearchTime)
                {
                    minSearchTime = oneSearchTime;
                }
                totalSearchTime += oneSearchTime;
            }
            persister.Close();
            // println("total search time="+totalSearchTime +
            // " - mean st="+((double)totalSearchTime/SIZE));
            // println("min search time="+minSearchTime + " - max="+maxSearchTime);
            // Median search time must be smaller than 1ms
            DeleteBase(baseName);
            AssertTrue(totalSearchTime < 1 * Size);
        }
コード例 #4
0
 public InMemoryBTreeSingleValuePerKey(string name, int degree, NeoDatis.Btree.IBTreePersister
                                       persister) : base(name, degree, persister)
 {
 }
コード例 #5
0
 public ODBBTreeSingle(string name, int degree, NeoDatis.Btree.IBTreePersister persister
                       ) : base(name, degree, persister)
 {
 }