Module: Etcdist

Defined in:
lib/etcdist.rb,
lib/etcdist/log.rb,
lib/etcdist/reader.rb,
lib/etcdist/writer.rb,
lib/etcdist/version.rb

Overview

The Etcdist name space

Defined Under Namespace

Classes: Log, Reader, Writer

Constant Summary collapse

VERSION =
'0.0.7'

Class Method Summary collapse

Class Method Details

.execute(dir, opts = {}) ⇒ Object

Main entry point to read data from F/S and write into etcd.

Parameters:

  • dir (String)

    The path to the data directory

  • opts (Hash) (defaults to: {})

    Options



16
17
18
19
20
21
22
23
24
25
# 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