Parent

Methods

Class/Module Index [+]

Quicksearch

Backup::Database::Riak

Attributes

name[RW]

Name is the name of the backup

node[RW]

Node is the node from which to perform the backup.

riak_admin_utility[RW]

Path to riak-admin utility (optional)

Public Class Methods

new(model, &block) click to toggle source

Creates a new instance of the Riak adapter object

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

  instance_eval(&block) if block_given?

  @riak_admin_utility ||= utility('riak-admin')
end

Public Instance Methods

perform!() click to toggle source

Performs the riak-admin command and outputs the data to the specified path based on the 'trigger'

# File lib/backup/database/riak.rb, line 39
def perform!
  super
  # have to make riak the owner since the riak-admin tool runs
  # as the riak user in a default setup.
  FileUtils.chown_R('riak', 'riak', @dump_path)

  backup_file = File.join(@dump_path, name)
  run("#{ riakadmin } #{ backup_file } node")

  if @model.compressor
    @model.compressor.compress_with do |command, ext|
      run("#{ command } -c #{ backup_file } > #{ backup_file + ext }")
      FileUtils.rm_f(backup_file)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.