temporal

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 (*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

func (er *Resource[TResource, TState]) Get(state TState) (TResource, error)

Get returns the underlying resource. If the resource is fresh, no refresh is performed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL