Module: Aqua

Defined in:
lib/aqua.rb,
lib/aqua/object/pack.rb,
lib/aqua/object/stub.rb,
lib/aqua/store/storage.rb,
lib/aqua/object/translator.rb,
lib/aqua/object/initializers.rb,
lib/aqua/object/initializers.rb,
lib/aqua/store/couch_db/server.rb,
lib/aqua/store/couch_db/couch_db.rb,
lib/aqua/store/couch_db/database.rb,
lib/aqua/store/couch_db/result_set.rb,
lib/aqua/store/couch_db/attachments.rb,
lib/aqua/store/couch_db/design_document.rb,
lib/aqua/store/couch_db/storage_methods.rb

Overview

Design documents are responsible for saving views. It is also the place that Aqua will be saving the Class code. There will be one design document per class. There may be additional design documents created without being tied to a class. Don’t know yet.

Defined Under Namespace

Modules: Config, FileInitializations, Initializers, Pack, Query, Store, Tank, Unpack Classes: FileStub, ObjectNotFound, Storage, Stub, Translator

Class Method Summary collapse

Class Method Details

.include_engine(str) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Loads an external engine from a hash of options.



90
91
92
93
94
# File 'lib/aqua.rb', line 90

def self.include_engine( str )
  Aqua::Storage.class_eval do
    include str.constantize
  end
end

.load_internal_engine(str) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Loads an internal engine from a string



81
82
83
84
85
# File 'lib/aqua.rb', line 81

def self.load_internal_engine( str )
  underscored = str.underscore
  require "aqua/store/#{underscored}/#{underscored}"
  include_engine( "Aqua::Store::#{str}::StorageMethods" )
end

.set_storage_engine(engine) ⇒ TrueClass .set_storage_engine(engine_details) ⇒ TrueClass

Loads the requested backend storage engine. Used early on in configuration. If not declared in configuration, will be called automatically with default engine, at runtime, when needed.

Examples:

Internal library loading from a string

Aqua.set_storage_engine( "CouchDB" )

External library loading from a gem. :module argument is the gem’s module responsible for implementing the storage methods

Aqua.set_storage_engine( :require => 'my_own/storage_gem', :module => 'MyOwn::StorageGem::StorageMethods' )

External library loading from a non-gem external library.

Aqua.set_storage_engine( :require => '/absolute/path/to/library', :module => 'My::StorageLib::StorageMethods' )

Overloads:

  • .set_storage_engine(engine) ⇒ TrueClass

    Loads an Aqua internal library.

    Parameters:

    • CamelCase (String)

      string defining the overarching engine type

  • .set_storage_engine(engine_details) ⇒ TrueClass

    Loads any engine provided a path to the self-loading library and the module full name

    Parameters:

    • options (Hash)

      that describe how to find the external library

    Options Hash (engine_details):

    • :require (String)

      The path or gem name used in a require statement

    • :module (String)

      String with the full module name

Returns:

Raises:

  • (ArgumentError)

    when argument is neither a Hash nor a String.



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/aqua.rb', line 65

def self.set_storage_engine( engine="CouchDB" ) 
  if engine.class == String
    load_internal_engine( engine )
    true
  elsif engine.class == Hash
    engine = Mash.new( engine )
    require engine[:require]
    include_engine( engine[:module] )
    true
  else
    raise ArgumentError, 'engine must be a string relating to an internal Aqua library store, or a hash of values indicating where to find the external library'
  end      
end