hooks

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

type Hooks struct {
	// OnHash is called when digest computation starts.
	OnHash OnHashFunc

	// OnStart is called when the build process starts.
	OnStart OnStartFunc

	// OnError is called when the build process encounters an error.
	OnError OnErrorFunc

	// OnComplete is called when the build process completes successfully.
	OnComplete OnCompleteFunc
}

Hooks is a struct that contains hook functions.

func NewHooks

func NewHooks(opts ...Option) Hooks

NewHooks creates a new Hooks instance with optional function parameters.

type OnCompleteFunc

type OnCompleteFunc func(name string, desc ocispec.Descriptor)

OnCompleteFunc defines the signature for the OnComplete hook function.

type OnErrorFunc

type OnErrorFunc func(name string, err error)

OnErrorFunc defines the signature for the OnError hook function.

type OnHashFunc added in v0.2.3

type OnHashFunc func(name string, size int64, reader io.Reader) io.Reader

OnHashFunc defines the signature for the OnHash hook function. Called when digest computation starts, wraps reader with progress tracking.

type OnStartFunc

type OnStartFunc func(name string, size int64, reader io.Reader) io.Reader

OnStartFunc defines the signature for the OnStart hook function.

type Option

type Option func(*Hooks)

Option is a function type that can be used to customize a Hooks instance.

func WithOnComplete

func WithOnComplete(f OnCompleteFunc) Option

WithOnComplete returns an Option that sets the OnComplete hook.

func WithOnError

func WithOnError(f OnErrorFunc) Option

WithOnError returns an Option that sets the OnError hook.

func WithOnHash added in v0.2.3

func WithOnHash(f OnHashFunc) Option

WithOnHash returns an Option that sets the OnHash hook.

func WithOnStart

func WithOnStart(f OnStartFunc) Option

WithOnStart returns an Option that sets the OnStart hook.

Jump to

Keyboard shortcuts

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