Documentation
¶
Overview ¶
Package pigsdklock coordinates readers and writers of staged Pig extension SDKs within one configuration root.
Index ¶
- func AcquireBuild(ctx context.Context, configRoot string) (func() error, error)
- func AcquireBuildForRoot(ctx context.Context, sdkRoot string) (func() error, error)
- func AcquireStage(ctx context.Context, configRoot string) (func() error, error)
- func SetWaitObserver(observer WaitObserver)
- func WithBuild[T any](ctx context.Context, configRoot string, fn func() (T, error)) (result T, err error)
- func WithBuildCandidates[T any](ctx context.Context, candidates []string, fn func() (T, error)) (result T, err error)
- func WithBuildEntryCandidates(ctx context.Context, candidates []string, fn func() (string, bool, error)) (string, bool, error)
- func WithBuildEntryForRoot(ctx context.Context, sdkRoot string, fn func() (string, bool, error)) (entry string, valid bool, err error)
- func WithBuildForRoot[T any](ctx context.Context, sdkRoot string, fn func() (T, error)) (result T, err error)
- type WaitObserver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcquireBuild ¶
AcquireBuild holds a shared lease on one config root's staged SDKs.
func AcquireBuildForRoot ¶
AcquireBuildForRoot holds a shared lease when sdkRoot is a staged Pig SDK.
func AcquireStage ¶
AcquireStage holds an exclusive lease on one config root's staged SDKs.
func SetWaitObserver ¶
func SetWaitObserver(observer WaitObserver)
SetWaitObserver installs the process-wide observer of contended acquisitions, so a waiting startup can say why it is waiting. Nil removes it.
func WithBuild ¶
func WithBuild[T any](ctx context.Context, configRoot string, fn func() (T, error)) (result T, err error)
WithBuild holds a shared lease while fn consumes one config root's SDKs.
func WithBuildCandidates ¶
func WithBuildCandidates[T any](ctx context.Context, candidates []string, fn func() (T, error)) (result T, err error)
WithBuildCandidates holds shared leases for staged SDK paths before fn resolves one of them.
func WithBuildEntryCandidates ¶
func WithBuildEntryCandidates(ctx context.Context, candidates []string, fn func() (string, bool, error)) (string, bool, error)
WithBuildEntryCandidates adapts a cache-entry lookup to WithBuildCandidates.
Types ¶
type WaitObserver ¶
WaitObserver is told when an acquisition must wait for another holder. It returns the function called when the wait ends, acquired or not.