@@ -11,10 +11,16 @@ $:
13 search-subscriptions=(map query search-state)
13 search-subscriptions=(map query search-state)
17− [%search query=tape]
19+ :: [%search query=tape]
21+ [%add-peers (set @p)]
19++ rank-results
25++ rank-results
20 |= search-results=(map term (unit (list search-result)))
26 |= search-results=(map term (unit (list search-result)))
@@ -39,6 +45,7 @@ $:
39 ^- task:iris
45 ^- task:iris
40 [%request [%'GET' (crip (url.engine (trip query))) ~ ~] *outbound-config:iris]
46 [%request [%'GET' (crip (url.engine (trip query))) ~ ~] *outbound-config:iris]
41 [%pass ~[%search-result query engine-name] %arvo %i req]
47 [%pass ~[%search-result query engine-name] %arvo %i req]
48+ ++ liveness-interval ~s30
44=/ state *state-0
51=/ state *state-0
@@ -62,7 +69,6 @@ $:
62 search-results.search-state
69 search-results.search-state
63=* sink-for-query
70=* sink-for-query
65− ~& (~(get by search-subscriptions.state) query)
66 [(current-engines query) (search-results query)]
72 [(current-engines query) (search-results query)]
@@ -72,7 +78,9 @@ $:
72%- agent:dbug
78%- agent:dbug
73|_ =bowl:gall
79|_ =bowl:gall
81+ liveness-behn-card [%pass /check-liveness %arvo %b %wait (add now.bowl liveness-interval)]
75−++ on-init `..on-init
82+++ on-init
83+ [~[liveness-behn-card] this]
76++ on-save !>(state)
84++ on-save !>(state)
77++ on-load
85++ on-load
@@ -84,7 +92,18 @@ $:
84++ on-poke
92++ on-poke
86 ^- (quip card:agent:gall _this)
94 ^- (quip card:agent:gall _this)
87− `this
95+ ?> ?=(%noun -.cage)
96+ =/ poke !<(poke +.cage)
99+ [~[liveness-behn-card] this]
101+ `this(peers.state (~(uni in peers.state) +.poke))
89++ on-watch
108++ on-watch
@@ -104,13 +123,22 @@ $:
104 =. search-subscriptions.state
123 =. search-subscriptions.state
105 (~(put by search-subscriptions.state) query subscription)
124 (~(put by search-subscriptions.state) query subscription)
106 [~[flush:(sink query)] this]
125 [~[flush:(sink query)] this]
130+ [%give %fact ~ %noun !>(%pong)]
109:: This was not tested because it requires waiting 12 hours.
137:: This was not tested because it requires waiting 12 hours.
110++ on-leave
138++ on-leave
112− ?+ path !!
140+ ?+ path `this
113− [%search query ~]
141+ [%search query ~]
114 =/ query +<.path
142 =/ query +<.path
116 =/ search-state (~(got by search-subscriptions.state) query)
144 =/ search-state (~(got by search-subscriptions.state) query)
@@ -125,7 +153,17 @@ $:
125++ on-peek
153++ on-peek
128−++ on-agent |=([wire sign:agent:gall] !!)
157+ |= [=wire =sign:agent:gall]
162+ ~& "{<src.bowl>} is alive"
163+ =. alive-peers.state (~(put in alive-peers.state) src.bowl)
129++ on-arvo
167++ on-arvo
130 |= [=wire =sign-arvo]
168 |= [=wire =sign-arvo]
131 ^- (quip card:agent:gall _this)
169 ^- (quip card:agent:gall _this)
@@ -149,6 +187,18 @@ $:
149 =^ card sink (sync:sink (sink-for-query query))
187 =^ card sink (sync:sink (sink-for-query query))
150 ~& (current-engines query)
188 ~& (current-engines query)
151 [~[card] this]
189 [~[card] this]
192+ %+ turn ~(tap in peers.state)
194+ [%pass /alive %agent [peer %seax] %watch /ping]
195+ =. peers.state alive-peers.state
196+ =. alive-peers.state *(set @p)
153++ on-fail
203++ on-fail
154 |= [term =tang]
204 |= [term =tang]