module Etcdist

The Etcdist name space

Constants

VERSION

Public Class Methods

execute(dir, opts = {}) click to toggle source

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)

# File lib/etcdist.rb, line 16
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