extensions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 8 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

View Source
const (
	KNumBytes = "NumBytes"
	KCrc32    = "Crc32"
)

Variables

This section is empty.

Functions

func AddItemExtensions

func AddItemExtensions(
	ctx context.Context,
	rc io.ReadCloser,
	info details.ItemInfo,
	factories []CreateItemExtensioner,
) (io.ReadCloser, *details.ExtensionData, error)

AddItemExtensions wraps provided readcloser with extensions supplied via factory, with the first extension in slice being the innermost one. If no extensions are provided, the original readcloser is returned.

Types

type CreateItemExtensioner

type CreateItemExtensioner interface {
	CreateItemExtension(
		context.Context,
		io.ReadCloser,
		details.ItemInfo,
		*details.ExtensionData,
	) (io.ReadCloser, error)
}

type MockExtension

type MockExtension struct {
	NumBytes    int64
	Crc32       uint32
	Info        details.ItemInfo
	ExtData     *details.ExtensionData
	InnerRc     io.ReadCloser
	Ctx         context.Context
	FailOnRead  bool
	FailOnClose bool
}

func (*MockExtension) Close

func (me *MockExtension) Close() error

func (*MockExtension) Read

func (me *MockExtension) Read(p []byte) (int, error)

type MockItemExtensionFactory

type MockItemExtensionFactory struct {
	FailOnFactoryCreation bool
	FailOnRead            bool
	FailOnClose           bool
}

func (*MockItemExtensionFactory) CreateItemExtension

func (m *MockItemExtensionFactory) CreateItemExtension(
	ctx context.Context,
	rc io.ReadCloser,
	info details.ItemInfo,
	extData *details.ExtensionData,
) (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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