Class: Caster::MetadataDatabase

Inherits:
Object
  • Object
show all
Includes:
MetadataStore
Defined in:
lib/caster/metadata/metadata_database.rb

Instance Method Summary collapse

Constructor Details

#initializeMetadataDatabase

Returns a new instance of MetadataDatabase.



10
11
12
# File 'lib/caster/metadata/metadata_database.rb', line 10

def initialize
  @metadb = CouchRest.database! "http://#{Caster.config['host']}:#{Caster.config['port']}/#{Caster.config['metadata']['database']}"
end

Instance Method Details

#descObject



14
15
16
# File 'lib/caster/metadata/metadata_database.rb', line 14

def desc
  'external database'
end

#get_db_version(database) ⇒ Object



18
19
20
# File 'lib/caster/metadata/metadata_database.rb', line 18

def get_db_version database
  get_metadoc(@metadb)[database] rescue nil
end

#save_db_version(database, version) ⇒ Object



22
23
24
25
26
# File 'lib/caster/metadata/metadata_database.rb', line 22

def save_db_version database, version
  metadoc = get_metadoc(@metadb)
  metadoc[database] = version
  @metadb.save_doc metadoc
end