Documentation
¶
Index ¶
- func CalculateRefreshBuffer(timeUntilExpiry time.Duration) time.Duration
- func RunFuncAtInterval(ctx context.Context, interval time.Duration, f func(context.Context) error)
- func RunFuncAtIntervalWithErrorHandler(ctx context.Context, interval time.Duration, f func(context.Context) error, ...) error
- func SendErrorToChannel(credsChan chan credential.Result, err error)
- func SendToChannel(credsChan chan credential.Result, result credential.Result)
- type ContextHolder
- type SyncGate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateRefreshBuffer ¶
CalculateRefreshBuffer calculates how long before credential expiry we should refresh. It returns 20% of the time until expiry, with a minimum of 1 minute and maximum of 5 minutes. A random jitter of up to 10% is added to prevent thundering herd issues.
func RunFuncAtInterval ¶
func SendErrorToChannel ¶ added in v0.3.0
func SendErrorToChannel(credsChan chan credential.Result, err error)
SendErrorToChannel is a helper function to send an error result to the credentials channel.
func SendToChannel ¶
func SendToChannel(credsChan chan credential.Result, result credential.Result)
SendToChannel writes the credential.Result to the channel, ensuring the latest result is always available.
Types ¶
type ContextHolder ¶ added in v0.4.0
type ContextHolder struct {
// contains filtered or unexported fields
}
ContextHolder atomically stores a context.Context that can be set from one goroutine and read from another, for smuggling a context through third-party interfaces that don't accept one as a parameter.
func (*ContextHolder) Context ¶ added in v0.4.0
func (h *ContextHolder) Context() context.Context
Context returns the context last passed to Store, or context.Background() if Store has never been called.
func (*ContextHolder) Store ¶ added in v0.4.0
func (h *ContextHolder) Store(ctx context.Context)
Store sets the context returned by subsequent calls to Context.
type SyncGate ¶
type SyncGate struct {
// contains filtered or unexported fields
}
SyncGate is a synchronization primitive that can be opened and closed. When open, calls to Wait will return immediately. When closed, calls to Wait will block until it is opened.
func NewSyncGate ¶
func NewSyncGate() *SyncGate
NewSyncGate creates a new SyncGate, initially closed