chunk

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkGroup

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

ChunkGroup manage groups of chunks

func NewChunkGroup

func NewChunkGroup(file fsctx.FileHeader, chunkSize uint64, backoff backoff.Backoff, useBuffer bool) *ChunkGroup

func (*ChunkGroup) Index

func (c *ChunkGroup) Index() int

Index returns current chunk index, starts from 0

func (*ChunkGroup) IsLast

func (c *ChunkGroup) IsLast() bool

IsLast returns if current chunk is the last one

func (*ChunkGroup) Length

func (c *ChunkGroup) Length() int64

Length returns the length of current chunk

func (*ChunkGroup) Next

func (c *ChunkGroup) Next() bool

Next switch to next chunk, returns whether all chunks are processed

func (*ChunkGroup) Num

func (c *ChunkGroup) Num() int

Num returns the total chunk number

func (*ChunkGroup) Process

func (c *ChunkGroup) Process(processor ChunkProcessFunc) error

Process a chunk with retry logic

func (*ChunkGroup) RangeHeader

func (c *ChunkGroup) RangeHeader() string

RangeHeader returns header value of Content-Range

func (*ChunkGroup) Start

func (c *ChunkGroup) Start() int64

Start returns the byte index of current chunk

func (*ChunkGroup) TempAvailable

func (c *ChunkGroup) TempAvailable() bool

TempAvailable returns if current chunk temp file is available to be read

func (*ChunkGroup) Total

func (c *ChunkGroup) Total() int64

Total returns the total length

type ChunkProcessFunc

type ChunkProcessFunc func(c *ChunkGroup, chunk io.Reader) error

ChunkProcessFunc callback function for processing a chunk

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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