-
Notifications
You must be signed in to change notification settings - Fork 0
/
catalog.clj
75 lines (60 loc) · 2.17 KB
/
catalog.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
(ns consul.proto.catalog
"Interface to com.orbitz.consul.CatalogClient.
Many API calls in ICatalog return a response map, which contains
keys :index, :knownLeader, :lastContact, and :response. The
:response key maps the return value of each call.
API calls that take query option arguments may take either a
com.orbitz.consul.options.QueryOptions instance, or a map
spec containing keys:
* :wait
* :token
* :index
* :near
* :datacenter
* :node-meta
* :tags
* :consistency-mode")
(defprotocol ICatalog
(datacenters [this]
"Return a list of datacenter strings.")
(nodes [this] [this opts]
"Return a list of nodes connected to this agent.
The response the list of nodes, each a map giving the node info.
The opts argument may be a com.orbitz.consul.options.QueryOptions
instance, or a map spec of the same.")
(services [this] [this opts]
"Return a list of services known to this agent.
The response is a map of service names to lists of tags.
The opts argument may be a com.orbitz.consul.options.QueryOptions
instance, or a map spec of the same.")
(service [this service-name] [this service-name opts]
"Return info about a service.
The result is a list of service catalog entries.
The opts argument may be a com.orbitz.consul.options.QueryOptions
instance, or a map spec of the same.")
(node [this node-name] [this node-name opts]
"Return info about a node.
The result is a map containing info about the node, and services
known about this node.")
(register! [this args] [this args opts]
"Register a node with the catalog.
The args argument can either be an instance of
com.orbitz.consul.model.catalog.CatalogRegistration, or a map
spec containing keys:
* :datacenter
* :node
* :address
* :tagged-addresses
* :service
* :check
* :write-request")
(deregister! [this args] [this args opts]
"Deregister a node from the catalog.
The args argument can either be an instance of
com.orbitz.consul.model.catalog.CatalogDeregistration, or a map
spec containing keys:
* :datacenter
* :node
* :check-id
* :service-id
* :write-request"))