Module: Blobby

Defined in:
lib/blobby.rb,
lib/blobby/version.rb,
lib/blobby/http_store.rb,
lib/blobby/logging_store.rb,
lib/blobby/abstract_store.rb,
lib/blobby/key_constraint.rb,
lib/blobby/composite_store.rb,
lib/blobby/in_memory_store.rb,
lib/blobby/filesystem_store.rb,
lib/blobby/fake_success_store.rb,
lib/blobby/key_transforming_store.rb

Overview

BLOB storage.

Defined Under Namespace

Modules: KeyConstraint Classes: AbstractStore, CompositeStore, FakeSuccessStore, FilesystemStore, HttpStore, InMemoryStore, KeyTransformingStore, LoggingStore

Constant Summary collapse

VERSION =
"1.1.1"

Class Method Summary collapse

Class Method Details

.register_store_factory(uri_scheme, factory) ⇒ Object



29
30
31
# File 'lib/blobby.rb', line 29

def register_store_factory(uri_scheme, factory)
  store_factories[uri_scheme] = factory
end

.store(uri) ⇒ Object

Instantiate a BLOB-store based on a storage-address URI. An appropriate store impementation will be selected, based on URI-scheme.

Parameters:

  • uri (URI)

    storage address



21
22
23
24
25
26
27
# File 'lib/blobby.rb', line 21

def store(uri)
  uri = URI(uri)
  factory = store_factories[uri.scheme]
  fail ArgumentError, "unknown store type: #{uri}" if factory.nil?

  factory.from_uri(uri)
end