Module: Visor::Image::Store

Extended by:
Store
Includes:
Common::Exception
Included in:
Store
Defined in:
lib/image/store/store.rb,
lib/image/store/s3.rb,
lib/image/store/hdfs.rb,
lib/image/store/http.rb,
lib/image/store/walrus.rb,
lib/image/store/cumulus.rb,
lib/image/store/lunacloud.rb,
lib/image/store/file_system.rb

Overview

Visor Image System (VIS) Store module. This module encapsulates all store backend classes, plus a set of utility methods common to all stores.

Defined Under Namespace

Classes: Cumulus, FileSystem, HDFS, HTTP, Lunacloud, S3, Walrus

Constant Summary collapse

BACKENDS =

Base API mapping for the multiple storage backend classes

{:s3        => Visor::Image::Store::S3,
:cumulus   => Visor::Image::Store::Cumulus,
:walrus    => Visor::Image::Store::Walrus,
:lunacloud => Visor::Image::Store::Lunacloud,
:hdfs      => Visor::Image::Store::HDFS,
:file      => Visor::Image::Store::FileSystem,
:http      => Visor::Image::Store::HTTP}

Instance Method Summary collapse

Instance Method Details

#get_backend(string, config) ⇒ Object

Get a store backend class object ready to use, based on a file URI or store name.

Parameters:

  • string (String)

    The file location URI or backend name.

  • config (Hash)

    A set of configurations for the wanted store, loaded from VISoR configuration file.

Returns:

  • (Object)

    An instantiated store object ready to use.

Raises:

  • (UnsupportedStore)


30
31
32
33
34
35
# File 'lib/image/store/store.rb', line 30

def get_backend(string, config)
  name  = URI(string).scheme || string
  store = BACKENDS[name.to_sym]
  raise UnsupportedStore, "The store '#{name}' is not supported" unless store
  store.new(string, config)
end