util

package
v0.0.0-...-7c31ad9 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMirror

func CreateMirror(unpacker unpackFn) rio.MirrorFunc

CreateMirror provides basic mirroring logic used by both the tar and zip transmat implementations.

func CreateScanner

func CreateScanner(t api.PackType, unpacker unpackFn) rio.ScanFunc

func CreateUnpack

func CreateUnpack(t api.PackType, unpacker unpackFn) rio.UnpackFunc

CreateUnpack generates a standard rio.UnpackFunc shared by both zip and tar transmat implementations. The basic wrapper caches unpacking, validates types, and manages warehouse behavior.

func OpenWriteController

func OpenWriteController(
	warehouseAddr api.WarehouseLocation,
	packType api.PackType,
	mon rio.Monitor,
) (wc warehouse.BlobstoreWriteController, err error)

func PickReader

func PickReader(
	wareID api.WareID,
	warehouses []api.WarehouseLocation,
	requireMono bool,
	mon rio.Monitor,
) (_ io.ReadCloser, err error)

Pick a warehouse.

With K/V warehouses, this takes the form of "pick the first one that answers".

Types

type HashingReader

type HashingReader struct {
	R      io.Reader
	Hasher hash.Hash
}

Proxies a reader, hashing the stream as it's read. (This is useful if using `io.Copy` to move bytes from a reader to a writer, and you want to use that goroutine to power the hashing as well but replacing the writer with a multiwriter is out of bounds.)

func (*HashingReader) Read

func (r *HashingReader) Read(b []byte) (int, error)

Jump to

Keyboard shortcuts

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