extensions

package
v0.0.0-...-880cb89 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

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