chunk

package
v4.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package chunk is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedFileType = errors.New("unsupported file type")

Functions

func ShouldSkipFile

func ShouldSkipFile(data []byte) bool

ShouldSkipFile checks if the file should be skipped based on its content type

Types

type Chunk

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

Chunk holds two pools and sizing parameters needed for reading chunks of data with look-ahead

func New

func New(opts ...Option) *Chunk

func (*Chunk) GetBuf

func (c *Chunk) GetBuf(data []byte) (*bytes.Buffer, bool)

GetBuf returns a bytes.Buffer from the pool, seeded with the data

func (*Chunk) GetFileThreshold

func (c *Chunk) GetFileThreshold() int64

func (*Chunk) GetMaxPeekSize

func (c *Chunk) GetMaxPeekSize() int

func (*Chunk) GetPeekedBuf

func (c *Chunk) GetPeekedBuf() (*[]byte, bool)

GetPeekedBuf returns a fixed-size []byte from the pool

func (*Chunk) GetSize

func (c *Chunk) GetSize() int

func (*Chunk) PutBuf

func (c *Chunk) PutBuf(window *bytes.Buffer)

PutBuf returns the bytes.Buffer to the pool

func (*Chunk) PutPeekedBuf

func (c *Chunk) PutPeekedBuf(b *[]byte)

PutPeekedBuf returns the fixed-size []byte to the pool

func (*Chunk) ReadChunk

func (c *Chunk) ReadChunk(reader *bufio.Reader, totalLines int) (string, error)

ReadChunk reads the next chunk of data from file

type IChunk

type IChunk interface {
	GetSize() int
	GetMaxPeekSize() int
	GetFileThreshold() int64
	ReadChunk(reader *bufio.Reader, totalLines int) (string, error)
}

type MockIChunk

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

MockIChunk is a mock of IChunk interface.

func NewMockIChunk

func NewMockIChunk(ctrl *gomock.Controller) *MockIChunk

NewMockIChunk creates a new mock instance.

func (*MockIChunk) EXPECT

func (m *MockIChunk) EXPECT() *MockIChunkMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIChunk) GetFileThreshold

func (m *MockIChunk) GetFileThreshold() int64

GetFileThreshold mocks base method.

func (*MockIChunk) GetMaxPeekSize

func (m *MockIChunk) GetMaxPeekSize() int

GetMaxPeekSize mocks base method.

func (*MockIChunk) GetSize

func (m *MockIChunk) GetSize() int

GetSize mocks base method.

func (*MockIChunk) ReadChunk

func (m *MockIChunk) ReadChunk(reader *bufio.Reader, totalLines int) (string, error)

ReadChunk mocks base method.

type MockIChunkMockRecorder

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

MockIChunkMockRecorder is the mock recorder for MockIChunk.

func (*MockIChunkMockRecorder) GetFileThreshold

func (mr *MockIChunkMockRecorder) GetFileThreshold() *gomock.Call

GetFileThreshold indicates an expected call of GetFileThreshold.

func (*MockIChunkMockRecorder) GetMaxPeekSize

func (mr *MockIChunkMockRecorder) GetMaxPeekSize() *gomock.Call

GetMaxPeekSize indicates an expected call of GetMaxPeekSize.

func (*MockIChunkMockRecorder) GetSize

func (mr *MockIChunkMockRecorder) GetSize() *gomock.Call

GetSize indicates an expected call of GetSize.

func (*MockIChunkMockRecorder) ReadChunk

func (mr *MockIChunkMockRecorder) ReadChunk(reader, totalLines any) *gomock.Call

ReadChunk indicates an expected call of ReadChunk.

type Option

type Option func(*Chunk)

func WithMaxPeekSize

func WithMaxPeekSize(maxPeekSize int) Option

WithMaxPeekSize sets the max size of look-ahead bytes

func WithSize

func WithSize(size int) Option

WithSize sets the chunk size

func WithSmallFileThreshold

func WithSmallFileThreshold(smallFileThreshold int64) Option

WithSmallFileThreshold sets the threshold for small files

Jump to

Keyboard shortcuts

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