Sha256: 92cc05783b594105ac7b2d386f2d45621963180bda30aaff6cf0114e860e29bd

Contents?: true

Size: 941 Bytes

Versions: 5

Compression:

Stored size: 941 Bytes

Contents

# coding: utf-8

# Base Splash module
module Splash

  # module for Configuration utilities
  module ConfigUtilities
    include Splash::Constants

    # clean backend action method
    # @param [Hash] options
    # @option options [Symbol] :name the name of the backend (:redis, :file)
    # @return [Hash] An Exiter case hash (:quiet_exit or :configuration_error)
    def flush_backend(options ={})
      config = get_config
      self.extend Splash::Backends
      self.extend Splash::Loggers
      log = get_logger
      name  = (options[:name])? options[:name].to_sym : :execution_trace
      log.info "Splash backend #{name.to_s} flushing"
      backend = get_backend name
      if backend.flush then
        return { :case => :quiet_exit, :more => "Splash backend #{name.to_s} flushed" }
      else
        return { :case => :configuration_error, :more => "Splash backend #{name.to_s} can't be flushed" }
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
prometheus-splash-0.9.1 lib/splash/config/flush.rb
prometheus-splash-0.9.0 lib/splash/config/flush.rb
prometheus-splash-0.8.6 lib/splash/config/flush.rb
prometheus-splash-0.8.5 lib/splash/config/flush.rb
prometheus-splash-0.8.4 lib/splash/config/flush.rb