over-engineering audit: remove dead code, speculative config, duplicate queues
- delete embedded community resolver snapshot (6,760 lines) + EmbeddedServers + DNS_SERVERS=fresh; curated resolvers are the default. Simplify Warm (no sampling). - one generic internal/sample.Queue[T] replaces three near-identical random-sample queues (probe, pipeline, discover). - delete unreachable index.listOpenSearch (OpenSearch is never listable). - delete classifyCloudFront (its match is always discarded, !ResourceSpecific). - delete probe.Probe wrapper + Describe; tests use ProbeDetailed. - delete store.Pool(), model.SourceDNSAlias, discover.QueueLen. - drop dead config/no-op knobs: pipeline DirectWorkers, discover MaxPerDomain, discover S3/GCS/DO flags, BUCKET_SCAN_DO. ~-7,000 lines (mostly the resolver snapshot), 0 deps removed, tests green.
This commit is contained in:
1 parent
81e53f8755
commit
dc7bdae99d
22 files changed
+150
-7202
No files matched your search
@@ -55,8 +55,6 @@ func (x *Indexer) List(ctx context.Context, c model.Candidate) ([]model.Entry, e
|
||||
switch c.Service {
|
||||
case model.ServiceS3:
|
||||
return x.listS3(ctx, c.Hostname)
|
||||
case model.ServiceOpenSearch:
|
||||
return x.listOpenSearch(ctx, c.Hostname)
|
||||
}
|
||||
case model.ProviderGCP:
|
||||
switch c.Service {
|
||||
@@ -360,36 +358,6 @@ func (x *Indexer) listFirebase(ctx context.Context, host string) ([]model.Entry,
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
// --- OpenSearch / Elasticsearch indices ---
|
||||
|
||||
func (x *Indexer) listOpenSearch(ctx context.Context, host string) ([]model.Entry, error) {
|
||||
resp, err := x.get(ctx, x.scheme+"://"+host+"/_cat/indices?format=json&h=index,health,status,docs.count,store.size")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var rows []struct {
|
||||
Index string `json:"index"`
|
||||
Health string `json:"health"`
|
||||
Status string `json:"status"`
|
||||
Docs string `json:"docs.count"`
|
||||
StoreSiz string `json:"store.size"`
|
||||
}
|
||||
err = json.NewDecoder(io.LimitReader(resp.Body, 8<<20)).Decode(&rows)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var entries []model.Entry
|
||||
for _, r := range rows {
|
||||
size, _ := strconv.ParseInt(strings.TrimSuffix(r.Docs, " "), 10, 64)
|
||||
entries = append(entries, model.Entry{Kind: "index", Name: r.Index, Size: size, ETag: r.StoreSiz})
|
||||
if len(entries) >= x.maxObjects {
|
||||
break
|
||||
}
|
||||
}
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
func parseTime(s string) time.Time {
|
||||
if s == "" {
|
||||
return time.Time{}
|
||||
|
||||
@@ -81,19 +81,6 @@ func TestListFirebase(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListOpenSearch(t *testing.T) {
|
||||
x, host := newTestIndexer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
_, _ = w.Write([]byte(`[{"index":"logs-2024","docs.count":"100","store.size":"1.2mb"}]`))
|
||||
}))
|
||||
entries, err := x.List(context.Background(), model.Candidate{Hostname: host, Provider: model.ProviderAWS, Service: model.ServiceOpenSearch})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(entries) != 1 || entries[0].Name != "logs-2024" || entries[0].Size != 100 {
|
||||
t.Fatalf("unexpected entries: %+v", entries)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListBounded(t *testing.T) {
|
||||
var keys strings.Builder
|
||||
for i := 0; i < 100; i++ {
|
||||
|
||||
Reference in new issue
Block a user