Last Updated: 9/25/2001
Documentation for ArunaDB
ArunaDB or Aruna DataBase is a database server written almost purely in Ruby. ArunaDB consists of three sets of Ruby classes. The first set of classes are utilities such as a btree, filestore, catalog etc. These classes provide low-level support for ArunaDB. The second set of classes allow you to embed ArunaDB into your Ruby programs by providing support for columns, tables, indexes, views, etc. The third set of classes are is called the ArunaDB Database Server and include classes for a server and many clients. These classes will include support for many current users and SQL support. The embedded portion of ArunaDB supports multiple threads but your Ruby program must create and manage those threads. The ArunaDB database server will provide a mechanism for multiple users to connect to an ArunaDB data server at the same time. The ArunaDB database server has not been created yet. The ArunaDB Embedded classes are working but need more documentation and testing. The ArunaDB Utilites are working great.
ArunaDB requires the
Ruby programming language. You must download and install Ruby separately. ArunaDB has been tested with Ruby 1.6.4 (and current Ruby source) on linux Red Hat 6.2, FreeBSD 4.3 and Windows 2000/95 using cygwin.
I am a software developer trying to earn a living at creating software. I am currently investing a lot of time (and some money) into this project. Please help support this project when and where you can. For more information on helping out please visit
pleasehelp.html.
History of ArunaDB
Summary of Errors Used by ArunaDB
ArunaDB Utilities:
These are classes that I created to support ArunaDB. Several are very useful and could be used for other things besides ArunaDB. Here are the more significant classes:
A_BTree - This class is an n'ary tree or b*tree written in Ruby. This class quickly stores and retrieves lots of key/value pairs (also called records). This is found in a_btree.rb.
A_FileStore - This class provides all File I/O for the A_BTree class. It allows you to group many physical files as a single file. It allows to limit the the total amout of disk space used by each file.
A_Catalog - This class is a cross between Hash and PStore. It is good for persistent store of objects. A_BTree and A_FileStore use this class to store information about existing filestores and btrees. This is the system catalog for ArunaDB.
A_Buffer - This class stores and retrieves key/value pairs using a fixed length buffer. Key/value pairs are Marshal.dumped into the buffer and Marshal.loaded out of the buffer. A_BTree uses this class to read and write pages of key/value pairs.
A_FileSort - This sorts large amounts of data. You put data in and iterate over that data after it is sorted. This class allows you to define how much memory is used for sorting. If all data fits in that memory, then the data is put in an array and sorted using Array.sort. If the data is to large to fit in the memory size, it is written to disk in chunks until a chunk will fit in memory and can be sorted.
A_TempFile - This allows you to collect data and put it in a tempfile and then iterate over the data in the temp file. This works just like the A_FileSort class in that it allows you to specify how much memory to use and when the data is larger than the memory, it is written to disk.
ArunaDB Embedded classes:
The ArunaDB Embedded classes allow you to embed an ArunaDB database into your Ruby programs. Many useful methods and classes are provided to help you effectively manage your data. Here are the more significant classes:
A_Column - This class defines column attributes and constraints for the A_Table class.
A_Table_Data - The class is a glorified array. It is basically an array of A_Column objects and array of data for the A_Column objects. It is yielded by all iterators in the A_Table, A_Index, and A_View classes. This class allows you to reference the data by column name.
A_Transaction - The class add support for begin, commit, and rollback. You begin a transaction, perform A_Table inserts, updates, and deletes, and commit or rollback the transaction. If a transaction is rolled back, then the tables are not updated. A single transactions can spans tables. You can have multiple active transactions at the same time but they can't overlap. In other words if transaction 1 updates record A in table T1, then transaction 2 will raise an error if it attempts to update record A in table T1. You can iterate over tables both inside the transaction and outside the transaction. When iterating inside the transaction, you will see all inserts/updates/deleted done to the table by this transaction. When iterating outside the transaction, you will not see any inserts/updated/deletes performed by any transaction. When need the best possible performance, you can begin a transactions that disablea all constraint checking and inserts directly into the table (rollbacks and commits are disabled because the table is update directly).
A_Table - The class allows you to insert, update, delete, and iterator over collections of columns. Triggers, and transactions are supported.
A_Index - This class allows you to create an index on one or more columns in an A_Table. This class allows you to create alternative ways to quickly iterate over data in tables.
A_View - This class provides a frame work for creating views. A view is basically a method that iterates over one or more tables and yields one or more columns from each of those tables. I provided examples on how to create views that perform inner and outer joins on tables.
A_Sequences - This class allows you to create numeric columns in a table that are automatically incremented. This class is very useful if the primary key in a table is a number. This class is similar to a sequence in Oracle and a Serial in PostgreSQL.
ArunaDB Database Server:
The ArunaDB database server is not written yet. It is next on my list of things to do. When written, it will consist of an A_Database class for the server and the client. These classes will allow you to start a server on one machine and connect to that server from many other servers. This class will also provide support for user passwords, security, permissions, etc.