@@ -49,18 +49,8 @@ type stat struct {
49
49
DeleteAffectedRows sync2.AtomicUint64
50
50
DeleteQueries sync2.AtomicUint64
51
51
DeleteQueryDocs sync2.AtomicUint64
52
-
53
- // RebuildLog []buildLogRecord
54
52
}
55
53
56
- // type buildLogRecord struct {
57
- // ID string
58
- // IndexList []string
59
- // StartedAt time.Time
60
- // FinishedAt *time.Time
61
- // Success bool
62
- // }
63
-
64
54
type statusInfo struct {
65
55
Uptime string
66
56
UptimeNano int64
@@ -85,10 +75,8 @@ type statusInfo struct {
85
75
DeleteAffectedRows uint64
86
76
DeleteQueries uint64
87
77
DeleteQueryDocs uint64
88
- // RebuildInProgress []string
89
- // RebuildLog []buildLogRecord
90
- Running bool
91
- Syncing bool
78
+ Running bool
79
+ Syncing bool
92
80
}
93
81
94
82
var getStatusInfo func () interface {}
@@ -157,31 +145,6 @@ func (s *stat) getStatusInfo() interface{} {
157
145
return status
158
146
}
159
147
160
- // func (s *stat) logRebuildStart(b indexGroupBuild) {
161
- // s.m.Lock()
162
- // defer s.m.Unlock()
163
- // r := buildLogRecord{
164
- // ID: b.id,
165
- // IndexList: b.indexSlice(),
166
- // StartedAt: time.Now(),
167
- // }
168
- // s.RebuildLog = append(s.RebuildLog, r)
169
- // }
170
-
171
- // func (s *stat) logRebuildFinish(buildID string, err error) {
172
- // s.m.Lock()
173
- // defer s.m.Unlock()
174
- // for i, r := range s.RebuildLog {
175
- // if r.ID == buildID {
176
- // now := time.Now()
177
- // r.FinishedAt = &now
178
- // r.Success = err == nil
179
- // s.RebuildLog[i] = r
180
- // break
181
- // }
182
- // }
183
- // }
184
-
185
148
func (s * stat ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
186
149
var buf bytes.Buffer
187
150
encoder := json .NewEncoder (& buf )
@@ -306,49 +269,6 @@ func handleReadyz(s *stat) http.HandlerFunc {
306
269
})
307
270
}
308
271
309
- // func handleRebuildRedir() http.HandlerFunc {
310
- // return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
311
- // w.Header().Add("Link", "</rebuild/sync>; rel=\"alternate\"")
312
- // w.Header().Add("Link", "</rebuild/async>; rel=\"alternate\"")
313
- // w.WriteHeader(http.StatusMultipleChoices)
314
- // w.Write([]byte(`
315
- // <html>
316
- // <body>
317
- // <p>You can rebuild all configured indexes by making a POST request to one of these endpoints:</p>
318
- // <ul>
319
- // <li><a href="/rebuild/sync">/rebuild/sync</a> - synchronously</li>
320
- // <li><a href="/rebuild/async">/rebuild/async</a> - asynchronously</li>
321
- // </ul>
322
- // </body>
323
- // </html>
324
- // `))
325
- // })
326
- // }
327
-
328
- // func handleRebuild(r *River, sync bool) http.HandlerFunc {
329
- // return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
330
- // w.Header().Set("Content-Type", "text/plain; charset=utf-8")
331
- // if req.Method != http.MethodPost {
332
- // w.WriteHeader(http.StatusMethodNotAllowed)
333
- // w.Write([]byte("unexpected method\n"))
334
- // return
335
- // }
336
- // reason := "requested via http endpoint"
337
- // if sync {
338
- // err := r.rebuildAll(req.Context(), reason)
339
- // if err != nil {
340
- // w.WriteHeader(http.StatusInternalServerError)
341
- // w.Write([]byte(errors.ErrorStack(err)))
342
- // } else {
343
- // w.WriteHeader(http.StatusNoContent)
344
- // }
345
- // } else {
346
- // go r.rebuildAll(nil, reason)
347
- // w.WriteHeader(http.StatusAccepted)
348
- // }
349
- // })
350
- // }
351
-
352
272
func handleStartSync (r * River , sync bool ) http.HandlerFunc {
353
273
return http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
354
274
w .Header ().Set ("Content-Type" , "text/plain; charset=utf-8" )
0 commit comments