My btree is written almost completely in Ruby.  I created several small C 
functions to make searching faster.  The C functions are only needed if 
want a little better performance.  My btree basically reads and writes 
records to and from files.  I believe that Libdb-ruby allows you to use 
BerkeleyDB to also read and write records.  BerkeleyDB is written in C.  I 
know very little about BerkeleyDB but I believe it provides a lot of 
database type stuff like transaction support in addition to reading and 
writing records.  BerkeleyDB is closer to a real database than my btree is. 
 I don't feel that BerkeleyDB has all of the features of a real database 
server like PostgreSQL.  If all you need to do is quickly read and write a 
lot of records, then using my btree will be an alternative choice to using 
BerkeleyDB.  Here are some of the features of my btree:

- it is thread safe
- it allows multiple concurrent readers (using Ruby threads)
- it allows one concurrent writer that does not block readers (unless a 
page needs to be split or deleted)
- a btree can span many files
- many btrees can reside in the same file

The btree is a by-product of a database server I am working on.  The 
database server is written completely in Ruby.  The database server uses my 
btree to read and write records.  I am creating the database server in 
layers such that each layer can be used as independent, stand-alone 
modules.  The btree is one of several stand-alone modules that I have 
created to support the database server.

Why write another database server when there are other great choices like 
BerkeleyDB and PostgreSQL?  Because I love Ruby, I felt that Ruby had all 
of the needed components to easily create one, and I choose this as my 
first Ruby project.  So far, getting the btree to work efficiently in Ruby 
has been the only difficult challenge.

-----Original Message-----
From:	Ned Konz [SMTP:ned / whidbey.net]
Sent:	Sunday, July 22, 2001 10:03 AM
To:	ruby-talk ML; undisclosed-recipients: ;
Subject:	[ruby-talk:18296] RE:  Effecient indexing algorithm

Michael Davis wrote:

> I am planning to release my version of a btree written in Ruby sometime
> next week.  It will allow you to store terabytes of data across multiple
> files and should allow you to quickly retrieve that data.  I have the 
code
> written and tested.  I just need to revise my test scripts and complete
> the documentation.

How does this compare to libdb-ruby, which is a Ruby interface for the
BerkeleyDB?