Sha256: cb22f0b4aaa2bbe98a6c49776fc14965fefb7008aca1fbc3c74f646ec2d3a7ed

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

# Encoding: utf-8

require 'timeout'

module Etcd
  module Mod
    module Leader

      def mod_leader_endpoint
        '/mod/v2/leader'
      end

      def set_leader(key, value, ttl)
        path = mod_leader_endpoint + "#{key}?ttl=#{ttl}"
        api_execute(path, :put, params:{name: value}).body
      end

      def get_leader(key)
        api_execute(mod_leader_endpoint + key, :get).body
      end

      def delete_leader(key, value)
        path = mod_leader_endpoint + key + '?' + URI.encode_www_form(name: value)
        api_execute(path, :delete).body
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
etcd-0.2.0.alpha lib/etcd/mod/leader.rb