MCPcopy
hub / github.com/elastic/go-elasticsearch / doProductCheck

Method doProductCheck

elasticsearch.go:605–628  ·  view source on GitHub ↗

doProductCheck calls f if there as not been a prior successful call to doProductCheck, returning nil otherwise.

(f func() error)

Source from the content-addressed store, hash-verified

603// doProductCheck calls f if there as not been a prior successful call to doProductCheck,
604// returning nil otherwise.
605func (c *BaseClient) doProductCheck(f func() error) error {
606 c.productCheckMu.RLock()
607 productCheckSuccess := c.productCheckSuccess
608 c.productCheckMu.RUnlock()
609
610 if productCheckSuccess {
611 return nil
612 }
613
614 c.productCheckMu.Lock()
615 defer c.productCheckMu.Unlock()
616
617 if c.productCheckSuccess {
618 return nil
619 }
620
621 if err := f(); err != nil {
622 return err
623 }
624
625 c.productCheckSuccess = true
626
627 return nil
628}
629
630// genuineCheckHeader validates the presence of the X-Elastic-Product header
631func genuineCheckHeader(header http.Header) error {

Callers 1

PerformMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected