chunkaligned

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: BSD-3-Clause, Apache-2.0 Imports: 5 Imported by: 0

README

chunkaligned

Summary

NewChunkAlignedReaderAt returns a ReaderAt wrapper that is backed by a ReaderAt r of size totalSize where the wrapper guarantees that all ReadAt calls are aligned to chunkSize boundaries and of size chunkSize (except for the final chunk, which may be shorter).

A chunk-aligned reader is good for caching, letting upper layers have any access pattern, but guarantees that the wrapped ReaderAt sees only nicely-cacheable access patterns & sizes.

Usage

For API docs and examples, see tests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SizeReaderAt

type SizeReaderAt interface {
	Size() int64
	io.ReaderAt
}

An io.SectionReader implements SizeReaderAt.

func NewChunkAlignedReaderAt

func NewChunkAlignedReaderAt(r SizeReaderAt, chunkSize int) (SizeReaderAt, error)

NewChunkAlignedReaderAt returns a ReaderAt wrapper that is backed by a ReaderAt r of size totalSize where the wrapper guarantees that all ReadAt calls are aligned to chunkSize boundaries and of size chunkSize (except for the final chunk, which may be shorter).

A chunk-aligned reader is good for caching, letting upper layers have any access pattern, but guarantees that the wrapped ReaderAt sees only nicely-cacheable access patterns & sizes.

Jump to

Keyboard shortcuts

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