cached

package
v0.0.0-...-3b98f14 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedReader

type CachedReader struct {
	// contains filtered or unexported fields
}

CachedReader provides a cache support for up to the first cacheSize bytes on top of the UpstreamReader.

func NewCachedReader

func NewCachedReader(ctx context.Context, rd UpstreamReader) *CachedReader

NewCachedReader returns a new CachedReader for upstream rd.

func (*CachedReader) Read

func (r *CachedReader) Read(p []byte) (int, error)

Read reads len(p) bytes of packed results from the current offset.

func (*CachedReader) ReadAt

func (r *CachedReader) ReadAt(p []byte, off int64) (int, error)

ReadAt reads len(p) bytes of packed results from offset off.

func (*CachedReader) ResultSet

func (r *CachedReader) ResultSet() resultset.ResultSet

ResultSet returns the upstream ResultSet.

func (*CachedReader) Seek

func (r *CachedReader) Seek(offset int64, whence int) (int64, error)

Seek updates the offset for the next Read.

type UpstreamReader

type UpstreamReader interface {
	io.ReadSeeker
	io.ReaderAt
	// ResultSet returns the upstream result set.
	ResultSet() resultset.ResultSet
}

UpstreamReader is the reader CachedReader reads from.

Jump to

Keyboard shortcuts

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