Distributor makes it easy for provider implementations to furnish new key materials by handling synchronization between the producer and consumers of the key material. Provider implementations which choose to use a Distributor should do the following: - create a new Distributor using the NewDistrib
| 37 | // - delegate to the distributor when handing calls to KeyMaterial(). |
| 38 | // - invoke the Stop() method when they are done using the distributor. |
| 39 | type Distributor struct { |
| 40 | // mu protects the underlying key material. |
| 41 | mu sync.Mutex |
| 42 | km *KeyMaterial |
| 43 | pErr error |
| 44 | |
| 45 | // ready channel to unblock KeyMaterial() invocations blocked on |
| 46 | // availability of key material. |
| 47 | ready *grpcsync.Event |
| 48 | // done channel to notify provider implementations and unblock any |
| 49 | // KeyMaterial() calls, once the Distributor is closed. |
| 50 | closed *grpcsync.Event |
| 51 | } |
| 52 | |
| 53 | // NewDistributor returns a new Distributor. |
| 54 | func NewDistributor() *Distributor { |
nothing calls this directly
no outgoing calls
no test coverage detected