package lazy
import "github.com/gohugoio/hugo/lazy"
Index ¶
- type Init
- func New() *Init
- func (ini *Init) Add(initFn func(context.Context) (any, error)) *Init
- func (ini *Init) AddWithTimeout(timeout time.Duration, f func(ctx context.Context) (any, error)) *Init
- func (ini *Init) Branch(initFn func(context.Context) (any, error)) *Init
- func (ini *Init) BranchWithTimeout(timeout time.Duration, f func(ctx context.Context) (any, error)) *Init
- func (ini *Init) Do(ctx context.Context) (any, error)
- func (ini *Init) InitCount() int
- func (ini *Init) Reset()
- type OnceMore
Types ¶
type Init ¶
type Init struct {
// contains filtered or unexported fields
}
Init holds a graph of lazily initialized dependencies.
func New ¶
func New() *Init
New creates a new empty Init.
func (*Init) Add ¶
Add adds a func as a new child dependency.
func (*Init) AddWithTimeout ¶
func (ini *Init) AddWithTimeout(timeout time.Duration, f func(ctx context.Context) (any, error)) *Init
AddWithTimeout is same as Add, but with a timeout that aborts initialization.
func (*Init) Branch ¶
Branch creates a new dependency branch based on an existing and adds the given dependency as a child.
func (*Init) BranchWithTimeout ¶
func (ini *Init) BranchWithTimeout(timeout time.Duration, f func(ctx context.Context) (any, error)) *Init
BranchWithTimeout is same as Branch, but with a timeout.
func (*Init) Do ¶
Do initializes the entire dependency graph.
func (*Init) InitCount ¶
InitCount gets the number of this this Init has been initialized.
func (*Init) Reset ¶
func (ini *Init) Reset()
Reset resets the current and all its dependencies.
type OnceMore ¶
type OnceMore struct {
// contains filtered or unexported fields
}
func (*OnceMore) Do ¶
func (t *OnceMore) Do(f func())
func (*OnceMore) Done ¶
func (*OnceMore) InProgress ¶
func (*OnceMore) ResetWithLock ¶
Source Files ¶
- Version
- v0.144.2 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 13 hours ago –
Tools for package owners.