Skip to content

Instantly share code, notes, and snippets.

@mhaemmerle
Created December 10, 2012 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhaemmerle/4249604 to your computer and use it in GitHub Desktop.
Save mhaemmerle/4249604 to your computer and use it in GitHub Desktop.
protocols
(ns example.registry
(:require [zookeeper :as zk]))
(def ^:dynamic *registry* nil)
(defprotocol Registry
(register [this id])
(deregister [this id])
(defrecord InMemoryRegistry [store]
Registry
(register [this id] ...)
(deregister [this id] ...))
(defrecord ZooKeeperRegistry [zk-connection]
Registry
(register [this id] ...)
(deregister [this id] ...))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment