Created
May 31, 2011 01:48
-
-
Save hugoduncan/999745 to your computer and use it in GitHub Desktop.
Cluster-spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn cluster-spec | |
"Create a cluster-spec. | |
`name` is used as a prefix for all groups in the cluster. | |
- :groups specify a sequence of groups that define the cluster | |
- :extends specify a server-spec, a group-spec, or sequence thereof, | |
for all groups in the cluster | |
- :phases define phases on all groups. | |
- :node-spec default node-spec for the nodes in the cluster | |
- :roles roles for the group-spec" | |
[cluster-name | |
& {:keys [extends groups phases node-spec] :as options}] | |
(-> | |
options | |
(update-in [:groups] | |
(fn [group-specs] | |
(map | |
(fn [group-spec] | |
(-> | |
node-spec | |
(merge (dissoc group-spec :phases)) | |
(update-in | |
[:group-name] | |
#(keyword (str (name cluster-name) "-" (name %)))) | |
(extend-specs extends) | |
(extend-specs [{:phases phases}]) | |
(extend-specs [(select-keys group-spec [:phases])]))) | |
group-specs))) | |
(dissoc :extends :node-spec) | |
(assoc :cluster-cluster-name (keyword cluster-name)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment