mirror of
https://github.com/enix/x509-certificate-exporter.git
synced 2026-08-23 22:16:39 +00:00
docs: document deferred Lot 4 optimisations as inline TODOs
This commit is contained in:
@@ -836,6 +836,16 @@ func (s *Source) trackUpsert(sink cert.Sink, b cert.Bundle) {
|
||||
sink.Upsert(b)
|
||||
}
|
||||
|
||||
// deleteAllRefs scans the entire tracked set looking for entries that
|
||||
// match a given (kind, location). On large clusters with high churn of
|
||||
// namespace labels (which call deleteAllRefs on every namespace event)
|
||||
// this O(total-refs) loop becomes the dominant cost in onNamespace.
|
||||
//
|
||||
// TODO(perf): replace s.tracked with a two-level index
|
||||
// `map[kind+":"+namespace+"/"]map[string]struct{}` so deleteAllRefs only
|
||||
// walks refs that actually live in the affected namespace. Deferred
|
||||
// until we observe the bottleneck in practice — see Lot 4 of the audit
|
||||
// plan.
|
||||
func (s *Source) deleteAllRefs(sink cert.Sink, kind, loc string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
@@ -31,6 +31,15 @@ func New() Parser { return Parser{} }
|
||||
func (Parser) Format() string { return cert.FormatPEM }
|
||||
|
||||
// Parse implements cert.FormatParser.
|
||||
//
|
||||
// TODO(memory): on cert-manager-style installs (hundreds of TLS Secrets
|
||||
// referencing the same intermediate CA), every Bundle holds an
|
||||
// independently parsed copy of the shared CA — wasting ~2 MB per 500
|
||||
// secrets versus the ~5 KB theoretical floor. A SHA-256(DER) → cached
|
||||
// *x509.Certificate interner here would dedupe shared chain links. Not
|
||||
// a leak (cleared on Bundle drop), just byte-level redundancy. Deferred
|
||||
// until the steady-state heap profile says it matters — see Lot 4 of
|
||||
// the audit plan.
|
||||
func (Parser) Parse(data []byte, ref cert.SourceRef, _ cert.ParseOptions) cert.Bundle {
|
||||
b := cert.Bundle{Source: ref}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user