package temporal
import "github.com/Azure/azure-sdk-for-go/sdk/internal/temporal"
Index ¶
- type AcquireResource
- type Resource
- func NewResource[TResource, TState any](ar AcquireResource[TResource, TState]) *Resource[TResource, TState]
- func NewResourceWithOptions[TResource, TState any](ar AcquireResource[TResource, TState], opts ResourceOptions[TResource, TState]) *Resource[TResource, TState]
- func (er *Resource[TResource, TState]) Expire()
- func (er *Resource[TResource, TState]) Get(state TState) (TResource, error)
- type ResourceOptions
- type ShouldRefresh
Types ¶
type AcquireResource ¶
type AcquireResource[TResource, TState any] func(state TState) (newResource TResource, newExpiration time.Time, err error)
AcquireResource abstracts a method for refreshing a temporal resource.
type Resource ¶
type Resource[TResource, TState any] struct { // contains filtered or unexported fields }
Resource is a temporal resource (usually a credential) that requires periodic refreshing.
func NewResource ¶
func NewResource[TResource, TState any](ar AcquireResource[TResource, TState]) *Resource[TResource, TState]
NewResource creates a new Resource that uses the specified AcquireResource for refreshing.
func NewResourceWithOptions ¶
func NewResourceWithOptions[TResource, TState any](ar AcquireResource[TResource, TState], opts ResourceOptions[TResource, TState]) *Resource[TResource, TState]
NewResourceWithOptions creates a new Resource that uses the specified AcquireResource for refreshing.
func (*Resource[TResource, TState]) Expire ¶
func (er *Resource[TResource, TState]) Expire()
Expire marks the resource as expired, ensuring it's refreshed on the next call to Get().
func (*Resource[TResource, TState]) Get ¶
Get returns the underlying resource. If the resource is fresh, no refresh is performed.
type ResourceOptions ¶
type ResourceOptions[TResource, TState any] struct { // ShouldRefresh indicates whether [Resource.Get] should acquire an updated resource despite // the currently held resource not having expired. [Resource.Get] ignores all errors from // refresh attempts triggered by ShouldRefresh returning true, and doesn't call ShouldRefresh // when the resource has expired (it unconditionally updates expired resources). When // ShouldRefresh is nil, [Resource.Get] refreshes the resource if it will expire within 5 // minutes. ShouldRefresh ShouldRefresh[TResource, TState] }
ResourceOptions contains optional configuration for Resource
type ShouldRefresh ¶
ShouldRefresh abstracts a method for indicating whether a resource should be refreshed before expiration.
Source Files ¶
- Version
- v1.11.1 (latest)
- Published
- Apr 7, 2025
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 8 minutes ago –
Tools for package owners.