Sha256: d7f1cadefb2bed59a75461356b45430b87a8b9eea01596b1c5fd1639033317f6

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

require 'etcd'
require 'etcdist/log'
require 'etcdist/reader'
require 'etcdist/writer'

# The Etcdist name space
module Etcdist
  Log.level = :info

  # Main entry point to read data from F/S and write into etcd.
  #
  # @param [String] dir The path to the data directory
  # @param [Hash] opts Options
  # @opts [String] :host IP address of the etcd server (default 127.0.0.1)
  # @opts [Fixnum] :port Port number of the etcd server (default 4001)
  def self.execute(dir, opts = {})
    etcd = Etcd::Client.new(opts)
    reader = Etcdist::Reader.new(dir)
    writer = Etcdist::Writer.new(etcd, opts)

    Log.info("using etcd host at: #{etcd.host}:#{etcd.port}")
    writer.write(reader.read)
    writer.delete_absent_directories(reader.all_dirs)
    Log.info('finished successfully.')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
etcdist-0.0.8 lib/etcdist.rb
etcdist-0.0.7 lib/etcdist.rb