Methods

Class/Module Index [+]

Quicksearch

Backup::Database::MongoDB

Attributes

additional_options[RW]

Additional "mongodump" options

host[RW]

Connectivity options

ipv6[RW]

IPv6 support (disabled by default)

lock[RW]

'lock' dump meaning wrapping mongodump with fsync & lock

mongo_utility[RW]

Path to the mongo utility (optional)

mongodump_utility[RW]

Path to the mongodump utility (optional)

name[RW]

Name of the database that needs to get dumped

only_collections[RW]

Collections to dump, collections that aren't specified won't get dumped

password[RW]

Credentials for the specified database

port[RW]

Connectivity options

username[RW]

Credentials for the specified database

Public Class Methods

new(model, &block) click to toggle source

Creates a new instance of the MongoDB database object

# File lib/backup/database/mongodb.rb, line 48
def initialize(model, &block)
  super(model)

  @only_collections   ||= Array.new
  @additional_options ||= Array.new
  @ipv6               ||= false
  @lock               ||= false

  instance_eval(&block) if block_given?

  @mongodump_utility  ||= utility(:mongodump)
  @mongo_utility      ||= utility(:mongo)
end

Public Instance Methods

perform!() click to toggle source

Performs the mongodump command and outputs the data to the specified path based on the 'trigger'. If the user hasn't specified any specific collections to dump, it'll dump everything. If the user has specified collections to dump, it'll loop through the array of collections and invoke the 'mongodump' command once per collection

# File lib/backup/database/mongodb.rb, line 68
def perform!
  super

  lock_database if @lock
  @only_collections.empty? ? dump! : specific_collection_dump!

rescue => err
  raise Errors::Database::MongoDBError.wrap(err, 'Database Dump Failed!')
ensure
  unlock_database if @lock
  package! unless err
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.