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 RegisterSDK(lang, base string, hash func() (string, error))
- func SetWaitObserver(observer WaitObserver)
- func StagedSDKDir(configRoot, lang string) (string, error)
- 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 RegisterSDK ¶
RegisterSDK records the extension SDK this binary embeds for lang: it stages as <config-root>/state/pigsdk/<base>-<hash16>, hash16 being the first 16 hex digits of hash's result. A later registration of lang replaces the earlier one.
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 StagedSDKDir ¶
StagedSDKDir returns the directory this binary stages lang's extension SDK in under configRoot. It fails when no SDK is registered for lang and when the SDK's content hash cannot be computed. Package coding/extension/pigsdk registers the SDKs and every program that links package coding links it, so an unregistered language means a program built on the extension host alone; the error names the import that fixes 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.