Documentation ¶
Index ¶
Constants ¶
const TmpTrackerPrefix = "tmp/"
TmpTrackerPrefix is the tracker prefix for temporary objects.
Variables ¶
This section is empty.
Functions ¶
func NewTmpDeleter ¶
NewTmpDeleter creates a new temporary deleter.
func WithStringSet ¶
func WithStringSet(ctx context.Context, ttl time.Duration, rf RenewFunc, cf ComposeFunc, cb func(ctx context.Context, ss *StringSet) error) (retErr error)
WithStringSet creates a StringSet using ttl and rf. It calls cb with the StringSets context and the new StringSet. If ctx is cancelled, the StringSet will be Closed, and the cancellation will propagate down to the context passed to cb.
Types ¶
type ComposeFunc ¶
ComposeFunc is the type of a function used to compose a set of strings
func NewTmpComposer ¶
func NewTmpComposer(tr track.Tracker, name string) ComposeFunc
NewTmpComposer returns a ComposeFunc which creates meaningless temporary objects Use NewTmpDeleter to get a no-op track.Deleter to handle these objects.
type Renewer ¶
type Renewer struct {
// contains filtered or unexported fields
}
Renewer manages renewing something in the background
func NewRenewer ¶
NewRenewer returns a renewer that will call renewFunc with ttl every period; where period will be some fraction ttl. If ctx is cancelled the renewer will be closed.
type StringSet ¶
type StringSet struct { *Renewer // contains filtered or unexported fields }
StringSet renews a set of strings until it is closed
func NewStringSet ¶
func NewStringSet(ctx context.Context, ttl time.Duration, renewFunc RenewFunc, composeFunc ComposeFunc) *StringSet
NewStringSet returns a StringSet it will renew every string in the set for ttl each period. See Renewer