partio

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package partio implements chunk-based input/output where aligning is required.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkSource

type ChunkSource interface {
	Chunk(ctx context.Context, offset int64, b []byte) (int64, error)
}

ChunkSource downloads chunks.

type Streamer

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

Streamer provides a pseudo-stream.

func NewStreamer

func NewStreamer(r ChunkSource, chunkSize int64) *Streamer

NewStreamer initializes and returns new *Streamer using provided chunk source and chunk size.

func (Streamer) Stream

func (s Streamer) Stream(ctx context.Context, w io.Writer) error

Stream is shorthand for StreamAt that streams from the beginning.

func (Streamer) StreamAt

func (s Streamer) StreamAt(ctx context.Context, skip int64, w io.Writer) error

StreamAt streams from reader to "w" with "skip" offset.

type TimedChunkSource

type TimedChunkSource struct {
	ChunkSource
	Timeout time.Duration
}

TimedChunkSource wraps ChunkSource with Timeout for each chunk

func (TimedChunkSource) Chunk

func (s TimedChunkSource) Chunk(ctx context.Context, offset int64, b []byte) (int64, error)

Chunk implements ChunkSource with Timeout for each chunk.

Jump to

Keyboard shortcuts

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