internal

package
v0.0.0-...-70e5bc8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package internal provides some helpers used by packing implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockSum

func BlockSum(bs []upspin.DirBlock) []byte

BlockSum returns the SHA256 hash of the given DirBlocks' Packdata.

func CheckLocationSet

func CheckLocationSet(d *upspin.DirEntry) error

CheckLocationSet checks whether the previous block's Location field was set, to prevent misuse of the BlockPacker API.

Types

type BlockTracker

type BlockTracker struct {
	// Block is the index of the current block.
	Block int
	// contains filtered or unexported fields
}

BlockTracker maintains an index into a slice of upspin.DirBlock.

func NewBlockTracker

func NewBlockTracker(bs []upspin.DirBlock) BlockTracker

NewBlockTracker returns a BlockTracker that iterates over the given slice.

func (*BlockTracker) NextBlock

func (t *BlockTracker) NextBlock() (upspin.DirBlock, bool)

NextBlock implements part of the upspin.BlockUnpacker interface.

func (*BlockTracker) SeekBlock

func (t *BlockTracker) SeekBlock(n int) (upspin.DirBlock, bool)

SeekBlock implements part of the upspin.BlockUnpacker interface.

type LazyBuffer

type LazyBuffer []byte

LazyBuffer is a []byte that is lazily (re-)allocated when its Bytes method is called.

func (*LazyBuffer) Bytes

func (b *LazyBuffer) Bytes(n int) []byte

Bytes returns a []byte that has length n. It re-uses the underlying LazyBuffer []byte if it is at least n bytes in length.

Directories

Path Synopsis
Package packtest provides common functionality used by packer tests.
Package packtest provides common functionality used by packer tests.

Jump to

Keyboard shortcuts

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