Parent

OpenShift::Runtime::Frontend::Http::Plugins::GearDBPlugin

The GearDBPlugin class is used to store a quick lookup table for uuid => fqdn. At least one plugin must define the "lookup" and "all" functions.

Public Class Methods

all() click to toggle source
# File lib/openshift/runtime/frontend/http/plugins/apachedb.rb, line 341
def self.all
  Enumerator.new do |yielder|
    GearDB.open(GearDB::READER) do |d|
      d.each do |uuid, config|
        c = self.new(uuid, config["fqdn"], config["container_name"], config["namespace"])
        yielder.yield(c)
      end
    end
  end
end
lookup_by_fqdn(fqdn) click to toggle source
# File lib/openshift/runtime/frontend/http/plugins/apachedb.rb, line 332
def self.lookup_by_fqdn(fqdn)
  GearDB.open(GearDB::READER) do |d|
    d.select { |k,v| v["fqdn"] == fqdn }.each do |k,v|
      return self.new(k, v["fqdn"], v["container_name"], v["namespace"])
    end
  end
  nil
end
lookup_by_uuid(container_uuid) click to toggle source
# File lib/openshift/runtime/frontend/http/plugins/apachedb.rb, line 322
def self.lookup_by_uuid(container_uuid)
  GearDB.open(GearDB::READER) do |d|
    config = d[container_uuid]
    if config
      return self.new(container_uuid, config["fqdn"], config["container_name"], config["namespace"])
    end
  end
  nil
end
purge_by_fqdn(fqdn) click to toggle source
# File lib/openshift/runtime/frontend/http/plugins/apachedb.rb, line 314
def self.purge_by_fqdn(fqdn)
  GearDB.open(GearDB::WRCREAT) { |d| d.delete_if { |k, v| v["fqdn"] == fqdn } }
end
purge_by_uuid(uuid) click to toggle source
# File lib/openshift/runtime/frontend/http/plugins/apachedb.rb, line 310
def self.purge_by_uuid(uuid)
  GearDB.open(GearDB::WRCREAT) { |d| d.delete(uuid) }
end

Public Instance Methods

create() click to toggle source
# File lib/openshift/runtime/frontend/http/plugins/apachedb.rb, line 300
def create
  GearDB.open(GearDB::WRCREAT) do |d|
    d.store(@container_uuid, {
              'fqdn' => @fqdn,
              'container_name' => @container_name,
              'namespace' => @namespace
            })
  end
end
destroy() click to toggle source
# File lib/openshift/runtime/frontend/http/plugins/apachedb.rb, line 318
def destroy
  self.class.purge_by_uuid(@container_uuid)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.