module Polipus::Storage

Constants

COLLECTION

Public Class Methods

dev_null() click to toggle source
# File lib/polipus/storage.rb, line 21
def self.dev_null
  require 'polipus/storage/dev_null'
  self::DevNull.new
end
memory_store() click to toggle source
# File lib/polipus/storage.rb, line 26
def self.memory_store
  require 'polipus/storage/memory_store'
  self::MemoryStore.new
end
mongo_store(mongo = nil, collection = COLLECTION, except = []) click to toggle source
# File lib/polipus/storage.rb, line 7
def self.mongo_store(mongo = nil, collection = COLLECTION, except = [])
  require 'polipus/storage/mongo_store'
  mongo ||= Mongo::Connection.new('localhost', 27_017, pool_size: 15, pool_timeout: 5).db('polipus')
  fail 'First argument must be an instance of Mongo::DB' unless mongo.is_a?(Mongo::DB)
  self::MongoStore.new(mongo: mongo, collection: collection, except: except)
end
rethink_store(conn = nil, table = COLLECTION, except = []) click to toggle source
# File lib/polipus/storage.rb, line 14
def self.rethink_store(conn = nil, table = COLLECTION, except = [])
  require 'polipus/storage/rethink_store'
  conn ||= RethinkDB::RQL.new.connect(host: 'localhost', port: 28_015, db: 'polipus' )
  fail "First argument must be a RethinkDB::Connection, got `#{conn.class}`" unless conn.is_a?(RethinkDB::Connection)
  self::RethinkStore.new(conn: conn, table: table,  except: except)
end