How to use BTree

ar
2001-05-26
2001-06-03
  • ar
    ar
    2001-05-26

      Hi! I am now developing a P2P BBS System on the Source Forge, and begin to use the JDBM library.

      But I don't know how to use BTree as a persistent object. I tested FamousPeople.java twice. In the second test, some keys were changed (eg. "Greenspan, Alan" -> "Greenspan, Bill") but I can't see the first tested keys....

      I guess BTree.load method works as a existing data loader, but I don't get how to use the method....

      Please help me....

     
    • Alex Boisvert
      Alex Boisvert
      2001-05-30

      The reason you're not seeing the keys inserted in the first run is that the example doesn't use the same BTree instance.  It creates a new one every time it's run.  (See the explicit comment in the code).

      If you want to use the same BTree instance, you'll have to use RecordManager.setNamedObject(...)  and RecordManager.getNamedObject().

      Let me know if you'd like an example of this.

      regards,
      alex

       
    • ar
      ar
      2001-06-03

      hi! alex!

      I tried to use RecordManager.setNamedObject(...) and RecordManager.getNamedObject(), but I could not get the same BTree instance. I don't know how to use the two methods...

      Could you show me a small example if you don't care.

      Regards.

       
      • Alex Boisvert
        Alex Boisvert
        2001-06-03

        I've updated the FamousPeople example in CVS to reuse the same B+Tree.

        Some minor changes were made to the API so I recommend you recompile JDBM if you try to use the updated example.  A new release will follow shortly, after I'm done with some cleaning of the APIs.

        regards,
        alex.