|
|
= Mongoose 0.1.0
A database management system written in Ruby. It has an ActiveRecord-like
interface, uses Skiplists for its indexing, and Marshal for its data
serialization. I named it Mongoose, because, like Rudyard Kipling's
Rikki-Tikki-Tavi, my aim is for it to be small, quick, and friendly.
== Credits
Thanks to Logan Capaldo for letting me steal a lot of the code from KirbyRecord.
Thanks to Ezra Zygmuntowicz and Fabien Franzen, whose ez_where Rails plugin,
provided much of the inspiration for the query language.
Thanks to everyone who gave me feedback on KirbyBase. I have tried to put all
the lessons learned from developing that library to good use here.
== Installation
Unpack the file you downloaded. Execute "ruby setup.rb".
== Features
* Pure Ruby, with no external dependencies.
* ActiveRecord-like interface.
* Fast queries on indexed fields (Up to 10x faster than KirbyBase). Indexes
are Skiplists, which are just plain fun to play around with.
* Not an in-memory database. Data is only read in from disk when needed and
changes are immediately written out to disk.
* In-memory indexes are initialized from dedicated index files, rather than
rebuilt from scratch upon database initialization (like KirbyBase does). This
can greatly reduce startup times.
* Supports any datatype that Marshal supports.
* Table relations supported via has_one, has_many.
== Documentation
Right now, documentation is a little light. It will get better. See the
examples directory for examples of how to use Mongoose. Here's a quick
tutorial:
require 'mongoose'
# Create a class for your table.
class Plane < Mongoose::Table
validates_presence_of :name, :speed
end
# Create a database instance.
db = Mongoose::Database.new
# Create new table. Notice how you specify whether a column is indexed or not.
db.create_table(:plane) do |tbl|
tbl.add_indexed_column(:plane_name, :string)
tbl.add_column(:country, :string)
tbl.add_indexed_column(:speed, :integer)
tbl.add_column(:range, :integer)
end
# Add a record.
rec = Plane.new
rec.plane_name = 'P-51'
rec.country = 'USA'
rec.speed = 402
rec.range = 1205
rec.save
# Various ways to find a record; should be familiar to ActiveRecord users.
Plane.find(1) # Find record with id equal 1.
Plane.find { |plane| plane.speed > 350 } # Find all planes with speed > 350.
Plane.find # Find all records.
Plane.find(:first) { |plane| plane.country == 'USA' }
Plane.find do |plane| # Find all planes from either USA or
plane.any do # Great Britain with speed > 400.
plane.country == 'USA'
plane.country == 'Great Britain'
end
plane.speed > 400
end
# Delete a record.
Plane.find(1).destroy
== Manifest
* README - this file
* install.rb - install script
* changes.txt - history of changes.
* lib directory - dbms module
* test directory - unit tests
* examples directory - many example scripts demonstrating features.
* images directory - images used in manual.
== Author
Written in 2006 by Jamey Cribbs
== License
Mongoose is distributed under the same license as Ruby.
Copyright (c) 2006 Jamey Cribbs
== Warranty
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
== Feedback
Please send any bug reports, suggestions, ideas,
improvements, to:
jcribbs@netpromi.com
== Home Page
http://rubyforge.org/projects/mongoose/
|