A Redleaf::Store that uses Redland’s ‘hashes’ store. This store “provides indexed storage using Redland Triple stores to store various combinations of subject, predicate and object for faster access.“
This store comes in two flavors: the in-memory store, and bdb file storage.
$Id$
Copyright © 2008-2009, Michael Granger All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SVN Revision
SVN Id
Default options hash
Load the BDB-backed Redleaf::HashesStore from the specified path.
# File lib/redleaf/store/hashes.rb, line 54 54: def self::load( path, options={} ) 55: options.merge!( :new => false ) 56: return new( path, options ) 57: end
Create a new Redleaf::HashesStore, optionally enabling contexts.
# File lib/redleaf/store/hashes.rb, line 92 92: def initialize( name=nil, options={} ) 93: name, opts = self.class.normalize_options( name, options ) 94: opthash = DEFAULT_OPTIONS.merge( opts ) 95: 96: @hash_type = opthash[:hash_type] 97: 98: return super( name.to_s, opthash ) 99: end
Normalize options into a options has that is appropriate for Redland given an optional name path. Returns an array of name and a normalized options hash.
# File lib/redleaf/store/hashes.rb, line 62 62: def self::normalize_options( name=nil, options={} ) 63: if name.is_a?( Hash ) 64: options.merge!( name ) 65: name = nil 66: end 67: 68: if name.nil? 69: raise Redleaf::Error, "You must specify a name argument for the bdb hash type." if 70: options[:hash_type] == :bdb 71: options[:hash_type] = :memory 72: 73: elsif options[:hash_type] != :memory 74: path = Pathname.new( options[:dir] || '.' ) + Pathname.new( name ) 75: 76: options[:dir] = path.dirname.to_s 77: options[:hash_type] = :bdb 78: name = path.basename.to_s 79: end 80: 81: Redleaf.logger.debug "Constructing a %p with name = %p, options = %p" % 82: [ self.name, name, options ] 83: return name, options 84: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.